Source: https://www.twilio.com/en-us/blog/what-is-public-key-cryptography
August 2021
The Byzantine Generals Problem is a game theory problem that shows the challenges of decentralized parties reaching a consensus without a trusted central party.
Here's how it works
The Byzantine army is divided into many battalions, each one led by a general. The generals want to attack the enemy from all sides at once, so they need to send messages to formulate the plan. However there could be traitors trying to sabotage their plan by intercepting and changing the messages.
How can the commanders make a decision for a plan of attack without being able to completely trust each other?
The Byzantine Generals Problem shows the difficulty of achieving agreement across a distributed network of players that you cant trust.
Crypto
A blockchain is like a public ledger that everyone can see, and there are lots of anonymous computers that need to agree on which transactions are valid. And like in the generals problem, some computers mights fail or act dishonestly and send false information.
Blockchains solve this problem by requiring the computers to solve a difficult math puzzle (mining). This ensures that most nodes (the “loyal generals”) agree on the same transactions, even if a few nodes (the “traitors”) try to mess things up.
Proof of Work
Proof of Work addresses the Byzantine Generals Problem by requiring computers to perform a computationally difficult task, which takes lots of computing power and enegry to solve which is expensive in terms of electricity and quality of processing power. Once a miner solves the puzzle, they get the right to validate transactions and add a new block of data to the blockchain. This is called mining a block. If a miner tries to cheat by adding false information (like saying someone sent coins when they didn’t), the rest of the network can easily spot it. Since solving the puzzle costs so much energy and money, cheating would just be a waste of resources because the block would be rejected, and the dishonest miner wouldn’t get rewarded. When a miner solves the puzzle and adds a valid block, they get a reward (Bitcoin). So miners have a strong incentive to play by the rules because solving puzzles is expensive, and cheating would cost them time, money, and resources.
Proof of Stake
Proof of Stake is a different way to reach consensus. Instead of relying on solving math problems, PoS requires nodes to put up a stake (cryptocurrency - on hold) to be allowed to participate in the process. If you’re one of the generals and you have a lot of resources (coins), you’re more likely to be trustworthy because you have more skin in the game. The more coins you “stake,” the higher your chance of being chosen to validate the next block of transaction and the more invested you are in the network's well-being. The likelihood of being chosen to validate transactions and create new blocks is given to nodes that have a lot at stake. This method alleviates the energy problem of proof of work since there arent data-centers full of computers competing to solve the puzzle the fastest, so they can get bitcoin for it.
If there is a bad actor, they will lose some or all of their stake as a penalty. Backing up their actions with their own money means they are highly incentivized to be an honest player.