Learn/Crypto/How Does Blockchain Work?
BeginnerCrypto·9 min read·2 quizzes

How Does Blockchain Work?

The technology behind Bitcoin and Ethereum explained from first principles — no computer science degree required. How blocks chain together, why the ledger cannot be altered, and how thousands of strangers reach agreement without trusting each other.


Module 1Blocks, Cryptographic Hashes, and the Chain

The problem that needed solving

To understand why blockchain was necessary, you need to understand the double-spend problem. Physical cash has a natural solution to this problem: when you hand someone a £20 note, you no longer physically possess it. It cannot be in two places at once. Digital information, by contrast, is infinitely copyable — copying a file does not remove the original. So how can you create digital cash without allowing the same unit to be spent twice?

The solution that existed before Bitcoin was simple: trust a central intermediary. Visa, PayPal, and every bank in the world maintain private databases that record who owns what. When you transfer £100, Visa deducts from your record and credits the recipient — preventing double-spending by controlling a single authoritative ledger. This works reliably, but it requires trusting those specific institutions to be honest, solvent, and accessible. If your government decides to freeze accounts, Visa can be ordered to enforce it. If PayPal deems your account suspicious, they can hold your funds indefinitely.

Bitcoin's insight was to replace the central authoritative ledger with a distributed public ledger — maintained by thousands of independent participants worldwide, with no single point of control. Making this work required solving two hard problems simultaneously: how do you store records so they cannot be altered, and how do you get thousands of strangers to agree on which records are valid? The answer to the first is cryptographic hashing. The answer to the second is consensus mechanisms.

What a block actually contains

A blockchain is a sequence of blocks, each containing a batch of validated transactions. When you send Bitcoin to someone, your transaction is broadcast to the network, validated, and bundled with other pending transactions into a candidate block. Each block contains several components that make the chain tamper-resistant:

  • Transaction data — the list of transfers in that block (e.g., “Alice sends 0.5 BTC to Bob”)
  • Timestamp — when the block was created
  • A hash of this block — a cryptographic fingerprint of all the block's contents
  • The hash of the previous block — the link that forms the “chain”
  • A nonce — a number miners adjust repeatedly to find a valid hash

The critical component is the previous block's hash. By embedding the fingerprint of the preceding block into the current block, every block is cryptographically linked to all blocks before it. Change any transaction in block 500,000, and its hash changes. This means block 500,001 (which contains the old hash of block 500,000) is now invalid. Which means block 500,002 is invalid. And every block after. The chain breaks, and every honest node in the network immediately rejects the fraudulent version.

Cryptographic hashing — the fingerprint that cannot lie

A cryptographic hash function takes any input — a word, a file, an entire block's worth of transactions — and produces a fixed-length output that appears random. Two properties make it useful for blockchain security. First, it is deterministic: the same input always produces the same output. Second, it is irreversible and sensitive: change a single character in the input, and the output changes completely and unpredictably. You cannot reverse-engineer the input from the output, and you cannot predict what the output will look like before computing it.

Bitcoin uses the SHA-256 hash function. Feed it the string “Hello” and you get a specific 64-character hex string every time. Feed it “hello” (lowercase h) and you get a completely different 64-character string. This sensitivity to input means that any attempt to alter historical transaction data produces a detectably different hash — which breaks the chain and is immediately visible to all nodes.

How Blocks Chain Together

Block #499,999Transactions2,345 transactionsHash (this block)0000a3f8…c291Prev. block hash000071b2…9ae1Block #500,000Transactions2,198 transactionsHash (this block)00002c91…8f3aPrev. block hash0000a3f8…c291Block #500,001Transactions2,501 transactionsHash (this block)0000e14d…0b72Prev. block hash00002c91…8f3aEach block's "Prev hash" matches the previous block's hash — change one, and the chain breaks
💡Think of it like a tamper-evident seal
Imagine writing each day's transactions in a notebook, then sealing it with wax stamped with a unique imprint derived from everything in that day's pages plus yesterday's seal. If you open an old notebook and change a number, the seal no longer matches — and every subsequent seal is now wrong. Anyone who has been keeping track of the seals can immediately detect the tampering. The blockchain works on the same principle, but with cryptographic certainty rather than physical wax.

🧠Quick Check — 4 questions
Blocks, Hashes, and the Chain1 / 4

What is the 'double-spend problem' that blockchain was designed to solve?


Module 2Nodes, Consensus, and Making It Trustless

Nodes — the network's backbone

A blockchain is not stored on any company's servers. It is replicated across thousands of nodes — computers running the blockchain software — each of which maintains a complete, independent copy of the entire transaction history. Bitcoin has over 15,000 reachable nodes worldwide, with an estimated 50,000+ total. Each one independently validates every transaction it receives and propagates valid ones to its peers.

This distribution is what gives blockchain its primary security property: resilience. To take Bitcoin offline, you would need to simultaneously shut down the majority of nodes across dozens of jurisdictions simultaneously — an operation that no government or organisation has the technical and legal reach to execute. China, which has the most centralised internet infrastructure in the world, banned Bitcoin mining repeatedly between 2017 and 2021. Each time, mining activity migrated to other countries and the network continued without interruption.

How thousands of strangers agree — consensus mechanisms

Agreeing on a shared record without any central authority is called a consensus problem in distributed computing. It was theoretically unsolvable for permissionless systems (where participants can be anonymous and potentially adversarial) until Satoshi combined cryptographic hashing with a cleverly designed economic incentive mechanism: Proof of Work.

Proof of Work — Bitcoin's mechanism

In Bitcoin's Proof of Work, miners compete to add the next block by finding a hash that meets a specific difficulty target. They take the block's contents, add a nonce, and hash the result. If the hash begins with enough leading zeros (the difficulty target), they've found a valid block and broadcast it to the network. If not, they increment the nonce and try again. This process is repeated billions of times per second per miner, consuming real-world electricity.

The difficulty adjusts automatically every 2,016 blocks (roughly two weeks) to maintain an average block time of 10 minutes, regardless of how much total mining power the network has. More miners means the difficulty increases; fewer means it decreases. The winner receives the block reward (currently 3.125 BTC after the April 2024 halving) plus transaction fees from the transactions included in the block. The economic incentive aligns miner self-interest with network honesty: mining honestly and earning the reward is far more profitable than attempting to mine fraudulent blocks that honest nodes will reject.

Proof of Stake — Ethereum's mechanism after 2022

Proof of Work's energy consumption became increasingly criticised — Bitcoin alone consumes roughly as much electricity as Argentina. Ethereum addressed this with its September 2022 “Merge,” switching to Proof of Stake (PoS). Under PoS, validators replace miners. To participate, they deposit (stake) a minimum of 32 ETH as collateral. The protocol randomly selects validators to propose and attest to new blocks, with selection probability proportional to stake size.

Validators that behave dishonestly — trying to approve fraudulent transactions or sign contradictory blocks — have a portion of their staked ETH “slashed,” a direct financial penalty enforced by the protocol. The economic security model is similar: honest behaviour earns rewards; fraudulent behaviour costs money. But instead of expending electricity as the deterrent, Proof of Stake uses locked capital. Ethereum's energy consumption fell by 99.95% after the Merge, while its security guarantees remained equivalent.

Why the ledger is effectively immutable

“Immutable” is a common description of blockchain data. It is worth being precise about what this means in practice. Data on the Bitcoin blockchain is not absolutely immutable in a mathematical sense — it is immutable in a practical, economic sense. Altering any historical transaction would require recomputing the proof-of-work for that block and every subsequent block faster than the honest network is adding new blocks. At Bitcoin's current hashrate of ~500 exahashes per second, accomplishing this would require more computing power than all the world's data centres combined, consuming energy that would cost billions of dollars per day.

This is what “trustless” means in the blockchain context. You do not need to trust Satoshi, or any company, or any government. You trust the game theory: the system is designed so that honest behaviour is always more profitable than dishonest behaviour for any economically rational actor. Bitcoin has processed over 900 million transactions since 2009 without a single successful double-spend on the main chain. The empirical record is the strongest evidence that the design works.

📌The 51% attack — theory vs. practice
A 51% attack is theoretically possible: if a single entity controls over 50% of Bitcoin's total computational power, they could potentially rewrite recent blocks. In practice, Bitcoin's hashrate is so large and so distributed that acquiring this level of control would cost tens of billions of dollars in specialised ASIC hardware alone, plus ongoing electricity costs. The attacker would also simultaneously destroy the value of any BTC they might steal, since a successful 51% attack would collapse market confidence. It has happened on smaller, less-hashrate-secured coins — never on Bitcoin.

🧠Quick Check — 4 questions
Nodes, Consensus, and Immutability1 / 4

Ethereum switched from Proof of Work to Proof of Stake in September 2022. What is the primary advantage of Proof of Stake?


Module 3Ethereum, Smart Contracts, and the Broader Blockchain Ecosystem

Ethereum — a programmable blockchain

Bitcoin was designed with deliberate simplicity: a decentralised ledger for recording transfers of a scarce digital asset. Its scripting language is intentionally limited to prevent complexity from introducing security vulnerabilities. Ethereum, conceived by Vitalik Buterin and launched in 2015, took the blockchain concept and extended it with a fundamental new capability: a Turing-complete virtual machine on which arbitrary programs can run.

These programs — called smart contracts — are deployed to the Ethereum blockchain and execute automatically when the conditions encoded in them are met. A smart contract can hold funds and release them only when a specific condition is satisfied. It can issue tokens, manage votes, operate an exchange, or run a lending protocol — all without any company, server, or human intermediary in the execution path. Once deployed, a smart contract runs exactly as written, for as long as the Ethereum network exists, without any single party able to stop or alter it.

The Ethereum Virtual Machine (EVM) runs on every full node in the network. When a transaction triggers a smart contract function, every node executes the same computation independently and arrives at the same result — achieving consensus not just on which transactions occurred, but on the output of complex programs. This creates a global, trust-minimised computer: code that runs the same way everywhere, that nobody can selectively shut down or alter.

What smart contracts make possible

The practical applications of smart contracts are most visible in decentralised finance. Uniswap — a decentralised exchange running on Ethereum smart contracts — processes billions of dollars in trading volume monthly without any company matching orders, holding funds, or executing trades. Users interact directly with the smart contract, which automatically calculates prices and executes swaps using mathematical formulas hardcoded into the contract. Aave and Compound allow users to lend and borrow cryptocurrency directly peer-to-peer, with interest rates set algorithmically and collateral managed automatically — no bank, no credit check, no loan officer.

Beyond DeFi, smart contracts underpin the NFT ecosystem (digital ownership records that cannot be duplicated or transferred without the owner's private key), stablecoin issuance and management, governance systems where token holders vote on protocol upgrades, and cross-chain bridges that move assets between different blockchains. The combined value locked in Ethereum smart contracts — representing user funds actively deployed in protocols — has regularly exceeded $50 billion, representing the largest demonstration in history that financial activity can be conducted without financial intermediaries.

Public, private, and layer 2 blockchains

Not all blockchains are equally open. Bitcoin and Ethereum are public and permissionless: anyone can run a node, read the history, and submit transactions without identification or permission. Private or permissioned blockchains — like those built on Hyperledger Fabric, used by enterprises and banks — restrict participation to known, approved entities. They offer higher throughput and lower energy consumption but sacrifice the trustless, censorship-resistant properties that make public blockchains valuable. The trade-off is fundamental: if you can control who participates, you must trust the controller.

Layer 2 networks address a different problem: the scalability of public blockchains. Ethereum can process approximately 15 transactions per second on its base layer — far too slow for mainstream adoption. Layer 2 networks like Arbitrum, Optimism, and Base process transactions off-chain in batches, then submit compressed proofs to the Ethereum main chain (Layer 1) for final settlement. This achieves 100–2,000 transactions per second at a fraction of the cost, while inheriting Ethereum's security. Most consumer crypto applications in 2024 run on Layer 2 networks, not directly on Ethereum mainnet.

🔑The key takeaway on blockchain
Blockchain is not one technology — it is a design pattern: a shared ledger secured by cryptography and maintained by distributed consensus rather than central authority. Bitcoin uses it to create scarce digital money. Ethereum uses it to create a global programmable computer. Both eliminate the need to trust a specific institution — replacing institutional trust with mathematical proof and economic incentives aligned to honest behaviour. Understanding this design is more important than understanding any specific coin or protocol built on top of it.
Up Next
What Is Bitcoin and How Does It Work? →
Article 3