Table of contents
Every peer-to-peer network requires a system or protocol to reach a point of agreement for deciding the state of the network at any given instant of time, commonly referred to as the Consensus Mechanisms. These consensus mechanisms are generally a set of rules or standards which need to be followed to determine the state of any network. In centralized systems, the same objective is achieved via a central authority that can possibly modify or play with it very easily.
It is a very common misconception about the popular decentralized peer-to-peer networks like Bitcoin and Ethereum that their consensus mechanisms are purely based upon the Proof of Work(PoW) consensus mechanism. In fact, PoW is part of a larger consensus mechanism known as Nakamoto Consensus, named after the pseudonymous creator of Bitcoin, Satoshi Nakamoto. The Nakamoto Consensus comprises two parts, viz. the PoW, and the longest Chain Selection
Proof of Work (PoW)
PoW comprises the major part of the Nakamoto Consensus. In the peer-to-peer system, each node or miner attempts to find a valid solution for the upcoming block. Miners put in the maximum computation power they can, to find a nonce (a non-sense number) that is computationally hard to find but easily verifiable. This nonce when hashed with SHA256, produces the valid solution. After finding the computationally hard solution, the node broadcasts it to the network for the block to be included. The other nodes verify the block with its nonce and its included in the network chain. After the block is confirmed in the network, the miner receives an incentive, commonly known as mining reward, as compensation for performing computationally hard calculations of finding the nonce.
Bitcoin/Ethereum mining is purely based on the commitment of a certain amount of computing power to perform mathematically complex operations. Since the process of finding the nonce is purely iterative in approach, it's nearly impossible to know about the next winner of the mining reward, making it a truly decentralized and trustless ecosystem. This also implies that in order to take over a network like Bitcoin/Ethereum, a miner needs to have at least 51% of the total computational/hashing power in the whole ecosystem. This is commonly known as the 51% attack. Due to the current size of these networks, it is virtually impossible and economically unfeasible to accumulate 51% of the total computational capacity.
Longest Chain Selection
The second part of the Nakamoto consensus is what made it the world's first BFT scalable digital currency platform. Bitcoin places a lot of emphasis on the concept of Longest Chain Selection. In simple words, it means that the chain which is longest and also valid according to the time stamps should be considered as the most legitimate one. The reason stated behind this is that the longest chain would have spent the most computational resources in adding blocks and validating transactions and hence holds a greater stake. This means that any individual newly joining the network or leaving it at their will can simply adopt the longest chain as the most legitimate one. In cases of conflict like the two miners producing a block at the same time, the network waits for a few more blocks to be produced and the fork which becomes longer due to the addition of more blocks over it is accepted as the legitimate one.
Conclusion
It won't be false to state that Nakamoto consensus truly changed how the peer-to-peer transactions work along with the scalability. The combination of Proof of Work with the Longest Chain Selection made it a standard for determining the validity of a blockchain and hence making Bitcoin and Ethereum the world's most popular and BFT scalable digital currency platform.