Blockchain Explained

Blockchain Explained Step by Step

A plain walkthrough of how a blockchain works: transactions, blocks, hashes, chains and why recorded history becomes hard to change without being noticed.

On this page
  1. Start with the problem: who keeps the record?
  2. Step 1: a transaction is created
  3. Step 2: transactions wait in a pool
  4. Step 3: transactions are bundled into a block
  5. Step 4: the block gets a fingerprint
  6. Step 5: blocks are chained
  7. Step 6: the network agrees
  8. What “hard to alter” does and does not mean
  9. Where blockchains fit and where they do not
  10. A short mental model

Start with the problem: who keeps the record?

Any system that tracks who owns what needs a record, usually called a ledger. Traditionally one trusted party keeps it: a bank holds account balances, a land registry holds property titles, a company holds its own customer database. Everyone relies on that party to record things correctly and not to quietly change them later.

A blockchain is a way of keeping a ledger without one party in charge. Many computers each hold a copy, and they follow shared rules to agree on what gets added. The design is aimed at one thing in particular: making it hard to alter past entries without everyone else noticing.

Step 1: a transaction is created

A transaction is a small instruction such as “move this amount from person A to person B.” In most systems the sender signs it with a secret value that only they hold, which proves they authorized it. How that signing works is the subject of public key cryptography, and the tools people use to hold those secrets are covered under digital wallets.

The signed transaction is sent out to the network rather than to a single server.

Step 2: transactions wait in a pool

Computers on the network, often called nodes, receive the transaction and check basic things: is the signature valid, is the format correct, and does the sender actually have what they are trying to send? Valid transactions wait in a holding area until someone includes them in a block.

Step 3: transactions are bundled into a block

A block is simply a batch of transactions plus a little bookkeeping information. The bookkeeping includes a timestamp and a reference to the block that came before it. Think of a page in a ledger book: a list of entries, a date, and a note saying which page precedes it.

Step 4: the block gets a fingerprint

This is the part that makes the structure useful. The contents of the block are run through a cryptographic hash function, which produces a short, fixed-length fingerprint. Change even one character of the block and the fingerprint changes completely. The details are covered in the article on cryptographic hashes, but the key property is simple: the fingerprint identifies the exact contents.

Step 5: blocks are chained

Each new block includes the fingerprint of the previous block. That is the “chain.” Block 100 contains the fingerprint of block 99, which was computed from contents that included the fingerprint of block 98, and so on back to the first block.

Now consider what happens if someone edits an old transaction in block 50:

  1. Block 50’s contents change, so its fingerprint changes.
  2. Block 51 stored the old fingerprint of block 50, so it no longer matches.
  3. To hide the edit, the person would need to recompute block 51, which changes its fingerprint, which breaks block 52, and so on to the latest block.

On its own that rework is only tedious, not impossible. The next step is what turns tedious into impractical.

Step 6: the network agrees

Because many independent participants hold copies, an altered copy would simply disagree with everyone else’s. The network needs a rule for deciding which version of history is the real one and who gets to add the next block. These rules are called consensus mechanisms, and different blockchains use different ones. Some make adding a block costly in computing work, some require participants to lock up value as a stake, and some rely on a known, fixed group of validators.

Once a block is accepted and several more are built on top of it, rewriting it would mean redoing all that later work faster than the rest of the network keeps adding to the honest chain. In a large public network this is generally considered impractical, though not logically impossible, and the exact level of safety depends on the design and size of the network.

What “hard to alter” does and does not mean

Blockchains are tamper-evident and tamper-resistant, which is not the same as always correct. A few clarifications:

  • The chain protects records after they are written. It cannot tell whether the information entered was true in the first place.
  • Records are usually permanent, so mistakes are permanent too.
  • Security depends on how the network is designed and how widely it is distributed. A small network with few participants is easier to attack than a large one.

Several widespread beliefs about the technology go beyond what it actually does; the article on blockchain myths goes through them.

Where blockchains fit and where they do not

Sharing a ledger among parties who do not fully trust each other is the situation blockchains handle best. Tracking goods through many companies is one proposed use, discussed in supply chain tracking, and some projects explore digital identity. Whether a blockchain actually beats an ordinary database in these cases varies, and it often does not. If one organization controls the data and everyone trusts it, a normal database is typically simpler, faster and cheaper.

Trade-offs are real. Replicating data across many computers and agreeing on it takes time and resources, which is the topic of blockchain scalability. Networks can also be open to anyone or restricted to approved members, a choice explained under private blockchains. Some systems add programs that run on the ledger itself, known as smart contracts, which bring their own risks.

A short mental model

Picture a notebook copied across a thousand desks. Each page is stamped with a fingerprint of its contents and also copies the previous page’s stamp. Everyone follows a rule for who may add the next page. To change an old line, a cheater would have to redo every stamp after it on a majority of the desks at once. That, in short, is why a blockchain’s history is hard to rewrite quietly.

Keep exploring

Guides from other topics

All topics →