The Tech Behind IOTA — Part 1 (Introduction)
In this article, I will try to explain how IOTA will work in the post-Coordicide (the removal of the Coordinator) era.
There will probably be many series on this topic, each covering part of the solution.
This post will try to give you the general idea how IOTA compares to other traditional blockchains.
Most blockchains use Nakamoto consensus. They find a leader that produces a block, which is then gossiped to all other nodes in the network in order to validate it. How is the leader selected? It depends. In PoW (proof of work) it’s the first miner that solves the cryptographic puzzle. In PoS (proof of stake) a random staker is selected for each block. All of those PoX (proof of “x”) where “x” is a scarce resource (energy in PoW, stake in PoS, etc..), they all use Nakamoto consensus (longest chain wins), but find leaders in different ways. This process is done synchronously which means all (honest) participants first accept a new block and only after accepting it they start working on the next block. It’s important to note that each block has a fixed block size, so each block has a finite number of transactions. A transaction is considered valid only if it’s included in a block, and all invalid transactions and double spends will never be included. So it’s easy to understand why this kind of consensus doesn’t scale in a secure and decentralized way. Only one node produces the block and all others are idle (they aren’t doing any meaningful work while they wait). Only one miner produces a valid block and the other work put in by other miners (for that block) is discarded. Bitcoin is not slow because there are a lot of miners and validator nodes in the network. It would work the same with one node and a million nodes. It’s designed to keep the block time (time between blocks) around 10 minutes, on average, so all validators will get the same block and validate it before they start working on the next one. Each block has a fixed size (1MB) in Bitcoin and only a limited amount of transactions can be made in that time. In order for your transaction to be included you pay fees to give an incentive to miners to include it in their block.
How is IOTA different?
-It uses a different data structure (Directed Acyclic Graph called the Tangle)
-It’s asynchronous (every node can produce a valid transaction at the same time)
The Tangle and its asynchronous nature are the main differences that allow IOTA to scale in a decentralized and secure way which couldn’t be possible in traditional blockchain where everything is synchronous around 1 elected leader.
How does it simply work?
Unlike traditional blockchain where the leader produces the block, in IOTA every node is allowed to issue valid transactions at the same time. Nodes add transactions to their copy of the Tangle and gossip them to neighboring nodes. Those nodes repeat the process until all nodes in the network eventually get the transaction.
It’s important to note:
— Invalid transactions (not a valid signature, not enough IOTA, etc..) will not be added to the Tangle
— Double spends which were issued relatively at the SAME TIME (before any one transaction was accepted — I’ll give examples later to illustrate this) WILL be added and will remain in the Tangle and the conflict will be resolved later.
How are conflicts resolved?
When nodes detect a conflict they vote for a specific outcome (only one transaction can be valid or all of them will be invalid). They use FPC (Fast Probabilistic Consensus) to select one valid transaction and deem all other double spends invalid. They structure future transactions in the Tangle to represent their current opinion in a non ambiguous way so that any observer can come to a conclusion as to what is valid and what is not, just by looking at the Tangle. Nodes opinions are weighted by their MANA. I explained the economics of mana in my previous article here.
A transaction in blockchain in confirmed when it’s added to the block and in IOTA, it’s confirmed when it gets enough approval weight by future transactions weighted by MANA.
So let’s make a couple of examples to illustrate how the same transactions would work in a traditional blockchain and how they would work in IOTA in order to understand the main difference.
Wallet A =100 IOTA
Wallet B=200 IOTA
Wallet C = 0 IOTA
Wallet D = 0 IOTA
For this example, let’s assume that we have nodes all around the world that are connected and have to reach consensus on what is valid and what is not.
Wallet A sends 100 IOTA to wallet C from a node in the USA and wallet B sends 200 IOTA to wallet D from a node in China.
Both transactions are broadcasted to nodes and they’re added to a collection of all transactions (mempool). One leader is selected to form the next block, and adds those transactions to the block and broadcasts the block to other nodes. All nodes check the content of the block to see it’s correct and to accept it as a valid block.
The node in the USA adds transaction A to its copy of the Tangle and broadcasts it to Canada and Mexico and at the same time China adds transaction B to its copy of the Tangle and broadcasts it to Japan and India. Mexico, Canada, Japan and India keep broadcasting it to their neighbors and eventually both transactions arrive in Europe. Europe then checks and accepts them as valid and continues broadcasting them to others. Eventually, the USA gets transaction B, and China gets transaction A, and no conflict is detected. Future transactions successfully reference those transactions and both A and B are valid after some time.
Wallet A sends 100 IOTA to wallet C from the USA (transaction A1) and Wallet A sends 100 IOTA to wallet D from China (transaction A2).
Nodes broadcast A1 and broadcast A2. Both transactions get added to the collection of transactions (mempool). 1 leader is selected. He sees both transactions and he picks 1, because he can’t pick both as wallet A only has 100 IOTA to spend and can’t spend it twice. The transaction that is picked by the leader is considered valid and is broadcasted to the other nodes. They check and verify and accept is as valid. They pick a leader to produce a next block and he sees A2 in his mempool and discards it because he sees that wallet A already spent its balance. That’s how blockchain solves the double spend in a synchronous way.
The node in the USA adds transaction A1 to its copy of the Tangle and broadcasts it to Canada and Mexico and at the same time China adds transaction A2 to its copy of the Tangle and broadcasts it to Japan and India. Mexico, Canada, Japan and India keep broadcasting it to their neighbors and eventually both transactions arrive in Europe and Europe sees both transactions A1 and A2 and reports a conflict. Europe broadcasts A2 so it can get to the USA and broadcasts A1 so it can get to China. Nodes vote to select 1 transaction as valid A1 or A2. After a couple of rounds of voting they all agree and pick for example A1 to be valid and A2 to be invalid. They structure incoming transactions in a way to reference A1 and not to reference A2 and after some time A1 gets referenced by enough transactions to be considered valid, while A2 will remain in the tangle it won’t generate enough approval weight and it will not be considered valid. This is how IOTA solves the double spend in an asynchronous way. All the nodes are active at all times unlike in blockchain where they wait for a leader to resolve the conflict and they verify the leaders decision.
This is an example of one possible variation of how the nodes would structure future incoming transactions, so any observer would know that A1 is valid and A2 is not.
It’s important to note that in IOTA we don’t have idle time (time when the majority of nodes aren’t doing anything meaningful). Even when they vote on a conflict, nodes keep issuing transactions! All nodes utilize 100% of their computational power in a meaningful way all the time.
These were the main examples that I think anyone can understand after giving them enough thought.
I’ll give one more for those who want to think a little bit more.
When you think about the things I wrote above like a transaction is valid if it’s referenced directly or indirectly by future transactions and that nodes keep issuing transactions at all times even when they’re not aware of a conflict. You may have wondered, what happens if a node issues a transaction and references a double spending transaction not knowing it will be voted later as a double spend?
What happens to those transactions?
Interestingly IOTA came up with an elegant solution to this too. They use a concept called the approval reset switch to solve this. The tangle will be again structured in a non ambiguous way reflecting that the double spend is invalid and all valid transactions referencing the double spending one will be valid and they’ll accumulate enough approval weight while the double spend won’t.
I made a video on this topic with 1 minor error in it which is irrelevant for understanding this topic, so I won’t mention it here to confuse you.
I advise you if you need time to think about the things I’m saying in the video to watch it at normal speed and if you’re familiar with the concept set the speed to 2x.
Link to video
I hope you’ve enjoyed this article and if you have questions, please post them in the comments and/or reach out to me on Twitter (find the link on my profile) and definitely join the IOTA Discord if you’re interested. There, you’ll have the opportunity to ask questions and get answers.
Lastly, I’d like to note that this information is given as it is. It’s not investment advice and everyone should do their own research and not follow me blindly. The IOTA Foundation members can’t verify every post about IOTA that’s on the Internet. Official information is given by the IOTA Foundation members in the official channels. I’m just a community member who is sharing things I believe to be true given the research I’ve done. If you find any contradicting evidence please share it with me.