How Blockchain Works
Beneath every blockchain is a carefully engineered system of cryptographic proofs, network consensus, and distributed storage. This chapter breaks down each layer of that system in plain terms.
The Building Block: A Single Block
Every blockchain is composed of individual blocks linked together to form a continuous chain. Each block contains three essential components. First, there is a set of data records such as transaction details or contract terms. Second, each block carries a timestamp recording exactly when it was created. Third, and most critically, each block contains two cryptographic hashes: its own unique hash, generated from its contents, as well as the hash of the block immediately before it in the chain.
A cryptographic hash is a fixed-length string of characters produced by running data through a mathematical function. Even a tiny change to the input produces a completely different hash output. This means that if anyone tries to change even a single character in an old block, its hash changes and invalidates the hash stored in every subsequent block. Tampering becomes immediately detectable and computationally impossible to conceal at any meaningful scale.
Cryptographic infrastructure is the security foundation that makes blockchain tamper-proof | Photo: Alexandre Debiève / Unsplash
Distributed Network
Unlike a traditional database that lives on a single server controlled by one organisation, a blockchain is replicated across a peer-to-peer network of computers known as nodes. Each node holds a complete, identical copy of the entire blockchain. There is no central point of failure and no single authority controlling the data.
When a new transaction is initiated, it is broadcast to all nodes in the network. Before it can be added to the chain, the majority of nodes must agree that it is valid. This process is called consensus, and it is what prevents fraudulent transactions from being recorded on the ledger.
Immutability
Once a block has been added to the chain and confirmed by the network, it becomes essentially permanent. Altering a historical block would require recalculating every subsequent block's hash and convincing the majority of the entire network to accept the fraudulent version simultaneously, a task that is computationally impossible at any meaningful scale of decentralisation.
On public blockchains like Bitcoin and Ethereum, anyone can view any transaction that has ever occurred, providing an unprecedented level of transparency. On private or permissioned blockchains, this transparency is restricted to authorised participants only.
Consensus Mechanisms
The consensus mechanism is the set of rules by which nodes in a network agree on what is valid and what should be added to the chain. The choice of mechanism has significant implications for security, energy consumption, and transaction speed.
Proof of Work
The original mechanism introduced by Bitcoin. Nodes called miners compete to solve a complex mathematical puzzle. The first miner to find the solution earns the right to add the next block and receives a cryptocurrency reward. This requires enormous computational effort, which makes it secure but also consumes very large amounts of electrical energy globally.
Proof of Stake
Developed to address the energy concerns of Proof of Work. Validators are chosen to create new blocks based on the amount of cryptocurrency they have locked up or staked as collateral. Ethereum switched from Proof of Work to Proof of Stake in September 2022, reducing its energy consumption by approximately 99.95%.
Other Mechanisms
- Delegated Proof of Stake — Token holders vote for delegates who validate transactions, enabling faster speeds at the cost of some decentralisation
- Proof of Authority — Pre-approved validators maintain the network, used in private enterprise blockchains where participants are already known and trusted
| Mechanism | Energy Use | Speed | Primary Use |
|---|---|---|---|
| Proof of Work | Very High | Slow (~7 TPS) | Bitcoin |
| Proof of Stake | Very Low | Fast (100,000+ TPS) | Ethereum (post-2022) |
| Delegated PoS | Low | Very Fast | EOS, TRON |
| Proof of Authority | Minimal | Very Fast | Enterprise networks |
Smart Contracts
A smart contract is a self-executing program stored on a blockchain that automatically enforces the terms of an agreement when predefined conditions are met. First introduced by the Ethereum blockchain in 2015, smart contracts are one of the most powerful applications of the technology.
For example, a smart contract could automatically release payment to a supplier the moment a shipment is recorded as delivered on the blockchain, without any human intervention or need for a bank to process the transaction. The code executes exactly as written, removing the need for lawyers, banks, or other intermediaries in many types of agreements.
Key Insight
Smart contracts are the foundation of decentralised finance, non-fungible tokens, and decentralised applications. They transform blockchain from a simple data storage system into a programmable platform capable of executing complex business logic without any central authority overseeing the process.