Ever since I decided to get into the wonderful world of web3 and decentralization I’ve decided to make a conscious effort to share what I learn. I recently learnt about the byzantine problem and how the blockchain resolves the issue.
Understanding the Byzantine General’s Predicament
Picture a medieval kingdom, besieged by a coalition of four generals set on conquering it. In an era devoid of smartphones and walkie-talkies, generals are reliant on messengers to synchronize their assaults. But wait — there is a problem. These messages can be intercepted or fabricated, throwing a wrench into their strategic plans. The challenge emerges: How can generals reach a unanimous decision when trust is scarce?
Blockchain and its Solution to the Problem
In today’s era, the blockchain emerges as the remedy for the Byzantine Generals’ headache. The blockchain being a decentralized and trustless network in which computers (nodes) come together to process and validate transactions. Nodes that wield computational power to keep the blockchain operating in a decentralized manner, are referred to as miners. These nodes can join and leave the network freely, as the blockchain is permissionless system, and anyone (computer) can be a miner.
The problem still remains how is Consensus reached in a decentralized network, with nodes striving to agree on transaction validity, even with some playing dirty or sprinting ahead in the processing race.
In order to crack the consensus conundrum, let’s explore how blockchain transactions journey from initiation to validation:
- Transaction Ignition and Verification: A user kickstarts the transaction by signing it with a private key, giving it a digital signature. This verified transaction is broadcasted to the blockchain, where it’s assessed and parked in the mempool — a pit stop for pending transactions.
- Transaction Selection and Mining: Miners spring into action, cherry-picking transactions from the mempool. Transactions with generous fees often snag the spotlight. These chosen transactions are bundled into blocks, setting the stage for the the block to be mined.
- Proof of Work (PoW): Miners roll up their sleeves for PoW, a computational treasure hunt involving a cryptographic puzzle. The puzzle is designed in such a way that it extremely difficult to solve but really easy to verify its solution. With computers racing against time, the goal is to unearth a nonce, this is a value that is continuously tweaked in order for the puzzle to be solved, that fits a particular criteria — such as the cryptographic hash of the previous block has to be prefixed by a certain number of zero’s. This intensive process flexes blockchain’s security muscles.
- Validation and Embrace of the Mightiest Chain: Once a miner cracks the puzzle, they present their discovery to the network. Other miners do a quick check, and if it’s a bingo, they rally around this new block. The “heaviest” chain, the one with the most computational sweat, takes the throne. It's important to note that the nodes don’t blindly accept that a miner has solve a problem, but they first verify the solution before proceeding.
- Partition Puzzles and Converging Paths: In the rare event of network partitioning, where chains of equal length emerge, the network taps into its toolkit for convergence. Economics plays its magic, encouraging miners to rally around the most rewarding block. Time-based rules or favoring the earliest mined chain can also steer the ship back to harmony.
And that’s it ! Stay tuned as I voyage deeper into the realms of web3 technology, sharing insights and discoveries along the way.
Resources
Blockchain Consensus Short Lecture
Realtime Illustration of the Bitcoin Mining Process
Blockchain Basics
Top comments (0)