The Nakamoto Consensus is the name of the first consensus system generated for cryptocurrencies, whose name derives from its creator, Satoshi Nakamoto, who also developed Bitcoin.
This system is what makes Bitcoin function possible and, as a consensus system, brings together a series of fundamental functions to make the deployment and operation of this cryptocurrency possible.
What is the Nakamoto Consensus?
The Nakamoto Consensus is actually the union of various algorithms that, applied as a whole, allow Bitcoin to function as a decentralized network powered by a P2P communications protocol, a mining system for the generation of cryptocurrencies, validation of operations and the generation of a history of operations within the network.
So basically the Nakamoto Consensus comprises:
- El Proof of Work (PoW) algorithm, considered the first consensus algorithm based on a proof of work with an associated computational cost.
- Un P2P communication system. Initially, Bitcoin used a system based on the protocol kademlia, but currently it has evolved and uses a system derived from the Gossip Protocol.
- A set of rules focused on work validation made by the miners that are part of the P2P network. These rules are what the miners must comply with in order for their work to be accepted by the network of nodes. The nodes have the obligation to validate said work, any block that is outside these rules is discarded. The idea is that all the nodes manage the same rules and enforce them, creating a consensus on the history and allowing to generate a network with resistance to Byzantine attacks (BFT).
In this way, the Nakamoto Consensus is responsible for providing Bitcoin with the necessary functions and capabilities so that it can function in a decentralized and secure manner.
How the Nakamoto Consensus works
Now, let's analyze a little how the Nakamoto Consensus works, starting from its most basic point: the start of generation of a block for the network.
When Bitcoin prepares to generate a new block, the network communicates this event through a message that tells miners to start generating a new block, taking into account the level of difficulty of the network and the target.
At this point, the nodes and miners know that the difficulty and target They are elements that are part of the block validation rules within the Nakamoto Consensus. In fact, these values must be taken into account when generating a new block for the network.
At this point, the miners already have the necessary elements to start their work using the PoW algorithm. During their work, they will organize the transactions to be validated within the block and, in parallel, they will generating the SHA256 hashes, which must meet the target given by the network.
At the end of your work, miners create the block by following the generation rules and deliver it to the network for verification by the nodes.
Only once the block is verified is it added to the node's copy of the blockchain and a message is sent to the rest of the network indicating that a new block has been added, along with a series of metadata that helps the rest of the network verify that the generation data of that block is available and thus be able to recreate and validate said block individually.
The block selection process
However, block selection is possible thanks to compliance with a series of rules.
The first rule to select a valid block is basically a race. Of the set of miners within the network, only the one that completes a block that meets the target given by the net will be the winner of the race. The award? Issue the block in order for it to be added to the blockchain and thereby claim the commissions and the coinbase of said block.
However, this result will only hold if the second rule is true: the block will only be added if it is fulfilled within the longest chain. Every time a block is issued and validated, it is added to the blockchain, making the network grow.
For example, if the Bitcoin network has a height of 663.700 blocks, and it turns out that a new block is generated and validated, the network will have a height of 663.701 blocks.
But there's a problem. The network is decentralized, there are thousands of nodes and miners all working in parallel, so there are times when one part of the network can be one height (663.699 blocks) and the other can be different (663.700 blocks). At this point, the rules of the Nakamoto Consensus are very clear: the longest net wins, so the miner who has given his work in the network with a height of 663.700 blocks, is the one who will be able to really add his block to the network and claim the reward.
This “longest chain” rule applies not only to miners and their work, but also to nodes and their synchronization to build consensus. If the nodes detect a hard fork of the network, where there are two networks with different heights and histories, the network nodes will decide to keep the one with the highest height and therefore a more confirmed history and greater computational potential. In this way, the network maintains a consensus on which history to track and protect.
On the other hand, the validation rules make sure that the proposed blocks have complied with everything necessary for the PoW algorithm. Namely, the block must have the data and a valid hash, or else it is rejected.
With these simple rules, the Nakamoto Consensus not only protects network history, but also takes care of eliminate those histories that may be manipulated or that do not meet the standards necessary for the proper functioning of Bitcoin.
Incentives and Scarcity
In addition, the Nakamoto Consensus is based on two key concepts: the Incentives and escasez.
The first of them maintains the mining activity in the network, since the incentives are what drives the work of the miners through the commissions and block rewards.
The second concept weighs on these incentives: scarcity. Bitcoin is deflationary, with a maximum issue of 21 million coins. This leads to limited incentives and monetary issuance, which makes such resources more appreciated. As a result, miners seek to accumulate as much computational power as possible in order to ensure the highest rewards from the network, and consequently shield the network.
In all this, Bitcoin applies a deflationary system that rreduces block rewards every 4 years or so, in what we know as halving. Thus, during its first 4 years, the Bitcoin block reward went from 50 BTC to 25, and currently said reward is 6,25 BTC.
The reduction in emission and the enormous accumulated computational power, is in charge of making the Nakamoto Consensus more robust and the security of the network stronger than ever.
Nakamoto consensus beyond Bitcoin
The Nakamoto Consensus is considered the first consensus algorithm capable of offering a full byzantine fault tolerance applied to a decentralized digital currency. Such an achievement did not go unnoticed, not only within the world of computing, but also in the generation of new cryptocurrency projects.
Thus, the Nakamoto Consensus was replicated in other projects, for example, Litecoin and even the same Ethereum, which used the Nakamoto Consensus in its PoW implementation, and currently uses a modified version in its implementation Proof of Stake.