The consensus protocol is akin to the operating system of a blockchain. But blockchain consensus algorithms are special, because they define how to resolve disputes between nodes that received conflicting data.
Think of a consensus algorithm as a digital, impartial judge that hears both sides of an argument to arrive at the “truth” of what actually occurred. This judge then determines how to proceed according to a set of predetermined laws or rules. These rules must account for three key properties:
- liveness, which ensures that data can always be added and the network never gets “stuck”;
- agreement, where all nodes in the network eventually agree on the same value; and
- safety, which ensures that an agreed-upon value does not violate the protocol.
Byzantine Fault Tolerance
Byzantine fault tolerance refers to a long-standing distributed systems concept called the byzantine general’s problem which refers to the situation where a network of computers need to come to agreement on something even whilst a portion of the computers act maliciously. In blockchain, it’s the fundamental property that allows for a public (untrusting) decentralized network to function properly.
Sybil resistance refers to resistance against a sybil attack. A sybil attack is when someone can take over a network by creating a disproportionate amount of fake identities. Proof of work and proof of stake are often referred to as consensus mechanisms, but really they’re sybil resistance mechanisms. Proof of work prevents people from easily overthrowing the network with many identities by requiring the handicap of a computational resources; instead of one IP one vote where people can simulate many IPs very easily, “Proof of work is essentially one-CPU-one-vote.”
Proof of Work
Under PoW, a distributed network of miners around the world race to solve increasingly difficult cryptographic problems in order to create a new block on the blockchain containing the new transactions. Solving these problems requires a lot of energy. When a block is entered into the blockchain, the transactions in it officially become part of the record. Miners who successfully create a block are rewarded with freshly-minted tokens and all of the transaction fees within the block.
Proof of Stake
Under PoS, participants (validators) deposit a certain number of native coins as stake into the network of validator nodes. If a node is chosen to validate the next block, they'll check that all the transactions within the block are valid. If everything checks out, the node signs off on the block, and adds it to the blockchain. As a reward, the node receives the fees associated with the transactions inside the block and freshly minted tokens. If a validator approves fraudulent transactions, they’ll lose a part of their stake. As long as the validator’s stake is higher than what they receive from transaction fees, they can be trusted to correctly do their job.
Proof of History
(technically not a consensus mechanism)
Proof of History uses cryptographic timestamps to sequentially order each transaction that occurs on Solana to provide verifiable ordering without requiring all nodes to agree simultaneously.