See More

How Directed Acyclic Graphs (DAGs) Solve the Problem of Forking

7 mins
Updated by Artyom Gladkov
Join our Trading Community on Telegram

The term “blockchain” is so widespread that it’s easy to assume it’s synonymous with distributed ledger technology (DLT). But blockchain is only one type of DLT. Another form of DLT, a Directed Acyclic Graph, or “DAG” for short, answers an important limitation of blockchain: network forks. So what is a DAG, how does it work, and how do DAGs solve blockchain forking issues? Let’s dive in.

What is a Directed Acyclic Graph (DAG)?

what is a DAG

Let’s break it down. The clue is in the name. “Graph” — well, you already know what that is. Picture a flow chart or a mind map where one point (or vertex in mathematics, where the DAG concept originated) is connected to many other vertices via arrows or edges

“Acyclic” means it’s not cyclical: it doesn’t go in loops and does not repeat itself. Instead, it’s “Directed”; it goes in one specific direction and not in cycles.

Each DAG-based DLT modifies the underlying DAG structure to meet its own unique needs and offerings. But instead of a linear chain of blocks, a DAG is a graph where transactions can be developed simultaneously. 

Instead of waiting for the previous transaction to be completed before validating a new transaction — as with a blockchain — transactions on a Directed Acyclic Graph can be processed much faster and in parallel.

Although DAGs were first developed in mathematics and computer science, they also play an important role in distributed ledger technology. Or more specifically, it’s become an alternative to blockchain in the DLT space, and many people believe it’s the solution to specific drawbacks of blockchain that all stem from forking.

Putting the “block” into blockchain 

block into blockchain

A blockchain is a linear series of data blocks that follow each other. Each block contains a unique and immutable identifier of the previous block. Through this identifier, blocks are cryptographically protected data records, protected by the proceeding data records. For example, older blocks can’t be manipulated or deleted and are immutable. 

In a blockchain, everything starts with a genesis block; the first block to come into being when a new chain is launched. Whenever you send a transaction to the network — “I want to pay 50 of my crypto coins to Bob” —  block producers put that transaction in a block. So a block is essentially a list of transactions.

Forking in blockchain 

A ‘fork’ is when two blocks are issued simultaneously. This can happen because of a network delay: someone may create a block before receiving the latest block. Or it can be more malevolent. Someone might try to make a new chain from the genesis in an attempt to rewrite the entire history of a chain. This would erase everyone’s token holdings by reversing all transactions.

Every type of blockchain, whether proof-of-stake, proof-of-work, or Directed Acyclic Graph, includes a rule about what to do when confronted with a fork. In a blockchain, one of these two blocks must be “orphaned” — gotten rid of and ignored. Not only are the orphaned block’s transactions not included in the ledger, but it also doesn’t contribute to security. If this happens too frequently, the blockchain becomes unusable and insecure.     

Typically, the rule about fork choice is a variant of the “longest chain rule,” where the longest chain is held to be the correct one. This way, each block effectively votes for the previous blocks. So once a transaction is really deep in the blockchain, it becomes highly unlikely that a new, longer chain can be created without that transaction. Thus, the more block producers, the more secure the transaction is considered. This is because of the difficulty of manipulating a transaction that so many participants confirmed. 

There are three main problems related to forking in blockchains.  

  1. Slow block creation: Creating too many blocks at the same time leads to forking, which compromises the security of the network. So, each block must propagate fully before the next block is created. And that causes network delays and bottlenecks.
  1. Fees: Because block production rates have to be slow to preserve security, the number of block producers must be limited. So the block producers have a monopoly, and users must pay fees to incentivize the block producers to include their transactions. This can be costly and sets the stage for potential corruption or manipulation of blocks.
  1. Inefficiency: In a blockchain, all the blocks are sequential. This means that block processing must be done consecutively and in batches. However, in the day of multiple processors, this is much less efficient in terms of hardware usage than continuous parallel processing.  

DAG-based DLTs like IOTA (which calls its DAG architecture ‘the Tangle’) overcome these drawbacks. 

Directed Acyclic Graphs (DAGs) to the rescue

DAGs alleviate the problem of forking in blockchain, opening up a range of competitive benefits. For example, suppose two blocks are issued at once. What if instead of orphaning one of the blocks, leading to degraded security, the next block includes both blocks in its history? Therefore, blocks being created simultaneously do not degrade security since neither will be orphaned. This would solve the problems described above.  

In a DAG, when you send your block to the network of nodes, it must first validate at least two other blocks. So the user is responsible for the block validation and not a third-party block producer. The network confirms the block and ensures it is added to everyone’s ledger. 

This means:

  1. Faster block creation: Because blocks can be produced at the same time, the block creation rate can increase without degrading security. Moreover, bottlenecks are avoided by the ability of blocks to be processed in parallel rather than one after the other, like in a blockchain. This leads to faster validation and faster transaction finality times.
  1. Lower or no fees: Transactions on a DAG are also less expensive because no block producers need to be paid. This enables DAG-based protocols to charge little to no fees.
  2. More efficiency: Non-sequential blocks can be produced in parallel; this requires fewer hardware resources.

In short: parallelization, the absence of intermediaries, the capability to work in an asynchronous setting, and the leaderless approach offer a highly performant consensus and ledger solution.

Different DAGs

The IOTA Foundation is one of the DAG pioneers in the DLT space. It launched the Tangle in 2017 and has been refining it through its Tangle Improvement Proposal (TIP) system. TIPs are improvement proposals anyone can submit to improve the IOTA technology stack. 

While the Tangle and blockchains have the same function of maintaining their ledger state, the Tangle overcomes the difficulties blockchains face. The Tangle naturally succeeds the blockchain as its next evolutionary step, offering features to establish more efficient and scalable distributed ledger solutions. But don’t just take our word for it; to see one in action, the Tangle Explorer offers a visualization of activity on IOTA’s mainnet DAG. 

Other examples of DLTs that use DAG include Aptos, Avalanche, Constellation, COTIHedera-Hashgraph, Nano, and Obyte. The use of DAGs in DLT consensus is the basis of many state-of-the-art consensus algorithms like Tendermint

The future of distributed ledger technology is DAGs

We’ve really just touched the tip of the iceberg. There is much more to explore about Directed Acyclic Graphs (DAGs) and how this blockchain forking solution can be used effectively in distributed ledger technology. By offering faster validation, faster transaction finality times, and much cheaper transactions, DAGs go a long way toward solving scalability issues and clunkiness on blockchains.

Frequently asked questions

What do you mean by DAG?

How is a DAG-based DLT different from blockchain?

Which cryptocurrencies use DAG?

How do DAG-based cryptocurrencies work?

About the author

William

William Sanders is the Director of Research at the IOTA Foundation, which maintains the IOTA protocol. He leads a team of researchers to find cutting-edge solutions to pressing problems in the DLT space. Previously, he was a mathematician specializing in Commutative Algebra and Category Theory at the Norwegian University of Science and Technology.

Top crypto projects in the US | July 2024
Harambe AI Harambe AI Explore
Uphold Uphold Explore
Exodus Exodus Explore
Coinbase Coinbase Explore
Chain GPT Chain GPT Explore
Top crypto projects in the US | July 2024
Harambe AI Harambe AI Explore
Uphold Uphold Explore
Exodus Exodus Explore
Coinbase Coinbase Explore
Chain GPT Chain GPT Explore
Top crypto projects in the US | July 2024

Trusted

Disclaimer

In line with the Trust Project guidelines, the educational content on this website is offered in good faith and for general information purposes only. BeInCrypto prioritizes providing high-quality information, taking the time to research and create informative content for readers. While partners may reward the company with commissions for placements in articles, these commissions do not influence the unbiased, honest, and helpful content creation process. Any action taken by the reader based on this information is strictly at their own risk. Please note that our Terms and Conditions, Privacy Policy, and Disclaimers have been updated.

william_sanders.png
William Sanders , Director of Research at IOTA Foundation
William Sanders is the Director of Research at the IOTA Foundation, which maintains the IOTA protocol. He leads a team of researchers to find cutting-edge solutions to pressing problems in the DLT space. Previously, he was a mathematician specializing in Commutative Algebra and Category Theory at the Norwegian University of Science and Technology.
READ FULL BIO
Sponsored
Sponsored