An Introduction to DAGs and How They Differ From Blockchains

Recently, the term DAG has been mistakenly included under the banner of ‘blockchain technology’. What many fail to realise is that a DAG is in fact different. In this introduction, we’ll break down what a Directed Acyclic Graph actually is, and highlight one of the key differences they have from blockchains like Bitcoin or Ethereum.

Let’s start with a non-directed, cyclic graph:

This is a graph (or network of connected nodes) where information can be passed from one node (a circle) to another along different edges (straight lines). There are a variety of different ways information can leave a node, pass through other nodes and return to the original node. When this occurs without any one node encountered more than once, the graph can be defined as cyclic.

The original graph, and the derivative sections pictured in blue and red, are all cyclic graphs.

We’re interested in acyclic graphs though. Acyclic graphs are graphs that don’t have any cycles.

Replace these nodes with blocks — looking familiar?

Replace these nodes with blocks — looking familiar?

There is no path for information to return to the nodes on the left of each diagram without doubling back and hitting a node that has already been encountered.

We now know what the Acyclic Graph section of a DAG is, but what about Directed?

If we give the edges a direction (so they function like a one-way street for information), and ensure that no nodes connect to any of the other nodes already in their series, our previously cyclic graph can now be made into a Directed Acyclic Graph:

But how does this compare to a standard blockchain?

Blockchains function much the same way as the two previous acyclic graphs — the logic behind them works when there is a single chain of blocks, with each new block including a reference to the previous. Branched chains can however be created when two miners produce a block at the same time, or a 51% attack occurs. To ensure the main chain remains viable, blockchains enforce an arbitrary period of time between blocks to give the network time to consolidate and verify which ‘branch’ of the chain is correct. This waiting period is known as a block time, and shorter or malicious branches are ‘orphaned’ (discontinued).

One of our previous articles provides an overview on block times and how they impact transaction confirmations. Read it here.

A discontinued ‘orphan-chain’ above the continuing main chain

DAGs on the other hand, allow for multiple chains of blocks to co-exist and interconnect — all while never forming an edge with a parent node. Nodes can exist in parallel, as long as information is directed in the same way.

A small section of an interconnected DAG

This opens up a whole new range of possible confirmation options that eliminate the need for block times, as well as reducing the amount of work wasted on abandoned ‘orphan-chains’. The end-result: an unprecedented potential for highly scalable and fast information flow on a completely decentralised network. DAGs may even be able to compete with existing centralised networks in the near future in terms of throughput and security.

While many argue that this isn’t as secure as the classic blockchain, teams of talented individuals and thought-leaders have been working around the clock on ways to turn this concept into a usable, secure and highly scalable solution.

If you have any questions about DAGs, or want to learn more about the future of decentralised networks, come have a chat on Telegram.