The Tangle is the moniker used to describe IOTA’s directed acyclic graph (DAG) based transaction settlement and data integrity layer focused on the Internet-of-Things (IoT). The Tangle is essentially a string of individual transactions that are interlinked to each other and stored through a decentralized network of node participants.
Importantly, the Tangle does not have miners as users of the network function as the miners themselves through performing small computational Proofs of Work (PoW) for each transaction by verifying previous transactions submitted to the network. Focused on allowing the network to scale for a global micropayment network of interconnected IoT devices, The Tangle is designed to offer a solution to the heterogeneous nature of current blockchain systems. As the Tangle white paper puts it:
“There are two distinct types of participants in the system, those who issue transactions, and those who approve transactions. The design of this system creates unavoidable discrimination of some participants, which in turn creates conflicts that make all elements spend resources on conflict resolution. The aforementioned issues justify a search for solutions essentially different from blockchain technology, the basis for Bitcoin and many other cryptocurrencies.”
The IOTA Network and The DAG
The IOTA network is currently maintained by the IOTA Foundation and is one of the more well known cryptocurrencies in the space today. The key difference that separates IOTA from other blockchain networks is that the Tangle, the underlying data structure that IOTA is built on, is actually a “blockless” blockchain. Rather than transactions created by users being incorporated into blocks by miners, users function as both the miners and the creators of transactions.
This is a result of the Tangle comprising of a DAG rather than a blockchain to store its ledger. The primary focus of utilizing the Tangle is to create a scalable framework for transactions, specifically micropayments, between IoT devices where the network will theoretically scale in proportion to the amount of transactions being submitted to the network. With scalability a fundamental problem in major cryptocurrency platforms today (although several innovative solutions are in the works), the Tangle is designed to facilitate the growth of a vast future network of interconnected devices.
In place of miners in the Tangle, creators of transactions must verify two previous transactions within the network and each transaction requires a small PoW computation on behalf of the user. Notably, there are no fees when utilizing a Tangle as the network is not heterogeneous where incentives need be applied to distinct participants in the ecosystem.
The key to the Tangle is its use of Directed Acyclic Graphs (DAGs) rather than a blockchain. The DAG effectively functions as a finite directed graph where a collection of vertices (squares) are connected together by edges (arrows). An example of the graph from the IOTA Foundation’s blog is below.
Each transaction is represented by a vertex on the graph and the arrows represent the approval connections between each transaction. Each incoming transaction needs to approve two previous transactions in order to become validated, and as a result, the edges (arrows) represent the connection of each transaction to previous ones. For instance, 5 approves 2 and 3 through direct approvals while it is also an indirect approver of 1.
Notably, transaction 0 is the genesis transaction and in the case of IOTA, contained all the MIOTA (IOTA coin) that will ever be created. Transaction 6 is referred to as a transaction tip because it is an unapproved transaction, which you will see is important in the transaction structure.
Read: Our Guide to IOTA
The Transaction Structure
Each incoming transaction in the Tangle needs to approve 2 tips. The strategy implemented to select which tips will be approved by a specific incoming transaction is one of the most important facets of the Tangle. This is known as the tip selection algorithm and in the Tangle, is achieved by leveraging an optimized form of random walks, primarily the weighted random walk.
Importantly, transactions in the DAG are not spread out evenly across time, there is an intentional delay that makes incoming transactions invisible for a short period in order to replicate real-world latency. The effect is also that the Tangle of transactions is more diverse an not solely a chain of transactions.
The randomness of this spread of transactions is accomplished through the Poisson Point Process, which is a method in probability used to map random points on a mathematical space, in this case, the DAG. In the Tangle, despite the intentional delay of incoming transactions, the overall average of rate of incoming transactions remains constant. The symbol Lambda is used to denote the average rate of incoming transactions and balancing a Lambda that is not too high or low is pertinent to maintaining a diverse network of transactions. With a Lambda of 0, the network of Tangle transactions would solely consist of a linear chain of transactions linked to only one approver transaction. Obviously, this is not ideal for a scalable network of thousands of interconnected devices.
Transaction Tips & The Random Walk
The tip selection algorithm of the Tangle is predicated on a concept known as random walks. Basically, the selector of the tips (unapproved transactions) starts at the genesis transaction and “walks” linearly across the DAG towards the most recent tips, from left to right. There are two types of random walks:
- Unweighted Random Walk
- Weighted Random Walk
An unweighted random walk selects the next transaction tip to jump to based entirely on equal probability. The weighted random walk is more complex and places cumulative weights on each jump to a tip, and is what the Tangle uses. The image below from the IOTA blog demonstrates the concept of a weighted random walk where cumulative weights associating increased probability of the selector jumping to that specific tip being demonstrated through percentages.
It is important to note that the weighted random walk process only happens twice for each transaction. In the Tangle, transactions are given a cumulative weight based upon the number of transactions they have approving them both directly and indirectly. The reason for this is to mitigate against what are called “lazy tips” , or transactions that only validate old transactions, thus not keeping up with the current state of the Tangle. This is an impediment to the network since these transactions do not validate old transactions.
The method of setting a distinct rule for the random selection of each tip as a linear step of the random walk across the DAG is known as the Markov Chain Monte Carlo (MCMC) technique, which is the fundamental tip selection algorithm of the Tangle. The MCMC plays a vital role in the transaction model of the Tangle and is optimized with specific parameters that are necessary to ensure the Tangle’s validity and long-term sustainability.
Thus, the concept of using a cumulatively weighted random walk (MCMC) rather than the unweighted random walk allows the Tangle to avoid lazy tips through a disincentive mechanism whereby lazy tips will not be approved by incoming transactions. The selector in the weighted model is more prone to jump to heavier tips than lighter tips. The preference of the heavier tips, and eventually the heavier Tangle of transactions is important to the eventual consensus of the Tangle network that results from its asynchronous design.
Transaction Validity and Eventual Consensus
Similar to how the longest blockchain in Bitcoin represents the most PoW performed and thus is the most trustworthy and subsequently valid chain, in the Tangle, the heaviest chain (more appropriately the heaviest branch) of transactions is the valid Tangle. Before diving into how eventual consensus and validity of transactions is achieved in the Tangle, it is important to understand how and why the Tangle is considered asynchronous.
In general, since the MCMC is employed as the tip selection algorithm, not all users (nodes) will see the same set of transactions at a given instance of the Tangle, and there may even be conflicting transactions present. However, the distinct qualifier here is that due to model of cumulative weight being added to each transaction, eventually a distinctly heavier branch of transactions will emerge over a lighter branch, which will eventually be discarded. Further, transactions which are old enough will converge into the heavier Tangle and reach eventual consensus.
The double spend problem is effectively mitigated against by the same cumulative weight property of the Tangle. Transactions that are invalid would not be approved by approvers (users/miners) and due to this, all subsequent transactions that approve invalid transactions are considered invalid. Because these specific invalid transactions do not have nearly as many direct or indirect approval connections as valid connections (cumulative weight is predicated on indirect and direct approvals), they become part of the lighter branch of the Tangle that is eventually discarded.
A clear problem from the user’s perspective however, is that there is no way of knowing whether or not their transaction is validated and achieves consensus as part of the heavier branch that eventually reaches consensus on the state of the Tangle, when taken at face value. The solution to this problem lies in the confirmation confidence that is afforded to each transaction. By using a proprietary formula that measures the probability of a transaction’s level of acceptance in the Tangle, each transaction is given a confirmation confidence score notated in a percentage of likelihood that it was included.
Highly weighted tips are given more consideration so as to ensure that the heavier branch is including valid transactions. Eventually, this leads to consensus of valid transactions, however, it opens the door for a potential attack vector for a malicious user with substantial computational power. As long as the user is capable of sending as many or more transactions than the rest of the entire network combined, that user would be able to create invalid transactions and trick the Tangle into thinking they are part of the valid branch.
The Coordinator and Future Scalability
To mitigate the problem of a malicious user attacking the network in the above fashion, the IOTA Foundation currently employs what is known as The Coordinator. The Coordinator acts as a centralized, voluntary and temporary alternative consensus mechanism for the Tangle.
The Coordinator is used to issue a milestone transaction every 2 minutes on the Tangle, with all transactions approved by the Coordinator being considered as to have an immediate confirmation confidence of 100%. The implementation of the coordinator is controversial, but logically understandable, since the IOTA network does not contain enough incoming transactions interacting with each other in the Tangle to autonomously mitigate against the aforementioned attack vector at this current point in time. As the network continues to scale, however, the role of the Coordinator will be reduced and eventually removed, leaving the Tangle to function as a fully decentralized network secured through a distributed consensus mechanism utilizing MCMC across the DAG.
The Tangle has been pegged as the “next-generation” blockchain since its original inception back in October 2017. Despite controversy surrounding its implementation and long-term sustainability and potential, the Tangle remains one of the more fascinating concepts in the cryptocurrency realm.
With blockchain scaling solutions on the horizon, seeing whether or not the “blockless” Tangle can scale to levels where it functions as the distributed framework for the emergence of the IoT will be fascinating to watch.