Block-Less Blockchains: Understanding Directed Acyclic Graphs or DAGs

Written by derekkklim | Published 2021/06/19
Tech Story Tags: blockchain | cryptocurrency | directed-acyclic-graph | blockchain-3.0 | future-of-blockchain | distributed-ledger-technology | distributed-systems | hackernoon-top-story

TLDR The Directed Acyclic Graph (DAG) is a form of a Distributed System Technology (DLT) and is a subset under the DLT umbrella. DAGs and blockchains are not the same thing at all; although they store and record their transactions on distributed ledgers, they do so in conspicuously different ways. The race is on for the development of a DAG, and there are many who believe that it will play a big part in that. Some consider it as a rival technology to blockchain, whilst many others see it as an enabler.via the TL;DR App

In the world of blockchain and cryptocurrencies, everything moves really fast.
You only need to stop immersing yourself in this world for a week for you to be utterly left behind. This can be intimidating for many people, and constitutes a huge barrier of entry into the space for most. For others though, this is what makes the world of blockchain technology and cryptocurrencies so exciting — it is constantly improving, growing, and evolving.
You adapt or you die.
This motto of sorts applies to most blockchain projects too; in such a fast-paced and ultra-dynamic environment, they have to constantly innovate and level-up, or risk falling into obsoleteness or oblivion. That is essentially why the technology in this space moves and advances so exceptionally rapidly — you adapt or you die.
Blockchain 3.0
In 2009 when Bitcoin was launched, blockchain technology was merely understood as a data structure underpinning Bitcoin technology. In fact, Satoshi Nakamoto didn’t even explicitly use the term ‘blockchain’ to reference this technology; he called it a ‘chain of blocks’.
In 2015, however, the concept of Blockchain as a standalone technology started to gain traction. People were realising the immense potential said technology had, and blockchain started to come to the fore together with Bitcoin. This rise into popularity (thanks in huge part to Bitcoin) was the first revolution in blockchain technology, and has come to be categorised as Blockchain 1.0.
Vitalik Buterin. Source: www.techcrunch.com
Between late 2015–2017, and before it became the powerhouse that it is today, an experimental platform called Ethereum, started to make waves around the world with its blockchain platform for applications and smart contracts. With an enigmatic Vitalic Buterin at the helm, Ethereum came to epitomize Blockchain 2.0.
Now, the race is on for Blockchain 3.0, and there are many who believe that the Directed Acyclic Graph (DAG) data structure will play a big part in that.
What is a Directed Acyclic Graph (DAG)?
A DAG is a form of a Distributed System Technology (DLT), and is a subset under the DLT umbrella — just like blockchain technology is too.
Now, here’s a very vital caveat: DAGs and blockchains are not the same thing at all; although they both store and record their transactions on distributed ledgers, they do so in conspicuously different ways. Some consider DAGs as a rival technology to blockchain, whilst many others see it as an enabler.
In order to understand what DAGs are, let us use blockchains as a reference point. If we were to examine a blockchain’s data structure, we will find that it resembles an append-only linked list. Every entry (a block of transactions) on a blockchain network is appended on top of the previous one to which it holds a reference (previous block hash). The result is a linear sequence of digital events that we call a chain. If you are unsure what a blockchain is, please refer to this series of articles to get up to speed, starting from part 1!
On the other hand, a DAG’s data structure resembles a flow chart, where all points are spread out, but heading in one singular direction. You can think of it as a tree, where transactions branch out from one another in a potentially endless list.
Data Structure of a DAG
Here are two diagrams for you to better understand the structural differences between blockchains and DAGs.
In a blockchain, entries are sequentially added on top of each other, forming a list or chain in one direction. In the diagram, a natural fork has happened, where a second similarly sequential and one-directional chain is created beside the main one:
A blockchain’s structure
In contrast, a DAG is made up of vertices (the circles) and edges (the arrows connecting them). The graph only flows in one direction (hence Directed), and the vertices will never loop back on themselves (hence acyclic). One key difference that sets apart DAGs from blockchains is this: the entries (vertices) can be added in simultaneously, not singly as is the case for blockchains.
A DAG’s structure
DAGs are generally used by Mathematicians and Scientists to observe the relationship between multiple variables, and to better understand the influence said variables have on each other. They can also be used in scheduling and navigation tools.
At this point if you are very confused, don’t worry — the characteristics and functions of DAGs should become much clearer to you in the next segment!
How do DAGs relate to blockchains or cryptocurrencies?
To understand DAGs’ role in the blockchain and cryptocurrency space, we first have to appraise 2 key limitations of permissionless blockchain technology (the technology that undergirds most popular cryptocurrency and blockchain projects, including Bitcoin and Ethereum):
  1. Scalability Issues
  2. Low Transaction Throughput
Scalability Issues
This particular limitation is down to the decentralized structure of permissionless blockchain. Instead of a centralized hub that ensures security and functionality, it is down to each and every node in such a network to enable overall security by storing a complete copy of the network state and full digital ledger (so that they are able to validate transactions).
From this, one thing becomes apparent: as the size of the blockchain grows, storage and network bandwidth requirements will increase too. There may eventually come a time when block processing will require so many resources that there will be too few — or even, no — nodes capable of handling this load.
In other words, many traditional blockchain networks are not very scalable at all.
Low Transaction Throughput
Additionally, in most permissionless blockchain networks, consensus mechanisms are required to align incentives within the network due to the fact that anyone and everyone (an unlimited number of trustless parties) can and will join such networks. However, these mechanisms present a huge downside: each and every full network node must process each and every transaction as it comes in.
This means that the number of transactions that a blockchain network is capable of processing becomes pegged to the capacity of one network node. This is because in such blockchain networks, validation work is not split efficiently and evenly amongst the nodes at all; instead, they are repeated across all the nodes (since they must all process all transactions), leading to a lot of extra work being done.
Therefore, most permissionless blockchain networks can only process a very limited number of transactions per second, and concomitantly — the creation of blocks will take a significant amount of time (since blocks of transactions are added to the blockchain singly and sequentially).
This low transaction throughput unfortunately means that many cryptocurrencies that run on such networks (including Bitcoin) will never be a viable alternative to fiat.
Can you imagine using a cryptocurrency like Bitcoin to buy a coffee, then having to wait 1 whole hour (6 x 10 minutes, since it takes 10 minutes to create a block, and ostensible transaction finality in Bitcoin = 6 confirmations) for the payment to go through and be confirmed? It just wouldn’t be practical!
DAG as a solution to permissionless blockchains’ limitations
This is where DAGs come in.
Scalability Issues
Because DAGs do not require its nodes to store the full digital ledger and/or a complete copy of the network state, this will save a lot of bandwidth and storage space on the network, allowing for it to potentially scale exponentially.
To help you understand this better, imagine that Derek is the creator of a network called DEREK, and has just formed the genesis (first) block with 10 DEREK coins. Alice and Bob, the other users on this network, both have 0 coins.
In a blockchain network, all 3 nodes (Derek, Alice and Bob) will each hold a full copy of everyone’s ledgers. This is how it’ll look like.
In a network that uses a DAG however, this is what it will look like instead.
Now, Derek is feeling generous, so he sends 5 DEREK coins to Alice, and another 5 DEREK coins to Bob.
In a blockchain, this is what it will look like after the transactions have been validated, added into a block and appended onto the network’s main chain.
As you can see, all 3 nodes will hold the full ledger of everyone’s balance after transactions have been made. As the number of participating nodes increase, so will the number of transactions on the network.
This becomes quite an infeasible practice if the network wants to scale substantially.
In a DAG, this is what it will look like.
As you can tell, a lot of bandwidth and storage space is saved in the DAG network, since each participating node is only holding a record or ledger of their own balance.
Put simply, if a blockchain network wants to scale, it will face a lot of bandwidth and storage issues. This problem is solved by a DAG network, since nodes are not required to hold the full ledger of the entire network.
Low Transaction Throughput
Compared to blockchains, transaction validation in DAGs is also a much simpler process as it is only done when a node wants to make a transaction to another node.
To make this clearer to you, let’s use the same example from above.
Now that Alice and Bob have 5 DEREK coins each, they are feeling really rich, and want to utilise their newfound wealth. Alice purchases a coffee from James, and sends him 2 DEREK coins in return. Bob bought a book from Jenny, and sent her 4 DEREK coins.
In the Alice -> James transaction, Alice’s node will be the only one doing the validation and verification (of the transaction), to see if it is true or not. In order to validate and verify the transaction to James, Alice’s node will check the previous transaction that was made to her from Derek. If Alice’s node can confirm that the private and public key pair from the Derek -> Alice transaction is a match, and that Derek did indeed send over 5 DEREK coins to her previously, it can then verify the transaction of 2 DEREK coins Alice just made to James, since Alice will have enough to spend from.
A visual representation of the transactions between Derek, Alice and James
This is also what happens for the Bob -> Jenny transaction. Bob’s node will be the only one doing the verification and validation process of checking back to the previous transaction from Derek, to make sure that the private and public key pairs are a match, and that Derek did send over 5 DEREK coins. If both are true, then Bob can confirm that he really does have these 5 DEREK coins to spend from. Bob’s transaction of 4 DEREK coins to Jenny will go through.
In these scenarios, both James and Jenny’s nodes will not need to do any verification or validation work. They will only need to do so if and when they want to make their own transactions to others.
In other words, James and Jenny will verify their respective Alice -> James and Bob -> Jenny transactions only when they want to send these coins to others.
For example, let’s say that after receiving the coins from Alice, James now wants to send 1 DEREK coin to Abel. James’s node will be the one to check and verify the previous Alice -> James transaction to ensure that it was true and valid. If it was, and if James really does have the 2 DEREK coins to spend from, the transaction to Abel will be verified and validated.
Here, as James is now the one transacting out to someone else (he is no longer a recipient node), it is James’s node that will do the verification and validation work . Abel’s node will do little-to-no work at all for this transaction.
In short, the recipient (of a transaction) node in a DAG will always need to do little-to-no computational work. This speeds up the transaction verification process immensely, and stands in stark contrast to permissionless blockchains’ verification processes.
Moreover, in blockchains, you will have to perform verifications all the way to the genesis block in order to successfully create a transaction, whilst in DAGs — you only have to verify 2–3 prior transactions whenever you want to generate a transaction.
Therefore, as compared to blockchains’ low transaction throughput, DAGs will enable many transactions (even to the tens of thousands) per second on the network.
Additional Benefits
On top of solving these fundamental issues of permissionless blockchain networks, DAGs also bring about many other benefits too.
No need for Miners/Validators
Recall how a transaction in a DAG looks like.
A visual representation of the transactions between Derek, Alice and James
Since blocks are not used in a DAG, there will be no need for miners or validators to verify transactions in the mempool, group them together into a block, and add them to the network. Individual transactions are added on their own to the network by the transactors themselves (for some DAG networks, they can only do so after solving a mini preimage hash puzzle as a Proof-of-Work, on top of verifying 2–3 previous transactions, so as to prevent people from spamming the network).
In short, there will no longer be a need for third-party miners or validators to verify transactions in a DAG network.
Instead, transactions are done point-to-point (Derek -> Alice, Alice -> James), where the transacting nodes will do the verification themselves (Alice).
This will result in two major improvements over the current permissionless blockchain models:
  1. More environmentally-friendly
  2. More decentralized
For the first: right now, in order to verify transactions on permissionless blockchain networks like the Bitcoin network, miners are expending huge amounts of energy via their ASIC machines to solve the preimage hash puzzle that constitutes the Proof-of-Work problem, or nonce.
These high levels of energy consumption by the ASICs will have dire consequences for the environment — something that DAG networks prevent because of their workaround around miners.
For the second: the aforementioned high level of energy consumption by miners will not only negatively impact the environment, but also the concept of decentralization as a whole. Because you must have the ability to expend so much energy in order to validate transactions on a permissionless blockchain network like Bitcoin’s, only those who have adequate resources can do so.
This means that the capacity to verify transactions on the Bitcoin network will ultimately converge around a more centralized pool of miners (mining pools), due to the fact that not anyone and everyone will be able to afford such expensive and electricity-consuming equipment.
This does not bode well for decentralization — the principle on which Bitcoin (and many other permissionless blockchain networks) was built upon.
DAGs — because they do not require miners/validators — circumvents this issue entirely by design.
No Wasted Effort
In a blockchain, when miners solve the nonce and propagate their blocks to the network at the same time, a natural fork will occur. The other miners in the network will then choose which chain to mine on, and the longer one will eventually become the main chain.
A Fork in a Blockchain
In such a case, the chain of blocks that is not chosen as the main chain becomes totally useless as an orphan chain, with no one building on it. Here, a lot of effort is wasted because these orphan chains will comprise blocks that have been properly validated and verified (miners have done real work on it) too.
Ethereum tries to counteract this problem vis-à-vis their GHOST protocol, where they do take into account orphaned chains (or uncle blocks), and partially reward miners for such chains. This, however, still does not solve the issue of wasted effort!
DAG-based systems, on the other hand, will face no such problem since they allow for simultaneous transactions (instead of blockchains’ sequential ones).
A DAG network
There will be no ‘competition’ of any sorts, where blocks or chains will get orphaned and rendered useless. Transactions will just be recorded onto the network once they have been verified (and in some instances as aforementioned, after a mini POW has been done).
Therefore, in DAG-based networks, there will usually be no waste of effort.
Downsides of DAG-based networks
Of course, nothing is perfect.
DAGs have their own cons too, especially since the use of DAGs in blockchains and cryptocurrencies have still not been tested extensively and at scale yet.
One main issue with DAGs (with regard to the blockchain and cryptocurrency space) right now would be that of Centralization.
Although DAGs should be able to foster more decentralization in theory (through democratizing the validating process to transacting users themselves, as aforementioned), the reality right now looks a little different.
Although reducing the volume of transactions on DAGs is a good thing, this also makes it more vulnerable to attacks since it won’t cost a lot of resources to do so. The fact that this space is relatively new also adds to the problem, as there will probably be many under-researched vectors of attack that malicious actors can use to compromise DAG-based networks.
To protect against such potential attacks, most DAG projects in the blockchain and cryptocurrency space have so far included central entities like coordinators, master validators and/or master ‘witness’ nodes.
For example, let’s take a quick look at one of the more well-known cryptocurrency projects currently using a DAG-based model, IOTA. In order to protect itself from 51% attacks (or in this case, a 34% or 1/3 attack will do), the IOTA network has a temporary centralized element — the Coordinator node (“Coo”) to direct the path of their DAG tree.
Therefore, in order for DAGs to truly be incorporated into a space that prides itself on its ability to move away from a centralization of power, a lot more research needs to be done on this front.
Closing Thoughts on DAGs
Although DAG-based networks do hold a lot of potential in the blockchain and cryptocurrency space, a lot more real-world testing and research still needs to be done before we can even begin to consider if it can truly come to epitomize Blockchain 3.0 or anything similar.
If they can fully deliver on all their promises, however, this has the potential to radically change not just the blockchain and/or cryptocurrency space, but also other IT-related fields like the Internet of Things (IoT) due to their ability to support high transaction throughputs with minimal effort and/or fees.
Only time, and very capable men and women, will tell.




Written by derekkklim | Full-time Blockchain and Cryptocurrency nerd. Certified Blockchain Practitioner; Certified Bitcoin Professional
Published by HackerNoon on 2021/06/19