Blockchain vs DAG — The future of decentralized infrastructure
Decentralization is one of the main selling points for the majority of the crypto/web3 community. Decentralization, in theory, is meant to help accomplish several concerns related to centralized infrastructure including security, no central point to attack. Resilience, if part of the network comes under attack or goes offline the rest of the network should be able to keep the system running. And lastly, ownership, the data the lives within a decentralized system must be attributed to an owner, allowing you, me and anyone to have better ownership of their data, assets and other thing. But how do we achieve decentralized systems? The most common structure is something many of us a probably familiar with, Blockchains. But there is a new fundamental structure called a DAG, or Directed Acyclic Graph, that is emerging as a new form of distributed ledger. Today we are going to cover the differences, pros & cons, and the mechanics of these systems and how they are powering the decentralized systems.
A blockchain is in simplest terms just what is in its name. A chain of blocks, with each block a ledger of transactions. Know how when you login to your online bank portal, you see a series of transactions, the contents of a block in a blockchain is the same thing. Each block is a new page in the ledger or chain, and the idea is simple, through various models, anyone can participate in the creation of new blocks and/or submit their transaction to the block meaning that there is an immutable (un-tamperable) record that anyone can use to verify that a transaction to took place or that they are the proper owner of an asset or piece of data. The blockchain structure has been the most commonly used structure and is the underlying structure of some of the most popular decentralized projects such as Bitcoin and Ethereum.
DAG stands for directed acyclic graph, directed simply means it heads in one direction (similar to a blockchain), acyclic means that it is NOT cyclic, or that the flow of data/information does not ever cycle back. The structure of a DAG is made up on individual transactions (called vertices) and references (called edges) which you can see in the image below
The circles are the vertices and the arrows are the edges. Each vertices is a individual transaction and the edge is a reference to a previous transaction. Unlike a blockchain which gathers a larger number of transactions into a block and then that block references a previous block, each transaction in a DAG selects its own previous transactions to reference and build on. If a blockchain is a string, a DAG is a tree, able to grow multiple branches while still having a central trunk.
The trunk is an important mechanism because DAGs achieve the same functionality of a blokchchain by using algorithms that favor branches that have a heavier, why? Because of the 1 to 1 nature of for new transaction referencing a validating a previous transaction. If a user submits a phony transaction or tries to double spend their fund, other network participants won’t want to “reference” or build onto of their edge (the sphere) because the network as whole will ignore the branch and eventually it will die off as the honest users.
Think of it like this, everyone getting on a plane needs to vouch for another passenger that their ticket is valid in order to validate their own ticket, if someone tried to fake having a ticket, no one who actually has a ticket will want to validate them because then their would be one too many people claiming they have tickets than their are seats on the plane and their flight couldn’t take off. If you are a good actor within a DAG system, your incentivized to only associate your transactions with other good actors to keep your transaction as part of the primary branch. If each passenger with a valid ticket also verifies the ticket of another fellow passenger then only properly ticket passengers should board the plane.
Pros & Cons
Like anything, these two structures have pros and cons to them. I’ll be honest with you all, I am still very much learning about both of these as I go and I’m sure there are technological improvements to both of them that are yet to be discovered but these are the trade-offs as they stand today.
For blockchains, the pros are in their transparency and immutability, one a page is added to the ledger it is now part of the record and cannot be altered. This ledger is easily accessible to anyone on the network and anyone can contribute to it, which is also where some of the pros come in
The consensus algorithms for blockchain, namely proof-of-work and proof-of-stake, are expensive to run since they involve either needing massive computing power like in Bitcoin’s proof-of-work consensus mechanism where computers race to solve complex math problems for the right to add the next block to the chain which comes with a financial reward paid to you by the network. Proof-of-stake networks remove this race, but require validators to “stake” or lock up their tokens as collateral for the right to validate transactions and add the next block, your locked up stake prevents bad actors as acting maliciously means that your “stake” can be taken away from you. The issue is it ultimately leads to centralization since wealthy holders can more easily afford to stake massive sums of tokens in the network and they essentially have defacto control over the network.
There are some new (less than 3–4 years old) blockchain consensus mechanisms looking to solve the proof-of-work and proof-of-stake shortcomings. One is Proof-of-History (PoH) like with the Solana network. Proof-of-History involves using the transaction hash (which is just an 256 character string of letters and numbers) that goes through an algorithm to determine the an output which is used to mark the next block. The hash of the new block has a time stamp encoded into it so that each block hash has a record built into it as to the order of blocks (which contain the transactions) so the network can agree on the order and reach consensus. Another interesting mechanism is the Pure-Proof-of-Stake (PPoS_ mechanism pioneered by the Algorand protocol. Unlike traditional PoS, PPoS doesn’t require member sox the network to stake their tokens in order to participate in the consensus and formation of the next block. Instead, for each block, every token holder in the network conducts a cryptographic self-lottery, think of it like pulling the handle on a slot machine. The outcome is random, and for each block a certain percentage of the network is randomly selected through this “slot machine” mechanism and those winners are then able to contribute to the next block. Both PoH and PPoS are relatively newer protocols but have both show early promise.
DAGs, in theory, are completely decentralized. The participants select their own vertices (the circles) to verify and then connect to via their own edge (the lines) so there are no miners like in Bitcoin and large currency holders cannot dominate a staking mechanism. One thing that the structure of a DAG does readily address is throughput, give that the network isn’t confined by block size, in theory DAG’s can achieve nearly limitless throughput which is measure in transaction per second. If your transaction can find a vertices (remember, multiple new transactions can select the same vertices and and create an edge to them. The edge is a reference to that previous transaction, saying you have validated it and are then submitting your transaction to the network for the next person to build on.
Sounds pretty sweet, well DAGs aren’t perfect systems just yet and do have some drawbacks. The mechanism of a DAG works, only if the network is conducting new transactions fast, really, really fast. If bad actors try to enter a transaction into that network, others stop building on that branch and the branch dies off. The issue is if network activity is slow, that bad branch dies off slowly and might allow the bad actor to get away with their fraudulent transaction if a stronger branch doesn’t emerge fast enough. These dead branches are easily passed by and die off if the network is active as these heavier valid branches grow quickly and the bad branch is quickly passed by. Given how early most DAG based networks are, their transaction volume is still relatively slow and thus a series of relay nodes have been setup to speed up transactions to avoid this issue, at the expense of not being truly decentralized (organizations control these relays and could in theory alter a transaction that passed through them). One project that is gaining traction using the DAG structure is Hedera Hashgraph. Hedera introduces a few interesting new mechanics to improve the DAG, namely their gossip-of-gossip protocol which allows the record or new transactions to quickly propagate through the network, hopefully avoiding and “bad actor” branches from being able to take advantage before the branch is passed by.
I usually try and keep things short so sorry for the long windedness of this post but I wanted to make sure I went into enough detail on blockchains and DAGs. Together they both fall under the umbrella of distributed ledger technology and the are fueling a transition to a more decentralized world. I was recently readying a Forbes post from Bain Capital Partner Matt Harris and he shared this graphic detailing where we are in the blockchain/decentralization adoption curve in relation to Fintech:
As we continue to move down that line from centralized to decentralized, blockchains and DAGs will continue to play a pivotal role in this shift in both financial and non-financial infrastructure.
Originally published at https://www.talkinsaasy.com.