LearnFinance
← Crypto, Blockchain & Digital Money Lesson 1 of 6 · 15 min · +50 XP
Crypto, Blockchain & Digital Money · Lesson 01

How a blockchain works: ledgers, consensus, and why it is hard to cheat

A blockchain is a shared ledger that thousands of strangers keep in sync without trusting each other. The three ideas that make it work; the maths that makes rewriting it so expensive, worked step by step with the Bitcoin whitepaper's own formula; and how a smaller chain, Ethereum Classic, suffered '51% attacks' in 2019 and 2020 that let attackers spend the same coins twice.

Facts reviewed Oct 2026

When you send ₹500 over UPI, two banks update their ledgers. Your balance goes down; the other person’s goes up. You trust the banks to keep those ledgers honest, and you trust the RBI to supervise them.

Now imagine a payment system with no bank and no central authority at all. A ledger is kept at the same time by thousands of computers around the world. Their owners don’t know or trust each other. And nobody can secretly change history.

That’s the problem a blockchain solves. Three ideas make it possible:

  • hash-linked blocks;
  • digital signatures; and
  • consensus.

Idea 1: blocks chained by hashes

A cryptographic hash function turns any data into a fixed-length fingerprint. Bitcoin uses one called SHA-256. Change a single comma in the input, and the fingerprint changes completely and unpredictably. And there’s no practical way to find an input that gives a chosen fingerprint.

A blockchain groups transactions into blocks. Each block includes the hash of the previous block. That links them into a chain.

Say someone edits a transaction in an old block:

  1. that block’s hash changes;
  2. which breaks the link stored in the next block;
  3. which breaks the one after that, all the way to the present.

So tampering is instantly visible to anyone holding a copy.

Idea 2: digital signatures

Each user has two keys:

  • a private key, kept secret; and
  • a matching public key, shared openly. Your address comes from it.

To spend coins, you sign the transaction with your private key. Anyone can check the signature with your public key. But nobody can forge it without the private key.

That’s why losing your private key means losing your coins. And anyone who steals it can spend them.

Idea 3: consensus without a boss

Thousands of computers, called nodes, each hold a copy of the ledger. They need a way to agree on the next block, even if some of them are dishonest. There are two main approaches:

Proof of workProof of stake
Who adds blocks“Miners” racing to solve a computing puzzle“Validators” who lock up (stake) coins as a deposit
Cost of cheatingHuge computing power and electricityLosing staked coins, which are “slashed” for misbehaving
ExamplesBitcoinEthereum (since 2022)
Main criticismEnergy useStake concentrated among big holders

In proof of work, the chain with the most total work is the valid one. To rewrite history, an attacker must redo the work for the block they want to change, and every block after it. And they must do it faster than the honest network keeps adding blocks.

How safe is “six confirmations”?

Bitcoin’s original 2008 whitepaper worked out exactly how likely an attacker is to catch up and rewrite a transaction. It depends on two things: the attacker’s share of the network’s computing power, and how many blocks (“confirmations”) have been added on top. The calculator uses that formula.

Could an attacker reverse your transaction?
Chance the attacker eventually catches up
0.02%
Roughly 1 in…
4,119

Formula from section 11 of the Bitcoin whitepaper (2008). An attacker with half or more of the mining power always wins eventually; that's the '51% attack'.

Worked example. Read the calculator at a few settings:

  1. Attacker with 10% of the power, six confirmations: about 1 in 4,000 chance of reversing your payment.
  2. Attacker with 30%, six confirmations: a much bigger chance. You’d need many more confirmations for the same safety.
  3. Attacker with over 50%: they control the chain, and win eventually, however many confirmations you wait.

That’s why the security of a blockchain depends on how much honest computing power protects it.

Quick check

Why is it so hard to secretly change a transaction buried deep in the Bitcoin blockchain?

A real case: 51% attacks on Ethereum Classic

Ethereum Classic is a smaller proof-of-work blockchain, which split from Ethereum in 2016. Because far less computing power protects it than Bitcoin, renting enough power to overwhelm it costs much less.

January 2019. The US exchange Coinbase detected a deep reorganisation of the Ethereum Classic chain. An attacker had briefly controlled most of its mining power. They rewrote recent blocks, and spent the same coins twice: a double spend.

  • About 219,500 ETC, worth roughly $1.1 million then, was double-spent, according to Coinbase.
  • Coinbase paused Ethereum Classic transfers to protect customers.
  • Exchanges then required many more confirmations before treating Ethereum Classic deposits as final.

July–August 2020. Ethereum Classic suffered three more attacks. By one count, losses totalled about $5.6 million.

How does a double spend work? The attacker sends coins to an exchange, and sells them for other money. Meanwhile, they secretly mine a longer chain in which that deposit never happened. When they release the longer chain, the network accepts it, because it has more work. The deposit vanishes, and the attacker keeps both the coins and the money.

The lessons:

  • The maths depends on honest power. Small chains, with little mining, are far easier to attack.
  • Confirmations are the defence. That’s why exchanges wait longer for smaller chains.
  • “Immutable” has limits. A blockchain is only as hard to rewrite as it is expensive to out-compute.

Public and permissioned blockchains

Public blockchains, like Bitcoin and Ethereum, let anyone read, transact and help validate. Permissioned blockchains limit who can validate. They trade openness for speed and control.

In India, banks and companies have tried permissioned blockchains for trade finance and supply chains. There, the participants are known, and a shared tamper-evident ledger cuts paperwork and disputes.

Going further: why proof of stake changes the attack maths. In proof of work, an attacker needs most of the computing power. They can rent it, or buy machines, then sell them after. In proof of stake, an attacker needs most of the staked coins. To get them, they must buy the chain’s own coins, pushing the price up as they buy. And if they attack, the protocol can slash, or destroy, the stake they used. So the attacker loses the very asset they spent a fortune to acquire. That’s a strong deterrent. But proof of stake has its own worry: if a few big holders or exchanges control most of the stake, they could, in principle, collude. In proof of work, concentration shows up as a few big mining pools. Each system protects against attackers in different ways, and each has a different weak spot.

Common mistakes

  • Thinking blockchains can’t be attacked. Small ones have been.
  • Treating one confirmation as final on a small chain.
  • Storing private keys carelessly. Lose them, and the coins are gone.
  • Confusing the technology with the investment. A working blockchain doesn’t make its coin valuable.
  • Assuming “decentralised” means “nobody controls it”. Power can still concentrate.
Practice 1: An attacker controls 30% of mining power. How many confirmations do you need to push their success chance below 0.1%?

Raise the confirmations slider until the chance drops under 0.1%.

  1. At 30% attacker power: it takes roughly 24 confirmations, about four hours on Bitcoin.
  2. At 10% power: only about 5.

Security depends on the attacker’s share. That’s why exchanges wait for more confirmations on smaller, less secure chains.

Practice 2: An attacker sends 10,000 coins to an exchange, sells them for $50,000, and withdraws. Renting enough mining power to rewrite the chain for an hour costs $20,000. Is the attack worth it, and how could the exchange stop it?
  1. Gain: $50,000 of withdrawn money, while keeping the coins after the rewrite.
  2. Cost: $20,000 of rented power. Profit: about $30,000.
  3. Defence: if the exchange waited for more confirmations, say, two hours of blocks, the attacker would need to rent power for longer, raising the cost. Above $50,000, the attack stops paying.

That’s exactly why exchanges raised confirmation counts for Ethereum Classic after 2019.

Key takeaways

  • A blockchain is a shared ledger kept by many independent computers, with no central owner.
  • Hash-linking makes tampering visible. Digital signatures prove who may spend.
  • Consensus decides the next block: proof of work (computing) or proof of stake (staked coins at risk).
  • Rewriting history means out-pacing the honest network. With a minority of power, the odds fall fast with each confirmation. A 51% attacker wins.
  • Ethereum Classic’s 51% attacks in 2019 (about $1.1 million double-spent) and 2020 showed small chains are far easier to attack.

Go deeper

Complete this lesson
Pass the quiz below (60% or more) to earn +50 XP and unlock the next lesson.
Quiz not passed yet
🧠

Quiz: How a blockchain works

5 questions · pass 60% to complete