Since the launch of Bitcoin in 2009, cryptocurrency has been associated with the terms ‘blockchain’ or ‘distributed ledger technology’. Since then many cryptocurrencies have been born with most possessing a similar network composition. In all, the data structures present permit the use for a transfer of value or interaction with a decentralized application.
In a blockchain composition, a new block is added to a chain of existing blocks on a periodic basis. Each block within the chain is connected to the previous block by a hash (which is nothing more than a cryptographic link). The recent transactions by users of the chain are contained within said blocks.
However, this process is not instantaneous and there is typically a waiting period between a transaction broadcast and its inclusion within a block by confirmation. This delay can last anywhere from mere seconds to hours. To most, this is an acceptable trade-off, however to some, they believe that scalability issues inherent within blockchain technology will prevent mass adoption.
And there are those who believe that the future for cryptographic payment systems lies with a technology outside the realm of the blockchain - but it lies with the use of directed acyclic graph technology.
What is a Directed Acyclic Graph (DAG)?
A DAG simply is a different type of data structure compared to blockchain - merely a database that connects different items of information together in an organized fashion. Let’s try and explain this visually:
A DAG is comprised of vertices, the circles in the diagram, and the edges, which are the lines connecting the vertices. They are said to be ‘directed’ in that all of the edges move in one direction (note the arrows in the photo). They are acyclic in that the vertices do not loop backward on themselves at any point in time - if you start at one point and follow the direction of the graph you will never return to that same beginning point.
How Does a DAG Operate?
To start, each vertex in the structure (the circles in the above diagram) represents a transaction. The DAG system is devoid of ‘blocks’ and ‘mining’ is not needed or used to extend the database. Rather, in a DAG structure, each individual transaction is built on top of another different transaction. When a node submits a new transaction there is a small ‘proof of work’ operation necessary to ensure the network is not being spammed plus to act to validate previous transactions.
For a new transaction to be added to the structure it must be built on top of another differing transaction. Let’s say for illustration Betty creates a new transaction. For Betty’s transaction to be acknowledged, her transaction must reference previous transactions (this is similar as to how a Bitcoin block references the previous block, however here, there are multiple transactions that are referenced).
In certain DAG systems, an algorithm is present to make the selection of which transactions (called ‘tips’) the new transaction is to be built upon. In this system, the algorithm is more likely to choose the tips possessing more accumulated weight (where accumulated weight is the measure of how many confirmations the path to the tip has).
The transactions upon which Betty’s transaction will be built are unconfirmed. Once Betty’s transaction references them they are confirmed but Betty’s transaction remains unconfirmed until the point that someone else builds on her transaction.
By now, if you are following, you may be asking whether double-spending is a recurrent problem with DAGs. With blockchains, nodes easily detect any attempt at double-spending and any block containing conflicting transactions will be rejected. A mechanism is present within DAGs to prevent double-spending as well. In essence the process is similar to that used in blockchains but no miners are used or necessary. In a DAG system, when a node confirms older transactions the node assesses the whole path back to the first transaction to assure the sender possessed a sufficient balance for the transaction. Note, there could be multiple paths present in the structure, but only one path needs to be verified.
Could a situation exist where multiple branches are present in the DAG structure but they are unaware of each others existence? Under this scenario, would it not be possible for users to spend identical funds on the different branches? Well - yes, it is a possibility however DAG technology includes a selection algorithm which points favoritism in the direction of the tips exhibiting a heavier accumulated weight. The result is the development of a branch that is much stronger than the other branches present. Weaker branches in the structure are abandoned and the network structure continues growing by building on the heaviest branch.
Like blockchains, absolute finality does not exist within a DAG system (meaning there is no 100% assurance that a transaction will not be reversed). In theory, a Bitcoin block could be ‘undone’ and all the transactions therein reversed. But the more blocks that are added to the chain after the block containing your transaction, the more confidence you can have in the transaction’s completion.
In a DAG system there exists a similar notion of ‘confirmation confidence’. The aforementioned selection algorithm is run 100 times allowing a user to count how many times the transaction in question has been approved in the tips selected. The higher the approval percentage the more confidence a user can have that the subject transaction will remain settled.
While this appears to create a burdensome experience for the user, much of the burden is conducted in the background. Let’s return to Betty for illustration who now wants to send Archie 10 Pops Malt Shop Tokens. For Betty, this is just another routine and ordinary cryptocurrency transaction - she enters Archie’s address and the amount she wishes to transmit then hits send. But in the background, Betty’s wallet is most likely performing the following workflow:
- the wallet is selecting the heavier tips;
- the wallet will follow the path back through the previous transactions to ensure the tips possess a sufficient balance to spend; and
- once the wallet is satisfied, the subject transaction is added to the DAG thereby confirming the transactions it was built upon.
Although for Betty this appears to her as typical cryptocurrency workflow, however, the wallet list above is in actuality the proof of work each and every user runs when a transaction is created.
DAGs: Pros and Cons
Pros Concerning Directed Acyclic Graphs
- Speed: A DAG system is not restricted by block times. In this structure, there is no limit on the number of transactions submitted for so long as the new transactions confirm the older ones.
- No mining: A DAG does not utilize a proof of work consensus algorithm in the same fashion as with Bitcoin. As such, the carbon footprint in a DAG system is minimal.
- Near zero transaction fees: As there are no miners in a DAG system, system users are not required to pay any transactions fees to broadcast their transaction. Small fees will most likely be needed to pay certain special kinds of nodes.
- No scalability issues: As the constraint of block times is absent in a DAG system, this system is able to process more transactions per second as compared to a traditional blockchain system.
Cons Concerning Directed Acyclic Graphs
- Not fully decentralized: The ecosystems currently relying on the use of DAG technology all possess some degree of centralization. For some of these protocols the centralization issue may be a short-term solution to bootstrap the network. However, it is only for the future to tell if DAG technology protocols can exist in the absence of third party intervention. If centralization persists, the protocols remain open to attack vectors that could topple the entire system.
- Not tested at scale: While DAGs have existed for several years they have yet to be tested with widespread use.
Directed Acyclic Graphs present an interesting approach technologically for use in the construction of a cryptocurrency network as demonstrated above. However, so far, use of the technology has been limited to only a few projects and these projects have yet to fully evolve. Accordingly, it can not be said at this juncture that DAGs represent a better alternative to blockchain technology.
Nonetheless, if this technology evolves and proves to meet its potential, DAG technology could be utilized to construct massively scalable future projects. This technology would prove highly beneficial for deployment in use case areas that require high throughput and no fees (i.e. micropayments).
AUTHOR'S NOTE: This article was originally published on Leo Finance and several other tribes on the Hive blockchain.