Course 02 · Lesson 02

How the Blockchain Works

~9 min readLesson 02/7Free

The blockchain is the technology that makes Bitcoin work - and the concept that every other cryptocurrency, DeFi protocol, and Web3 application builds on. It is also one of the most frequently described and least accurately understood technologies in mainstream media. This lesson explains it precisely - what a blockchain actually is, how it stores data, how cryptographic hashing links each block to the previous one, and why the resulting structure is practically impossible to alter. By the end of this lesson, you will be able to explain the blockchain to someone else accurately - which means you understand it better than most people who write about it professionally.

The Ledger Analogy

The best starting point is a simple analogy. Imagine a village where every transaction between residents is recorded in a public ledger. Every time someone transfers money, the transaction is announced loudly to the whole village, and every resident writes it down in their own copy of the ledger. There is no single official copy - every copy is equally valid. To falsify a transaction, you would need to simultaneously change the record in the majority of every resident's ledger - an practically impossible task.

The Bitcoin blockchain is this village ledger - except instead of village residents, there are approximately 15,000 to 20,000 computers around the world. Instead of writing transactions by hand, they record them using cryptographic functions that make falsification detectable and practically impossible.

Blocks and the Chain

Transactions on the Bitcoin network are not recorded one by one - they are batched together into blocks. Approximately every ten minutes, all the recent transactions broadcast to the network are collected, verified, and packaged into a new block. This block is then added to the chain of all previous blocks - creating the blockchain.

Each block contains: a list of verified transactions, a timestamp, a reference to the previous block (its hash), and a unique identifier for itself (its own hash). The reference to the previous block is what creates the chain - each block is cryptographically linked to the one before it.

BLOCK STRUCTURE

Block 850,000 (example):
• Transactions: 2,500 confirmed transactions.
• Timestamp: Date and time of creation.
• Previous block hash: 000000000000000000025a3f... (64 characters)
• Own hash: 00000000000000000001b7d2... (64 characters)

Block 850,001:
• Previous block hash: 00000000000000000001b7d2... (matches Block 850,000's own hash)

Each block references the previous. A chain is formed. Altering any block breaks all the links that follow it - immediately detectable by every node.

Cryptographic Hashing

A cryptographic hash function takes any input - a word, a document, an entire block of transactions - and produces a fixed-length output string called a hash. Bitcoin uses the SHA-256 function. Two critical properties make this useful.

First: the same input always produces the same hash. "Hello" always produces the exact same 64-character string. Second: any change to the input - even changing a single letter - produces a completely different hash. "Hello" and "hello" produce radically different outputs. This means a hash is effectively a unique fingerprint of its input data.

HASH FUNCTION DEMONSTRATION

• Input: "Hello"
• SHA-256 output: 185f8db32921bd46d35cc53cb1...

• Input: "hello" (lowercase h)
• SHA-256 output: 2cf24dba5fb0a30e26e83b2ac5b...

One character changed. The entire output is different. This is what makes hashing useful for data integrity verification.

Distributed Consensus

Every node on the Bitcoin network holds a complete copy of the entire blockchain - all transactions ever recorded, going back to the genesis block in January 2009. When a new block is proposed, every node independently verifies every transaction in it against the rules of the protocol. Only if the block follows all the rules is it accepted and added to the node's copy of the blockchain.

If two nodes disagree about which block is valid - a situation called a fork - the network follows the longest chain rule: the chain with the most accumulated computational work is the valid one. This ensures that the network always converges on a single agreed-upon version of the truth, even without any central authority.

Why It Cannot Be Altered

Suppose an attacker wanted to alter a transaction that occurred in block 800,000. To do so, they would need to: change the data in block 800,000 (which changes its hash), then recalculate the hash for block 800,001 (which referenced the old hash), then recalculate 800,002, and so on - all the way to the current block. And they would need to do all of this faster than the entire rest of the network is adding new blocks.

With Bitcoin's current network size, this would require controlling more than 50% of the entire network's computing power simultaneously - a 51% attack. The cost of acquiring this computing power far exceeds any possible gain from altering historical transactions. This is not just theoretically secure - it is economically rational to be honest on the network.

The blockchain's security comes not from any single clever mechanism but from the combination of cryptographic linking, distributed consensus, and economic incentives that make honest participation more profitable than attack. It is a system where mathematics, computer science, and game theory work together to produce a result that is practically impossible to subvert.

KEY TAKEAWAYS
The blockchain is a public distributed ledger - thousands of computers hold identical copies simultaneously.
Transactions are grouped into blocks added every ~10 minutes. Each block cryptographically references the previous.
Cryptographic hashing produces a unique fingerprint of any data - any change produces a completely different hash.
Distributed consensus means all nodes independently verify every block - disagreements are resolved by the longest chain rule.
Altering historical records would require recalculating all subsequent blocks faster than the entire network - practically impossible.
Mining and Proof of Work →