Data Structures in Distributed Ledgers: Blockchain and Directed Acyclic Graph
All blockchains are distributed ledgers, but not all distributed ledgers are blockchains. While we tend to think of blockchain as the technology for building distributed applications (and we are almost always right), it is not the only one. Moreover, with the deficiencies of blockchain becoming increasingly prominent, other technologies come into focus.
In 2018, blockchain has become a true buzzword that we seem to hear everywhere. Almost every sector of industry and economy is trying blockchain for size finding benefits that are specific for their applications. We see blockchain-based energy companies, financial platforms, government services, health institutions — and new use cases appear with each passing month.
However, what they really need is a distributed application that is not necessarily based on blockchain. If we look really deep, we will see that Turtle on which the world of distributed apps rests — the distributed ledger. That’s the core technology, and blockchain is just one of its implementations.
“Distributed ledger” is the blanket term for the method of storing and processing data in a network consisting of multiple nodes. The main concept of such networks is that, on the one hand, there is no central entity controlling the data processing and, on the other hand, there is trust established in an inherently trustless environment. There are several ways of organizing distributed ledgers, and blockchain is only one of them.
The topic of other types of Distributed Ledger Technologies, DLT for short, has been rather hot recently, because the drawbacks of blockchain have begun to outweigh its benefits. The major problems of blockchain are its poor scalability which makes it unable to process large volumes of transactions, and its high transaction fees. Today, both businesses and developers are researching other ways of implementing a distributed ledger that would be more efficient than blockchain.
Besides blockchain, a distributed ledger can exist in the form of a directed acyclic graph, or DAG. DAGs have been around for centuries (check, for example, the Graph Theory dating back to 1736), but since recently their properties have become the subject of intense research for the possibility of forming distributed apps for various business purposes. And it seems that there is a huge potential there.
Let’s see how blockchain is different from DAG and, particularly, whether DAG is going to become a competitor to blockchain.
Blockchain vs. DAG — the fundamental differencesThe main difference between blockchain and DAG is in their basic structure and the way new transactions are added and approved.
General structureBlockchain is literally a chain of blocks, a linear structure starting with the so-called “genesis block” and continuing with every new block added to the chain. Only one chain of blocks is formed with any shorter side chains or branches discarded. Each block contains a number of transactions and is referenced to the block before it through the hash. This way, all blocks in the chain can be traced back to the first one, and no modification to the data in the block is possible.
At the same time, as we mentioned, blockchain is not the only type of distributed ledger. and since recently we have been witnessing a growing interest to another type — the DAG. It is built according to a different principle and seems to solve the blockchain issues.
Unlike blockchain, DAG has no linear structure. Instead, it resembles a tree with multiple branches. The data in a DAG is organized according to the two basic rules — all transaction flows should be in the same direction, and no element should reference to itself, that is, to be its own parent.
Consensus algorithmsOne of the essential properties of a blockchain is the way it reaches consensus. In a decentralized structure, there is no single central entity making decisions about processing transactions. Such decisions are made by the agreement of all nodes in the network for which there are special mechanisms called consensus algorithms. The choice of a particular consensus algorithm has a considerable effect on the network speed, throughput, scalability, and transaction cost.
The most popular of the currently existing blockchains — Bitcoin and Ethereum — add new blocks with the so-called Proof-of-Work algorithm which is artificially slow, insanely power-consuming and preventing effective scalability of the network. Only one block can be added at a time which slows the network even further. Other algorithms, such as Proof-of-Stake, have manifested higher efficiency, however, certain concerns remain.
In their turn, DAGs need no miners or other approving entities that are responsible for adding blocks in blockchains. Instead, any user performing a transaction is also required to become an approver of other transactions. Thus, the network needs no extra costs for transaction processing and is less time-consuming.
Moreover, DAG faces less risk of centralization that some blockchain experience. Some consensus algorithms used in blockchain provide the possibility of the consensus power concentration in the hands of a single entity or group. This way, the group takes over the management of the entire network. DAG prevents such scenarios due to its asynchronous transaction validation mechanism where users are required to approve two other transactions before their own transaction is approved.
ScalabilitySince DAGs have no “blocks” in the blockchain sense, they are much better scalable. The throughput of a blockchain network can be slowed significantly when a large number of transactions appear at the same time. Each block has a fixed size and is referenced to the one before it. This creates a serious bottleneck allowing to process only a limited number of transactions per unit of time (7 transactions per second in Bitcoin, 20 — in Ethereum).
DAG has no limit on the number of transactions that it can process per second. Since DAG does not group transactions but, rather, arranges them in a linear structure, its throughput can be much higher. The only thing that can slow down the transaction processing is the bandwidth between two peers.
Transaction feesTransaction fees are a great pain of the Bitcoin blockchain users. The fees are determined by Bitcoin miners who approve transactions and include them into blocks to be added to the chain. As the number of transaction grows, the transaction fees grow, too, making transactions extremely expensive and nano-transactions — plainly unpractical.
DAG, in its turn, requires no mining, hence, no rewards for the miners. Each user is also an approver, with their reward being the approval of their own transactions. Besides, with no mining, DAG is not as power-consuming as blockchain. Thus, in DAG there are no transaction fees which makes it suitable for processing transactions of any size, including nano-transactions.
So, should blockchain start worrying?It may seem that a perfect replacement for blockchain has been found. Unfortunately, with all its advantages, DAG still cannot be considered a reliable structure for building distributed applications. It has its issues, too — for example, its consensus algorithm still leaves much to be desired. Theoretically, with one user approving two other transactions, any entity that eventually generates 1/3 of all transactions in a DAG network can gain control.
However, the potential of DAG is being recognized. Vitalik Buterin praised the concept of directed acyclic graphs admitting that they can reduce the network latency: “…they do have some value, particularly in reducing latency, so basically you can design systems where the latency goes down from something like Ethereum’s 14 seconds possibly to 1 second…”
If you are waiting for an answer to the question “what is better — blockchain or DAG?”, the truth is, as usual, somewhere in-between. We should consider the strong points of both platforms and leverage them to the maximum in building distributed applications.
While there are already hundreds of blockchain projects in virtually all industry sectors, DAG is not as popular yet. There are, maybe, a couple of projects using DAG that are widely known, however, their success is a clear indicator that the technology is worth exploring.
The best-known project using DAG is IOTA, which includes both a crypto ecosystem and a cryptocurrency. IOTA was designed as a platform for creating IoT infrastructures. DAG structure makes an effective environment for creating networks of multiple connected devices which are a step towards the machine economy.
While IOTA cannot be called a purely DAG-based network, as it also uses the Proof-of-Work concept, it is greatly different from the blockchain as we knew it.
Another DAG project that is often mentioned is Byteball, a cryptocurrency platform with a native smart contract support. Byteball is fully DAG-based — no blocks, no miners, transactions are verified by other users. Byteball does have a transaction fee, though, but it is calculated in proportion to the resources used to verify the transaction.
As to the future of distributed applications, we are quite safe to say that both structures will find their share of the market. While DAG is still far from the general adoption but has already manifested its advantages, blockchain is evolving actively with new algorithms and features being tested constantly.
If you are interested in blockchain and crypto technology, sign up to my blog where we discuss the hottest topics from the crypto sector and the latest developments in that area. I will be happy to share what I know with you!
If you need some more detailed analysis for a particular project, contact us to schedule a consultation with our blockchain experts.
Originally published on blog.goodaudience.com