How Everyday Technology Works

How Blockchain Works

A neutral explanation of blockchains as shared ledgers: how blocks are chained with hashes, how participants agree, and why records are hard to alter.

On this page
  1. The basic idea: a ledger many people hold
  2. What is in a block
  3. Why it is called a chain
  4. How participants agree
  5. Public and permissioned chains
  6. Keys and signatures
  7. Where the idea appears
  8. Limits and trade-offs
  9. Key points

The basic idea: a ledger many people hold

A ledger is simply a record of entries, such as who paid whom or who owns what. Traditionally one trusted party keeps it, such as a bank or a registry office. A blockchain is a way of keeping a ledger where many separate computers each hold a copy, and a set of rules lets them agree on what the ledger says without any one of them being in charge.

This article explains the mechanism. It does not suggest that blockchains suit any particular purpose, and many tasks are handled perfectly well by an ordinary database.

What is in a block

Entries are grouped into batches called blocks. Each block typically contains:

  • a list of recorded entries (often called transactions)
  • a timestamp
  • a reference to the block that came before it
  • a number that results from a mathematical function applied to the block’s contents

That last item is a hash. A hash function takes any amount of data and produces a fixed-length string of characters that looks random. Two properties matter here. The same input always gives the same output, and changing even a tiny part of the input gives a completely different output. It is also practical to compute in one direction but not feasible to work backward from the output to find an input.

Why it is called a chain

Each block stores the hash of the previous block. That links them in order, like pages that each quote a fingerprint of the page before.

Suppose someone tries to alter an old entry. The contents of that block change, so its hash changes. The next block recorded the old hash, so it no longer matches, and the mismatch carries forward through every later block. To hide the change, the person would have to recompute the hashes of all later blocks, and also persuade the other participants to accept the rewritten version. That is the sense in which records are hard to alter. They are not impossible to change in principle, but changing them becomes obvious, and becomes harder the further back the entry lies.

How participants agree

The harder question is who gets to add the next block when no one is in charge. Every blockchain needs a consensus mechanism, a rule by which participants settle on one version of the ledger.

Two broad families are commonly described:

  • Proof of work. Participants compete to solve a computational puzzle, and the winner proposes the next block. Others can check the answer quickly. The puzzle makes it costly to propose blocks, which discourages cheating but uses a lot of computing power and electricity.
  • Proof of stake. Participants who have committed some of their own holdings as a deposit are chosen to propose and validate blocks, and they risk losing the deposit if they act dishonestly. This uses far less energy, though it has its own design debates.

In either case, if two valid blocks appear at nearly the same time, the network follows a rule, often to prefer the longer or heavier chain, and the other block is dropped. This is why entries are often treated as more settled after several further blocks have been added.

Public and permissioned chains

In a public blockchain anyone can join, read the ledger and take part in the agreement process. Because strangers are involved, the system leans on its cost-based or deposit-based rules rather than on trust.

In a permissioned blockchain a known group of organizations controls who may take part. Since the participants are identified, the agreement rules can be simpler and faster. Critics sometimes ask whether such a setup needs a blockchain at all, since a shared database with access controls might do the job.

Keys and signatures

Entries on a blockchain are authorized with digital signatures, which rely on a pair of related keys. One is private and kept secret by its owner. The other is public and can be shared. A signature made with the private key can be checked by anyone using the public key, proving that the owner approved the entry without revealing the secret. This is the same kind of mathematics described in encryption basics, applied to signing rather than hiding messages.

A consequence is that losing a private key can mean losing control of whatever it protected, with no company to call. Fraud and scams have also surrounded some blockchain-based products, so caution is wise.

Where the idea appears

Blockchains first became widely known as the technology behind some forms of digital currency. Since then, people have proposed them for tracking goods in a supply chain, recording ownership, and other shared records, with mixed results. Whether a blockchain helps in a given case depends on whether several parties who do not fully trust one another need a single shared record, and whether the costs are worth it. Everyday ways of paying, including mobile payments, mostly run on conventional systems rather than blockchains.

Limits and trade-offs

  • Speed and size. Getting many computers to agree takes time, and every participant storing the full history takes space.
  • Permanence. Records that cannot easily be changed also make mistakes and unlawful content hard to remove.
  • What it cannot check. A blockchain can show that an entry was recorded and not altered afterward. It cannot confirm that the entry was true when it was made. If wrong information goes in, it stays wrong.
  • Energy. Proof-of-work designs use substantial electricity, which is one reason alternatives were developed.

Key points

A blockchain is a list of blocks, each carrying a hash of the one before it, copied across many computers that follow a rule for agreeing on additions. The links make tampering visible and costly; the shared copies remove the need for one record keeper. Those properties are useful in some situations and unnecessary in many others.

The complete guide to how everyday technology works

How the Internet Works
Read the guide

Keep exploring

Guides from other topics

All topics →