You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
In a decentralised network with no central authority, how do participants agree on the state of the ledger? Consensus mechanisms are the rules and protocols that allow distributed nodes to reach agreement on which transactions are valid and in what order they are recorded.
In a centralised database, a single administrator decides what data is valid. In a blockchain:
A consensus mechanism must ensure that all honest nodes eventually agree on the same ledger state, even in the presence of faulty or malicious participants.
The foundational challenge of distributed consensus was formalised in 1982 by Lamport, Shostak, and Pease:
Imagine several generals surrounding a city. They must agree on a battle plan (attack or retreat), but some generals may be traitors who send conflicting messages.
| Scenario | Outcome |
|---|---|
| All generals are honest | Consensus is straightforward |
| Some generals are traitors | Honest generals must still reach agreement despite conflicting messages |
| More than 1/3 of generals are traitors | Classical BFT algorithms cannot guarantee consensus |
Blockchain consensus mechanisms are solutions to this problem.
Proof of Work is the original consensus mechanism, introduced by Bitcoin in 2009.
| Property | Description |
|---|---|
| Difficulty adjustment | The network adjusts the target difficulty to maintain a consistent block time (e.g. ~10 minutes for Bitcoin) |
| Energy-intensive | Miners expend significant computational power (and electricity) |
| Sybil resistance | Creating fake identities does not help; only computational power matters |
| Longest chain rule | The chain with the most cumulative proof of work is considered canonical |
| 51% attack threshold | An attacker needs more than 50% of the network's hash power to consistently outpace honest miners |
Target: Find a hash starting with at least 18 leading zeroes
Hash("Block data" + nonce=0):
a3f8b2c1d4e5f6... (doesn't start with enough zeroes)
Hash("Block data" + nonce=1):
7bc29d4e1f3a08... (doesn't start with enough zeroes)
... (billions of attempts) ...
Hash("Block data" + nonce=48291073):
0000000000000000003a8f... (valid! Starts with 18 zeroes)
| Advantages | Disadvantages |
|---|---|
| Battle-tested (Bitcoin since 2009) | Extremely energy-intensive |
| Highly secure with large networks | Slow transaction throughput |
| Simple and well-understood | Tendency towards mining pool centralisation |
| No need to trust validators | Specialised hardware (ASICs) creates barriers to entry |
Proof of Stake selects block validators based on the amount of cryptocurrency they have "staked" (locked up) as collateral.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.