No hype, no price talk. A blockchain is a data structure plus a consensus protocol — you already know most of the pieces. This walks the stack from hash functions up to why mining exists at all.
Strip away everything else and a blockchain is an append-only singly linked list. The twist: instead of pointing to the previous node by memory address or ID, each block stores the cryptographic hash of the previous block's entire contents.
// A blockchain node, conceptually interface Block { index: number; timestamp: number; data: Transaction[]; // the payload prevHash: string; // the "pointer" — SHA-256 of previous block nonce: number; // matters for mining (section 03) hash: string; // SHA-256 of everything above }
This one design choice gives you tamper evidence. Change one byte in block N and its hash changes — which breaks the prevHash stored in block N+1, which changes its hash, and so on. Corruption cascades forward and is trivially detectable.
Everything rests on the hash function being deterministic, fast, one-way, and avalanche-sensitive — a one-bit input change scrambles the whole output. Try it (this runs real SHA-256 via crypto.subtle):
Below is a 4-block chain. Edit the data in Block 1 and watch every downstream block invalidate, because each block's stored prevHash no longer matches its predecessor's recomputed hash.
The chain above detects tampering, but nothing stops an attacker from just recomputing all the downstream hashes after editing a block. On a single machine, that takes microseconds. A hash-linked list alone is integrity-checking, not security.
The real problem blockchains solve is harder: thousands of mutually distrusting nodes, no central authority, all needing to agree on one canonical history — while some participants actively lie. This is Byzantine fault tolerance. Classic consensus algorithms (Paxos, Raft) assume you know who the participants are. A public blockchain can't: anyone can join, and one attacker can spin up a million fake nodes (a Sybil attack), so "majority vote by node count" is meaningless.
Bitcoin's 2008 insight: make votes cost something outside the system. Instead of one-node-one-vote, it's one-CPU-cycle-one-vote. That's mining.
To append a block, a miner must find a nonce — a throwaway number included in the block — such that the block's hash falls below a target value (in practice: starts with N zeros). Hash output is effectively random, so the only strategy is brute force:
while (true) { block.nonce++; if (sha256(block).startsWith("0".repeat(difficulty))) break; }
Key asymmetry: finding the nonce takes billions of attempts; verifying it takes one hash. Run it yourself — each extra zero of difficulty multiplies expected work by 16 (one hex digit):
Notice that bumping difficulty from 4 to 5 makes it take ~16× longer. Bitcoin auto-tunes difficulty every 2016 blocks so one block lands roughly every 10 minutes regardless of how much hardware joins the network. Current Bitcoin difficulty requires ~19+ leading hex zeros — hence warehouse-scale ASIC farms.
A cryptocurrency isn't a file or token object anywhere. "Owning 5 BTC" means the shared ledger's transaction history nets out to 5 BTC spendable by your key. Three pieces make that work:
An "account" is an asymmetric keypair. Your address is derived from the public key; spending means signing a transaction with the private key. There's no password reset because there's no server — the private key is the account. A wallet is just key management software; coins never leave the chain.
Two dominant models, worth knowing as a developer:
| model | used by | mental model |
|---|---|---|
| UTXO | Bitcoin | Like cash. Each transaction consumes unspent outputs and creates new ones. Your balance is a derived value — the sum of UTXOs your key can unlock. Highly parallelizable validation. |
| Account | Ethereum | Like a database of balances. Transactions mutate account state directly. Simpler to reason about; enables smart contracts (code + state living at an address, executed deterministically by every node). |
This closes the loop elegantly: the block reward is how new coins enter circulation and how miners get paid for securing the network. Monetary policy is code — Bitcoin's reward halves every 210,000 blocks, capping supply at 21M. Security budget and money supply are the same mechanism.
As an architecture, a public blockchain is a spectacularly expensive database: every node stores everything, every node executes everything, and consensus throughput is tiny (Bitcoin ~7 TPS, Ethereum L1 ~15–30 TPS vs. Postgres at tens of thousands). You pay that cost for exactly one property: no trusted operator.
| requirement | reach for |
|---|---|
| One org controls writes | Postgres. Done. |
| Need audit trail / tamper evidence | Append-only log + signed hash chain (or Git). No consensus needed. |
| Multiple known orgs, low mutual trust | Maybe a permissioned ledger — though a shared DB + legal contracts usually wins. |
| Open participation, adversarial, no authority possible | This is the actual blockchain use case: public money, censorship-resistant settlement. |
The litmus test: if you can name who should administer the database, you don't need a blockchain. The technology only earns its overhead when "who do we trust to run it?" has no acceptable answer.