Blockchain Fundamentals — example repository
The minimal chain built across the series: block structure, hash linking, validation and a toy consensus loop, in one runnable project.
- TypeScript
- #blockchain
- #hashing
- #consensus
Episode 01
Almost every explanation of blockchain opens with the same sentence: a blockchain is a distributed, immutable ledger. Three words, none of which mean much until you know what they are being contrasted against.
So let's start somewhere more concrete.
Four organisations need to agree on one record. Say it is a list of who currently holds which asset. Each of them could keep their own copy, but then the copies drift and there is no way to say which one is right. So somebody has to hold the authoritative copy.
Whoever holds it now has power the others do not have. They can reorder entries. They can quietly amend one. Even if they never would, the others cannot prove they did not, and in a system with real money behind it that difference matters.
The question blockchain answers is narrow and specific:
How do you keep one shared record among parties who have no reason to trust each other, without appointing one of them as the authority?
Everything else — the hashing, the blocks, the consensus algorithms — is machinery built to answer that one question.
A block is a container. It holds a batch of records, plus a small header. The header is where the interesting part lives.
index: 4812 timestamp: 2026-08-09T11:04:22Z prev_hash: 0x9f1c...a83e <- the fingerprint of block 4811 merkle_root: 0x41b7...02dd <- one fingerprint covering every record inside nonce: 1180429 hash: 0x00003b...71ac <- this block's own fingerprint
The two fields that matter are prev_hash and hash.
A hash function takes any input and produces a fixed-length fingerprint of it. The same input always gives the same fingerprint. Change one character of the input and the fingerprint changes completely and unpredictably. It is also one-way: given the fingerprint, you cannot work backwards to the input.
Each block stores the fingerprint of the block before it. That is the chain.
Suppose block 4,000 records a transfer, and somebody wants to quietly change the amount.
They edit block 4,000. Its contents change, so its own hash changes. But block
4,001 stored the old hash of block 4,000 in its prev_hash field. That field
no longer matches. So they have to update block 4,001 too — which changes block
4,001's hash, which breaks block 4,002. And so on, all the way to the tip.
The property this buys you
Tampering with any record invalidates every block after it. A single edit deep in the history is not a small local change; it is a change to everything that followed.
This is worth stating precisely, because it is where most explanations overclaim. The chain does not make the data unchangeable. Anyone holding a copy can edit their own copy freely. What the chain makes is tampering detectable: your edited copy no longer matches anyone else's, and the mismatch is trivial to spot.
Immutability is not a property of the data structure. It is a property of the data structure plus a network that keeps its own copies and refuses to accept yours.
This is the distinction that separates people who understand blockchain from people who can recite the definition.
The chain is a data structure. You could implement one in an afternoon, in any language, as a linked list where each node carries the hash of its predecessor. On its own it gives you an ordered, tamper-evident log.
What it does not give you is agreement. If two participants each append a different block at the same height, the data structure has no opinion about which one is correct. Both are internally valid. Something outside the structure has to choose.
That something is consensus, and it is where nearly all the difficulty lives. Proof of work, proof of stake, PBFT, Raft — these are all answers to the same follow-up question: when honest participants disagree, how does the network settle on one history?
Two systems, often confused
"Blockchain" in casual use means both the data structure and the network protocol that maintains it. When you read a chain's documentation, keep them apart. The structure is nearly identical across every chain in existence. The consensus is where the real design decisions were made, and where the trade-offs are.
A blockchain is an append-only sequence of batched records, where each batch carries a cryptographic fingerprint of the previous one, replicated across independent machines that run a consensus protocol to agree on which sequence is authoritative.
Every clause is doing work:
Take away the last clause and you have a tamper-evident log with no way to resolve a conflict. Take away replication and you have a log one party can rewrite at will. The properties people associate with blockchain come from the combination, not from any one part.
The obvious follow-up is the one most tutorials skip: if a shared database with signed audit logs solves most of this at a tiny fraction of the cost, when is any of the above actually worth it?
That is episode two.
Study materials
The minimal chain built across the series: block structure, hash linking, validation and a toy consensus loop, in one runnable project.
The original 2008 paper. Nine pages, and still the clearest statement of the double-spending problem and the proof-of-work answer to it.
Open resource
Continue learning
A database with an audit log is cheaper, faster and simpler than any blockchain. This is the specific set of conditions under which it stops being enough.
In this series
BlockchainEpisode 02
A database with an audit log is cheaper, faster and simpler than any blockchain. This is the specific set of conditions under which it stops being enough.
Start tutorial
Blockchain
Blockchain was not invented to be a database. It was invented to answer one question about digital money that had gone unanswered for twenty years.
Read
BlockchainEpisode 03
Follow one transaction from the moment it is signed to the moment it is final — keys, mempool, block assembly, validation and propagation, with nothing skipped.
Start tutorial