Crypto · How blockchains work
How a blockchain works: blocks, hashes and nodes
What a blockchain stores, how hashes chain blocks together and why thousands of nodes keep the same ledger, shown with a toy chain you can recompute.
On this page
A blockchain is a record of transactions that many computers keep at once, built so that old entries cannot be changed without everyone noticing. It does the job a bank's database does for account balances, with one difference that explains everything else about it: no single organization holds the master copy.
That design answers a narrow question. If two strangers want to move digital money and neither trusts a middleman, who keeps the books? A blockchain's answer is "everyone, and the software makes their copies agree". The cost of that answer is speed and convenience, which is why a blockchain is a poor replacement for an ordinary database and a good fit for a small set of problems where no trusted record keeper exists.
This lesson builds a three-block chain from scratch with real hashes, changes one entry, and shows what breaks. Once that picture is clear, the terms that follow in this section (mining, staking, confirmations, forks) are variations on it.
What a blockchain stores
Start with the thing being recorded. A blockchain is a list of transactions: "this address sends this amount to that address", each one signed by the sender's private key (see Public and private keys: how crypto ownership works). Nothing else is needed to work out who owns what. A balance is not stored as a number that gets overwritten, the way a spreadsheet cell is. It is the result of replaying every transaction since the first.
Transactions are grouped into blocks. A block has two parts:
- a body, the list of transactions it contains; and
- a header, a short summary. In bitcoin the header has six fields: a version number, the hash of the previous block's header, a single hash that summarizes all the transactions in the body (the Merkle root), a timestamp, the difficulty target, and a number called the nonce that miners vary.
The second field does the chaining. Every block names its parent by hash, the parent names its own parent, and so on back to the first block, which has no parent and is called the genesis block. Bitcoin's was created on January 3, 2009.
A new block is added at a steady pace set by the rules: about every ten minutes on bitcoin, every twelve seconds on Ethereum. The count of blocks since the first is the block height.
Hashes: the tool that makes it work
A hash function takes any data and returns a fixed-length string that acts as its fingerprint. Bitcoin uses SHA-256, a public standard published by the US National Institute of Standards and Technology. Its output is always 256 bits, written as 64 hexadecimal characters, whether the input is one letter or a whole library.
Three properties matter:
- The same input always gives the same output. Anyone can check a hash by recomputing it.
- A tiny change in the input changes the output completely, in a way that cannot be predicted.
- It runs one way. Given a hash, there is no practical method to find an input that produces it other than trying inputs one after another.
A worked example you can recompute
Take a toy chain where each block's hash is the SHA-256 of the text
<height>|<previous hash>|<entry>. The first block has no parent, so its "previous hash"
is 64 zeros.
| Block | Entry | Hash (first 8 … last 6 characters) |
|---|---|---|
| 1 | Ana pays Ben 5 | c6ba29c5…1a0c43 |
| 2 | Ben pays Cal 2 | c24a1fcf…413223 |
| 3 | Cal pays Dee 1 | 4f7a3466…8fda9a |
Block 2's hash was computed over block 1's full hash, and block 3's over block 2's. Now suppose someone edits the first entry from 5 to 50 and changes nothing else.
| Block | Entry | Hash after the edit |
|---|---|---|
| 1 | Ana pays Ben 50 | c30ed5ea…deafab |
| 2 | Ben pays Cal 2 | dcb7b83c…907a6f |
| 3 | Cal pays Dee 1 | 2ae568a9…aa34cd |
Adding one character to block 1 flipped 131 of the 256 bits in its hash, 51.2%, which is what a good hash function should do: about half, with no pattern. Blocks 2 and 3 contain exactly the same entries as before, and their hashes changed anyway, because the parent hash they include changed.
This is the whole idea of tamper evidence. Anyone holding the original hash of block 3, a single 64-character string, can detect a change to any earlier entry. They do not need to compare the entries one by one.
Summarizing thousands of transactions in one hash
A real block holds thousands of transactions, not one line. They are summarized by hashing them in pairs, then hashing the results in pairs, and repeating until one hash is left. That final hash is the Merkle root, and it goes in the header.
The benefit is that a single transaction can be proven to be in a block by supplying only the handful of hashes on its branch. For a block of 4,000 transactions that is 12 hashes, since 2 to the power of 12 is 4,096. Light wallets on phones rely on this: they download headers, which are 80 bytes each in bitcoin, and ask for branches when they need them.
Nodes: who keeps the copies
A node is a computer running the network's software. A full node downloads every block since the genesis block, checks each one against the rules, and keeps its own copy of the ledger. Nodes are connected to a few peers each, and pass along new transactions and blocks, so news spreads across the network in seconds without any central server.
The checks are mechanical. Is every signature valid? Does the sender own the coins being spent, and have they been spent already? Is the block the right size, does it point to a known parent, and does it meet the rule for who may add a block (see Proof of work vs proof of stake: how they differ)? A node that receives a block failing any check discards it and does not pass it on. It makes no difference how powerful the producer is.
This is what "decentralized" means in practice. The rules are enforced by every node separately. A block producer can choose which valid transactions to include and in what order, but cannot create coins beyond the schedule, spend someone else's coins, or change history, because the nodes of exchanges, merchants and ordinary users would reject the block.
Three kinds of participant are easy to confuse:
| Participant | What it does | Holds the full ledger |
|---|---|---|
| Full node | Checks every block and transaction, relays them | Yes |
| Block producer (miner, validator) | Builds new blocks and earns the reward | Yes |
| Light wallet | Holds keys, checks headers, asks nodes for the rest | No |
Running a node does not earn anything. People and businesses run them to verify their own payments without trusting anyone else's copy.
Why history is hard to rewrite
The toy example showed that an edit is detectable. Detectable is not the same as impossible: a forger could simply recompute the hashes of blocks 1, 2 and 3 after the edit, which takes a laptop a fraction of a millisecond.
Real chains close that gap by making blocks costly to produce. In bitcoin, a block is valid only if its hash falls below a target, which takes the whole network about ten minutes of trial and error to achieve. To rewrite a transaction six blocks deep, a forger has to redo that work for six blocks and then keep producing blocks faster than everyone else combined, because nodes follow the chain with the most work behind it. How a blockchain reaches agreement: consensus explained works through the odds.
So the security of an old transaction comes from two things together: the hash links, which mean one change forces a rebuild of everything after it, and the cost of building blocks, which makes the rebuild impractical. Neither is enough alone.
What a blockchain cannot do
- It cannot check facts from outside itself. The ledger knows that a token moved. It does not know whether the house, the dollar or the gold bar that the token is said to represent exists. That link depends on a company or a legal system.
- It cannot undo mistakes. There is no help desk. Coins sent to a wrong address, or to a scammer, cannot be pulled back by the network. Crypto wallets and custody: keys, seed phrases, hot and cold storage covers what that means for holding coins.
- It is slow and small by design. Every node stores and checks everything, so capacity is limited to what an ordinary computer can keep up with. Bitcoin settles a handful of transactions a second. Layer 2 networks: rollups, Lightning and how they scale explains the workarounds.
- It is public. Every transaction is visible to anyone, forever. Addresses are not names, but once an address is tied to a person (by an exchange's records, for example) their history can be traced.
- The rules can change. The software is maintained by people, and a network can adopt new rules if enough of its participants agree. See Hard forks and soft forks: how blockchains change their rules.
A chain is also only as independent as its participants. One with a few dozen block producers run by related companies has the data structure described here without the property that makes it useful.
Blockchain compared with an ordinary database
| Bank or broker database | Public blockchain | |
|---|---|---|
| Who keeps the record | One organization | Every full node |
| Who can write | The organization's staff and systems | Anyone who follows the rules and pays the fee |
| Who can read | The organization, regulators, you | Anyone |
| Fixing an error | Reversed by the organization | Not possible; a new transaction is needed |
| Speed | Thousands of entries a second | A few to a few thousand, depending on design |
| What you must trust | The organization and its regulators | The software, the math, and an honest majority |
| Protection if it fails | Deposit insurance, SIPC, courts | None built in |
Neither column is better in general. The right-hand one removes the need to trust a company, and it also removes everything a trusted company provides.
How Finabase does it
Finabase shows market data for coins, not the chains themselves. The crypto list ranks coins with price, market value, supply and returns, and each coin has a quote page such as BTC.X with a chart and news. Block heights, transaction lookups, fee levels and wallet balances are not shown anywhere on Finabase. For those you need a block explorer, a public website that reads a node's copy of the ledger.
The hashes in this lesson were computed by the script that draws its figures, with the
standard SHA-256 function in Node.js. To check one, hash the text
1|0000000000000000000000000000000000000000000000000000000000000000|Ana pays Ben 5 (the
zeros are 64 characters) with any SHA-256 tool. The result begins c6ba29c5.
Frequently asked questions
Is a blockchain the same thing as bitcoin?
No. Bitcoin is one network that uses a blockchain, and it was the first. Ethereum, Solana and thousands of others run their own chains with their own rules, and companies also run private ones. See What is bitcoin? How it works, its supply cap and its price history for bitcoin itself.
Can a blockchain be hacked?
The ledger of a large chain has not been rewritten by an attacker, because the cost is too high. Almost all losses happen around the chain: stolen private keys, flawed programs running on the chain, failed exchanges and scams. Small chains with little mining power or stake are far cheaper to attack than large ones.
Who controls a blockchain?
No single party controls a widely distributed chain. Developers write the software, block producers build blocks and node operators decide which software to run. A rule change needs the three groups to go along with it, which is why changes to bitcoin are rare and slow.
Where is the blockchain stored?
On the disks of every full node. Bitcoin's full history is roughly 740 gigabytes by bitcoin.org's count and fits on a consumer drive, which is deliberate: the smaller the ledger, the more people can afford to check it themselves.
What is a block explorer?
A block explorer is a website that lets anyone search a chain by address, transaction or block. It reads the same public data every node holds. It is the standard way to confirm that a payment arrived and how many blocks have been added since.
Summary
A blockchain is a ledger of signed transactions, grouped into blocks that each carry the hash of the block before. Because a hash changes completely when its input changes, an edit to any old entry breaks every later link, and because blocks are costly to produce, rebuilding those links faster than the rest of the network is impractical. Thousands of nodes each keep the full record and reject anything that breaks the rules, so no company has to be trusted to keep the books. The price of that design is low capacity, full public visibility and no way to reverse an error.
Check your understanding
5 questions on this lesson. Each answer comes with the reason, and nothing is scored.
In a blockchain, what links one block to the block before it?
- Each block stores the hash of the previous block’s header
- Each block stores a copy of every earlier transaction
- A central server keeps a list of the order
Show the answer
A. Each block stores the hash of the previous block’s header The header carries the parent’s hash. Because that hash depends on everything in the parent, the link also commits to the parent’s contents.
Someone changes one transaction in a block that is 100 blocks old. What happens to the hashes?
- Only that block’s hash changes
- That block’s hash and the hash of every block after it change
- Nothing changes unless the amount is large
Show the answer
B. That block’s hash and the hash of every block after it change The edited block gets a new hash, so the next block, which includes that hash, also changes, and so on to the newest block.
A powerful block producer creates a block that pays itself twice the allowed reward. What do full nodes do?
- Accept it, because the producer did the work
- Accept it if most other producers agree
- Reject it, because it breaks a rule every node checks
Show the answer
C. Reject it, because it breaks a rule every node checks Each node enforces the rules for itself. A block that creates extra coins is invalid whoever made it, and nodes neither store it nor pass it on.
Why are the hash links alone not enough to stop history being rewritten?
- Hashes can be reversed with enough computing power
- Recomputing a chain of hashes is cheap unless producing a block is made costly
- Nodes do not check hashes
Show the answer
B. Recomputing a chain of hashes is cheap unless producing a block is made costly A forger can recompute plain hashes instantly. It is the cost of producing each valid block, added to the links, that makes a rewrite impractical.
You send coins to the wrong address on a public blockchain. Who can reverse it?
- The network’s support team
- Any full node operator
- Nobody, unless the person who controls that address sends them back
Show the answer
C. Nobody, unless the person who controls that address sends them back There is no party with the power to edit the ledger. Only the holder of the receiving address’s private key can move those coins.
Sources and further reading
- Satoshi Nakamoto — Bitcoin: A Peer-to-Peer Electronic Cash System (2008), sections 2 to 5 and 7
- Bitcoin developer guide — Block chain (block headers, Merkle roots, proof of work)
- Bitcoin developer reference — Block headers (the six header fields)
- NIST FIPS 180-4 — Secure Hash Standard (SHA-256)
- Bitcoin.org — Running a full node (blockchain size, read November 18, 2026)
- Ethereum.org — Nodes and clients
- Toy chain on this page — SHA-256 computed by Finabase with Node.js; inputs printed in the text so the hashes can be recomputed
