What is a DAG?


When we are interested in how blockchains work and, in particular, the innovations brought about by projects or new forms of consensus, we may be confronted with the term DAG. We would like to explain to you what a DAG is and how it works! In the end, we will talk about the connection between DAGs and blockchain, and what the advantages of this connection are.

DAG


A DAG (short for Directed Acylic Graph) is an ancient mathematical structure whose use is often applied in the field of computer science. These graphs are models of networks that connect the nodes that make them up. In these graphs you can find different types of 'trees, but also chains of nodes (nodes), or blocks in the context of Bitcoin. A DAG is a structure that only has direct links between its nodes and no cycles. That is, you cannot fall back on the same node when navigating the graph. This allows direct navigation from node to node through the node relationships.

DAGs are absolutely not necessarily linked to blockchains and, like many other technologies, were used long before the advent of crypto projects. They are used in the organization of a lot of data, like Git for example.

How do DAGs work?


DAGs are structures that consist of two different types of elements: the nodes and the links between those nodes. This can be used to keep a history of data such as software versions or interactions between users. This avoids the conflicts associated with using a linear history, where the addition of a new element must be directly linked to the oldest element (and only to the latter). In the context of software versions, version 5 can only be linked to version 4 in a linear framework. By using a DAG, this version can be linked-to version 3, while version 6 will link versions 4 and 5.

Regarding the path of a DAG, there are several algorithms, each of which has its own specific characteristics. The use of DAGs facilitates the use of certain algorithms compared to other more generalist graphs, such as searching for the shortest or longest paths between two specific nodes.

DAGs in the context of blockchains


A DAG is also widely used in the crypto world. Although there are relatively few blockchains that use a DAG in their architecture. Nevertheless, its use could solve blockchain scalability problems. It is important to understand what can be replaced by a DAG and what operations are irrelevant.

Contrary to popular belief, the use of a DAG is not linked to transaction verification, issuance, or other types of protocols as they currently exist. In the context of the scalability of blockchains, there are many bottlenecks and constraints imposed by technical means such as the power of the machines or by the operation of the protocols. The propagation of transactions across the network is one of them. After all, what is the point of increasing the size of blocks or the flow of transactions if they cannot be distributed correctly across the network? This can have side effects and over time make the network more centralized.

The use of a DAG does not replace the miner's network, as Proof of Work provides features directly related to its precise operation, such as immutability.

Advantages and disadvantages of using a DAG


Although some cryptocurrency networks use string systems, such as Bitcoin, it is also possible to organize transactions in a DAG: this is what the IOTA or Nano projects do, for example. But these are not the only changes in the blockchain architecture: some protocols use consensus protocols for Proof of Stake or Proof of Authority to validate transactions before adding them to the DAG. If the network does not rely on Proof of Work to validate transactions, it does not need blocks and thus no blockchain. Thus, the use of DAGs is interesting because it offers many advantages for their management.

The use of a DAG offers advantages in terms of the speed of execution of transactions. However, as explained above, it is not the DAGs that make the most use of it and it is other parameters that increase its ease of use, such as fees that are close to zero. This may explain the confusion in the community about the essence of DAGs, which do not represent 'blockchains 3.0' and are not necessarily based on a validation of transactions through Proof of Work.

The block DAGs


Bitcoin has provided an architecture that allows the development of a completely open network on which the exchange of value is possible through the application of various mechanisms that make the history of transactions immutable. However, this architecture loses its security properties when the block size is increased, or the flow of blocks is heavier to some extent. Therefore, many projects are trying to improve Bitcoin, either by modifying the architecture or by working on overlayers such as the Lightning Network. This is the case with blockDAGs, which are represented by projects like SPECTRE.

The idea is no longer to group blocks of transactions into chains, the longest of which would be selected by consensus, but into DAGs. Each block would be organized in a historical manner. That is, each block would always refer to its predecessors in the hashes of its headers. The main difficulty would be that miners would not necessarily have the same version of the DAG at the same time, since new blocks are added much more frequently. This could lead to conflicting transactions as they are validated in parallel without the miners being aware of it.

This structural change in system design can make the system faster, as the confirmation of transactions can be achieved in seconds. Also, the flow of these transactions is not limited to a specific number of blocks per minute, and is limited only by network bandwidth, thus reducing transaction costs.