
DAG (Directed Acyclic Graph) technology is one of the hot spots in the blockchain field. Compared with the original block + chain data structure, DAG technology has faster transaction speed and stronger scalability, but due to its high technical threshold and development difficulty, there are few projects that are deeply cultivated in DAG technology . We hope to present readers with a complete picture of DAG technology through the analysis of specific project principles. In this issue, XDAG is selected as an analysis case.
Author: Wang Fan and Chen Hongyi
Director: Tan Ying
Interviewee in this issue: XDAG core developer Frozen
Supporting organizations (in no particular order):
first level title
.01. What is a DAG
In graph theory, if a directed graph starts from any vertex and cannot return to that point through several edges, then the graph is a directed acyclic graph.
Like a tree, a graph is a data structure. A graph can be divided into a directed graph and an undirected graph. Further constraints on a directed graph form a directed acyclic graph. A directed graph consists of a limited number of vertices and directed edges. , each directed edge points from one vertex to another vertex, and acyclic means that starting from any vertex cannot return to the original vertex through these directed edges.
first level title
. 02 .DAG principle - take the XDAG project as an example
In the XDAG network, it is actually a combination of dynamic "local area networks". All trading users belong to different "local area networks", and different "local area networks" are combined to form the entire XDAG network. The foundation of the "local area network" is a node with the ability to verify transactions (mining) (this node can be a single miner, or it may be a mine or a mining pool). When a user initiates a transaction, the transaction will be sent to his own "local area network". "miners, miners will verify digital signatures, asset balances, data formats, data integrity and other information, when encountering invalid transactions, they will mark them, and then miners will pack the confirmed information and send it to the entire network, other " "LAN" miners will verify whether the data packet they received is legal after receiving it. If there is no problem, then these transactions will be recognized.
first level title
. 03 .DAG Advantages
Compared with the blockchain, DAG is actually the difference between a graph and a chain. For a chain, it cannot only deal with one part, because there is only one in-degree and out-degree of the chain, and the nodes on the chain cannot be split into several Nodes to process, but it is possible for graphs, because graphs can have multiple out-degrees, then nodes connected by multiple out-degrees can be processed at the same time.
For the chain network, it is not that the processing ability of the nodes is not strong, but the chain structure cannot be calculated in parallel, and the time wasted is mainly waiting time: one is to initiate a transaction, which needs to be synchronized with all nodes, and the other is when there is a Node confirmation needs to be synchronized to the whole network. For DAG, there is no such problem. When the wallet initiates a transaction, it does not need to wait for how many transactions it has before. It only needs to go through partial verification, network broadcast, and other partial verification. Nodes are doing work similar to puzzles, splicing their own transactions with those confirmed by others.
Therefore, it is concluded that DAG has the following advantages:
3.1 Transaction speed block
The partial processing and parallel settlement implemented by DAG can greatly increase the transaction speed.
3.2. Strong expandability
Because each node can calculate without waiting to synchronize the data of other nodes, it is easy for accounting nodes to reply and extend, so DAG is very suitable for Internet of Things projects, such as machine micropayment.
3.3. It is more difficult to do evil
first level title
.04 .DAG Problems
Although many advantages of DAG have been described above, in fact, DAG also has its own defects, and DAG projects are also using different technical means to solve them.
4.1 The transaction time is uncontrollable
The essence of DAG is a kind of asynchronous communication. The biggest problem brought by asynchronous communication is that the consistency is uncontrollable. In the DAG model, the transaction confirmation time is completely unknown. Of course, to some extent, it can also be considered that in the chain model, a block is finally confirmed by the entire network when it is accepted by more than 2/3 of the number of nodes, so the final confirmation time cannot be accurately judged. In response to the above problems, XDAG adopted the method of POW+64s fixed block generation.
4.2 The amount of network transmission data has increased significantly
In the chain structure, only ledger nodes keep accounts, and a large number of wallet nodes can only communicate with one ledger node. Therefore, the number of ledger nodes in the entire network is far smaller than that of wallet nodes. In this case, all data synchronization is completed between ledger nodes, assuming that there are M ledger nodes in the network, and the number of times each record is transmitted in the network is M+1.
DAG structure, when there are N device nodes in the entire network (N is thousands of times greater than M), each message needs to be communicated point-to-point between devices, so for any message to be sent, there will be N^2 times in the network Data sending (every node tries to send information to other neighbor nodes). After DAG is connected to a large number of IoT nodes in the future, this will create high requirements for accounting nodes.
4.3 Shadow chain attack
The feature of DAG that allows multiple parallel transactions may cause an attacker to secretly generate a shadow chain, and connect the shadow chain with the main chain from time to time to evade the detection algorithm. In extreme cases, this shadow chain may replace the main chain and become the consensus of the entire network. The mechanism of XDAG itself determines that there will be no shadow chain attacks, and Byteball solves it through the witness model.
4.4 The development of smart contracts is difficult
first level title
. 05 .DAG public chain representative project
5.1 XDAG
XDAG is a decentralized payment system that can realize tens of thousands of transactions per second, and is currently the only DAG+POW project with high performance and high security. The XDAG project is a completely community-driven project. It currently has three core developers and about 30,000 community members. Recently, several core developers in the community have made a lot of optimizations to the old version, and the new version has been launched last week, and for the C language version of the original program, the developers are working hard to develop C++, Go, and Python versions, which are expected to be released in one or two days. completed within a month.
XDAG current price: about 0.488 yuan
Mining rules: A total of 160 years of mining, halving every four years, 400 million mined every year in the previous four years; a block is produced every 64s, and a block rewards 1024 xdag.
Mining pool introduction: At present, XDAG has three relatively old large-scale mining pools, namely fat pool, vspool, and flying pool. Due to factors such as pool fees, the returns are not ideal. Holding the belief of providing more stable and transparent services to domestic miners, Fatty decided to build an exclusive mining pool (Fat Pool) for domestic people. Fat Pool adopts a high-defense host, optimizes and adjusts lines for domestic miners, can withstand 18T traffic attacks, the rate is open and transparent, has a complete interface and query functions, and supports WeChat official account disconnection reminders and income queries.
5.2 IOTA
IOTA is an open source underlying protocol. It is a new transaction settlement and data transfer layer specially designed for the Internet of Things. Using DAG-based Tangle technology, community members or related companies can spontaneously develop corresponding software on top of the protocol. Applications, representative application cases are as follows: Qubic, Elaadn, data.iota.org, IoTipBot.
5.3 Byteball
Byteball is a new type of digital asset platform based on DAG technology. It prevents double spending by setting the previous transaction records before transfer, and adopts a new witness mode to ensure the security of the main chain selection process. Because of the existence of witnesses, Byteball Fees will be charged for rewards. From this perspective, Byteball is not suitable for the Internet of Things and small transaction fields.
5.4 Nano
first level title
.06.Summary
With the awareness and popularization of DAG technology in the community, the increasing number of developers, and the improvement and development of DAG technology, the advantages of DAG projects will gradually become prominent. Its superior performance and strong scalability are a must for existing blockchain projects. Huge impact, from a technical point of view, what DAG brings us is a new blockchain experiment.
3. Commercial reprinting and secondary editing and reprinting are prohibited.
【Reprint Notice】
1. This report is an original work of Jingdata's professional data research and analysis organization [Jingzhun Research Institute], which is protected by the "Copyright Law" and enjoys the right to compile and annotate according to law;
2. Please leave a message in the background for reprinting, and you can reprint after obtaining authorization;
3. Commercial reprinting and secondary editing and reprinting are prohibited.