
The Tech Behind IOTA — Part 2 (Consensus)
The full article was originally published by Luka Stanisic on Medium. Read the full article here.
The Tech Behind IOTA — Part 2 (Consensus)
I’ve long thought how to structure these tech series. It’s hard to chose a technical level of proficiency that everyone can follow, because everyone comes from a different background.
If you’re new, take a look at the first article of the series to get a general idea how the Tangle works and how it’s different from a blockchain. (here)
Going further, I will use some technical terms, but you should be able to follow without any problems.
The idea of the consensus algorithm is to structure the Tangle in such a way that every observer can come to a conclusion what’s valid and what’s not, just by observing the Tangle. Once the Tangle is structured in such a way, nodes calculate finality locally.
The consensus can be broken down like this:
-A node receives a transaction;
-It checks locally to see if it’s valid;
-If the node thinks the transaction is valid, it appends it to its copy of the Tangle and broadcasts it to its neighbors;
-It includes it in its tip selection algorithm (those are tips(transactions) that the node likes);
-If a node detects a conflict (2 transactions trying to spend the same funds) it reports it;
-If a conflict is reported, nodes vote to resolve the conflict;
-At this point, the node either still thinks the transaction is valid or it knows that it’s a double spend;
-All nodes do this;
-They continue issuing transactions referencing the ones from the tip selection algorithm (those are transactions that they like);
-If a transaction is voted as invalid by FPC (explained below), the tip selection algorithm won’t select it;
-The node calculates locally how many nodes have referenced the transaction;
-When it reaches a certain threshold, it confirms it as final and irreversible;
-This is done for all transactions.