What Is a Directed Acyclic Graph (DAG)?

IntermediateJan 31, 2023
Directed Acyclic Graph (DAG) offers a more efficient way to manage network transactions while overcoming many blockchain drawbacks.
What Is a Directed Acyclic Graph (DAG)?

Directed Acyclic Graphs (DAGs) are the new hot topic in the crypto and blockchain industry. It aims to solve decentralization differently by offering free and fast transactions.

Blockchain technology is now a decade old. Its inception started the decentralized revolution, giving birth to many other remarkable distributed ledger technologies (DLTs). These DLTs are unique as they try to solve blockchain drawbacks.

You can now find many exciting distributed ledger technologies, such as R3 Corda, Hashgraph, and Iota Tangle. Of these three popular DLTs, Iota and Hashgraph use Directed Acyclic Graphs (DAGs).

What is DAG in Computer Science?

In computer science, DAG is a graph with vertices and edges. The graph is directed, and each node is connected to the other. It is a handy data structure that enables computer scientists and mathematicians to model connectivity, probability, and causality.

Another important aspect is its acyclic feature, meaning that the graph is not a complete circuit/cycle. This means you’ll not be able to visit the same node twice. DAG also inhibits topological ordering where the starting node value is lower than the ending node value.

What Is DAG in Cryptocurrency and Blockchain?

DAG is also useful in cryptocurrency or designing other distributed ledger technologies (DLTs). That’s because they are faster compared to the traditional blockchain approach.

In a blockchain, blocks are created and connected to store and retrieve information. However, DAG uses vertices and edges. This means vertices store crypto or blockchain transactions. As DAG is topological, the recorded vertices lie on each other.

DAG-powered crypto or DLTs can work with Proof-of-work (PoW) or without it. The possibility of making distributed ledger technology work without mining means a faster and more energy-efficient approach, especially compared to traditional blockchain solutions such as Ethereum.

Apart from that, DAG also brings data storage efficiency and is already seen as a substitute for blockchain for online payments and transactions.

Lastly, DAG node/vertices creation makes the transaction process instant. In short, DAGs bring better network stability and scalability.

How Does DAG Work?

DAG in cryptocurrency works by storing information in vertices (nodes). Here the node structure represents transaction information. As no “blocks” idea is at play, mining is not necessary to create, verify and extend the blockchain. With DAG, transactions are written instantly in vertices built on one another.

DAG-powered crypto uses proof-of-work (POW) or other consensus algorithms to validate transactions to ensure some form of consensus.

Let’s go through an example to get a better understanding.

John, a trader, made a new transaction by transferring DAG-powered crypto to another person, Sly. As a new transaction is born, the DAG should verify it by referencing it to a previous one. The referencing is done for multiple transactions to ensure solid proof of transaction,

Consensus algorithms in DAG-powered crypto or DLT rely on tips to determine which node gets to verify the transaction. So, a node can have a significant say in the transaction verification, and selection is made based on its accumulated weight (number of confirmations).

John’s transactions stay unconfirmed until referenced by John himself or someone else that builds on top of John’s transaction. Practically, only nodes with higher weight are likely to keep verifying transactions to ensure proper network growth.

How Does DAG Stop Double Spending?

Lastly, DAG nodes are capable of detecting double-spending. It verifies older transactions and looks for the sender’s sufficient balance, going even back to the sender’s first DAG transaction. If the sender doesn’t have sufficient balance, it rejects the transaction. DAG only needs to verify a single path, even when multiple paths exist. In contrast, blockchain double-spending protection is adequate but can cost way more (in terms of energy and time) than DAGs.

To visually see how DAG looks, see the picture below.

DAG’s algorithm always prefers a node with heavy accumulated weight to overcome the problem of multiple branches not being aware of each other. This way, newer transactions are mostly connected through the tip and will always reference older transactions for verification purposes. The selective approach also discards weaker paths and drops them as the network grows.

If we look into the blockchain, transactions are considered “spent” after six confirmations to ensure confidence in the system.

To summarize, DAG does the following:

  • Select nodes with heavy accumulated weight.
  • Follow the previous transaction’s path to ensure that the tips are not double-spending and have sufficient spending balance.
  • Add the transaction to the network once satisfied.

DAG DLT Use-Cases

Iota Tangle

Iota implements Tangle, a DAG consensus algorithm. It follows a simple rule of validating by connecting to two previous transactions. This approach is beneficial as it grows the network strong with each added transaction. Also, it doesn’t require any mining to reach a consensus.

To stop double-spending, it contains transactions that are not 1/3rd of the transaction. This way, no one can take control of the whole chain and double-spend.

However, IoTa Tangle is not truly decentralized as it uses a centralized node, “The Coordinator”. Nevertheless, it helps the whole network by overseeing the transactions and ensuring no conflict occurs.

Hedera Hashgraph

Hedera Hashgraph is a public enterprise Distributed Ledger Technology. It uses a different approach by using DAG instead of a blockchain. Just like Iota Tangle, it is also not genuinely decentralized. Instead, a global business leaders council, including Google, Boeing, and Deutsche Telekom, oversees it.

Under the hood, Hashgraph utilizes the Gossip protocol. In this protocol, nodes share information and reach a consensus to approve transactions. An audit trail is appended to the distributed ledger with each transaction added.

DAG Crypto Use-Cases

Obyte

Obyte is a popular crypto that uses a DAG-based ledger. It works without intermediaries to create a middle-man-free process of the transaction. However, it uses a validator system to protect the network from double-spending.

Nano

Nano is a zero-free decentralized platform that uses Directed Acyclic Graph known as the block lattice. The network is fast and has no fees associated with it. Its architecture is a mix of blockchain and DAG and hence provides decentralization out of the box.

DAG vs. Blockchain

DAG and Blockchain are fundamentally different approaches. However, both fall under distributed ledger technologies. To get a better understanding, let’s discuss their differences below.

Structure

Blockchain approach network structure consists of nodes connecting through a blockchain. This chronological order is unalterable. Moreover, transactions are bundled into blocks with validation stored in them. When new transactions occur, they are added to a block and attached to the previous block for validation purposes.

On the other hand, DAG follows a topological approach where each node represents a transaction. The chain of nodes acts as a way to reference older transactions and prevent double-spending. The tree structure can have multiple paths. However, new transactions only require one path tracing to get validated.

Consensus

Blockchain-based DLT relies heavily on Proof-of-Work. It needs participating nodes to do mining which is a computer-intensive and resource-hungry process. The miners who participate get awards for validating transactions.

DAG’s approach is to validate each transaction separately. It uses the previous transactions as validation knowledge. The validators and miners participate. Also, transactions are mostly free.

DAG Pros and Cons

In this section, we will have a closer look at DAG’s pros and cons.

DAG Pros

  • DAG is fast, considering it doesn’t require miners to add vertices. Moreover, DAG topological approach allows a quick way to check older transaction paths to stop double-spending.
  • DAGs don’t use mining, making them environmentally friendly.
  • Due to the absence of miners, DAG has minimal to zero associated fees for transaction verification.
  • DAGs are highly scalable and can process way more transactions per second than traditional blockchain networks.

DAG Cons

  • The idea behind DAG is to make it semi-decentralized and not genuinely decentralized. Most DAG protocols are of centralized nature.

Final Thoughts

Directed Acyclic Graph (DAG) is an excellent blockchain alternative. It solves key problems associated with blockchain, offering a fast yet effective way to offer distributed ledger technology. However, it is not entirely decentralized. It relies on a council or centralized node to oversee the transactions and conflicts and keep everything under the rules.

作者: Nitish
译者: binyu
文章审校: Ashley
* 投资有风险,入市须谨慎。本文不作为Gate.io提供的投资理财建议或其他任何类型的建议。
* 在未提及Gate.io的情况下,复制、传播或抄袭本文将违反《版权法》,Gate.io有权追究其法律责任。
即刻开始交易
注册并交易即可获得
$100
和价值
$5500
理财体验金奖励!
立即注册