Blockchain 📂 Introduction · 5 of 5 39 min read

Bitcoin Architecture — Transactions, UTXO, Mining, Halving & the Network

A deep dive into how Bitcoin actually works. Covers the layered architecture, how transactions consume and create UTXOs, the UTXO accounting model versus account balances, Bitcoin Script locks, block structure and the 80-byte header, the Genesis Block story, the mining race and proof-of-work, coinbase transactions that mint new coins, difficulty adjustment keeping 10-minute blocks, the four-year halving to 21 million, and the P2P node network.

Section 01

Bitcoin Architecture — The Machine With No Owner

The Global Stone Ledger Of Yap Island
On the Pacific island of Yap, wealth was measured in giant stone discs called Rai, some too heavy to move. When a stone changed owners, nobody carried it — the whole village simply agreed out loud that "this stone now belongs to Ravi." Everyone remembered. The ledger lived in the collective memory of the community, not in any single vault.

Bitcoin is the digital Rai stone. No coin ever physically moves. Instead, a worldwide network of computers agrees on who owns what, and writes that agreement into an unchangeable public record. There is no central bank, no CEO, no server room you could raid. Bitcoin is architecture without an architect-in-charge — a machine that runs itself.

Bitcoin's architecture is a carefully layered stack: a peer-to-peer network of nodes, a ledger of blocks, the UTXO accounting model, Bitcoin Script for spending conditions, and mining to secure it all. This tutorial dissects every layer, from a single transaction to the Genesis Block, halvings, and the global network.

Diagram — Bitcoin's Layered Architecture
Application — Wallets, Exchanges, Explorers what humans touch Script — Spending conditions & validation the lock on every coin Ledger — Blocks, UTXO set, Merkle trees the accounting layer Consensus — Proof-of-Work mining who writes the next block Network — P2P nodes gossiping worldwide ~15,000 reachable nodes
Five layers stacked from the network wires at the bottom to the wallet apps at the top. Each layer trusts only the math of the one below it.

Section 02

Bitcoin Transactions — Moving Value Without Moving Coins

A Bitcoin transaction does not "move" a coin like handing over cash. Instead, it consumes existing chunks of value (inputs) and creates new chunks (outputs). Every input points back to an earlier output that has not yet been spent. Think of it as tearing up old cheques and writing new ones.

Animated Diagram — Anatomy Of A Transaction (Inputs → Outputs)
INPUTS (spent) UTXO #1 0.3 BTC UTXO #2 0.5 BTC TX 0.8 BTC in OUTPUTS (new) To Bob 0.75 BTC Change to Alice 0.049 BTC Fee to miner: 0.001 BTC inputs (0.8) = outputs (0.799) + fee (0.001) — nothing vanishes
Alice combines two UTXOs worth 0.8 BTC to pay Bob 0.75. The leftover 0.049 returns to her as "change," and 0.001 goes to the miner as a fee.
💰
The Change Address — Why Wallets Create New Addresses

Inputs must be spent entirely. If you have a 0.8 BTC chunk but only want to send 0.75, the remaining 0.05 (minus the fee) is sent back to you as change — usually to a brand-new address your wallet generates automatically. This is why your Bitcoin balance is scattered across many addresses, and why reusing addresses hurts your privacy.


Section 03

The UTXO Model — Bitcoin's Accounting System

Bitcoin does not track account balances the way a bank does. Instead it tracks Unspent Transaction Outputs (UTXOs) — discrete, indivisible chunks of Bitcoin, each locked to an owner. Your "balance" is simply the sum of all UTXOs your keys can unlock, like the total of all the coins and notes scattered in your pockets.

🏦 Account Model (Ethereum, Banks)
One running balance per account
Alice: 1.2 BTC (a single number)
Send = subtract from balance
Simple, but harder to parallelize
🪙 UTXO Model (Bitcoin)
Many discrete unspent chunks
Alice: 0.3 + 0.5 + 0.4 = 1.2 BTC
Send = consume chunks, make new ones
Better privacy & parallel checking
Animated Diagram — UTXOs Are Like Physical Cash
Alice's Wallet (UTXO set) 0.3 0.5 0.4 Total spendable = 1.2 BTC Pay Bob 0.6 BTC Bob 0.6 change 0.199 0.4 ← untouched UTXO stays The 0.3 and 0.5 coins are destroyed; two new coins (0.6 to Bob, 0.199 change) are born. The 0.4 coin is never touched.
Like paying a $6 bill with a $5 and a $1 and getting change, Bitcoin consumes whole UTXOs and creates new ones. A UTXO can never be partially spent.
Why UTXO Prevents Double-Spending

Each UTXO can only be spent once. The moment it is used as an input, every node marks it "spent" and removes it from the UTXO set. If you try to spend the same UTXO twice, the second transaction references something that no longer exists — and the network instantly rejects it. No central checker needed; the model itself makes double-spending impossible.


Section 04

Bitcoin Script — The Lock On Every Coin

Every UTXO is guarded by a small program written in Bitcoin Script — a simple, deliberately non-Turing-complete (no loops) stack language. To spend a coin, you must provide an input that makes its locking script evaluate to TRUE. The most common lock is "prove you own the private key for this address."

Animated Diagram — ScriptSig + ScriptPubKey = Unlock
scriptSig <signature> <publicKey> scriptPubKey OP_DUP OP_HASH160 <hash> OP_EQUALVERIFY OP_CHECKSIG TRUE 🔓 unlocked provided by spender attached to the coin
The coin's locking script (scriptPubKey) and the spender's unlocking script (scriptSig) run together on a stack. If the result is TRUE, the coin is spent.

Here is the classic Pay-to-Public-Key-Hash (P2PKH) script that guards most Bitcoin. The spender pushes their signature and public key; the locking script verifies both:

# scriptSig (unlocking) — provided by the spender
<signature> <publicKey>

# scriptPubKey (locking) — attached to the UTXO
OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

# Combined execution on the stack:
# 1. Push signature and public key
# 2. OP_DUP        -> duplicate the public key
# 3. OP_HASH160    -> hash it to get pubKeyHash
# 4. OP_EQUALVERIFY -> must match the address's hash
# 5. OP_CHECKSIG   -> signature must be valid  -> TRUE
🔑
P2PKH
standard payment
"Pay to whoever owns this address." The everyday lock protecting ordinary wallet payments.
👥
Multisig
M-of-N keys
"Requires 2 of 3 signatures to spend." Used by companies and custodians for shared control of funds.
Timelocks
OP_CHECKLOCKTIMEVERIFY
"Cannot be spent until block 900,000." Powers escrow, inheritance, and the Lightning Network.
💡
Why Bitcoin Script Has No Loops (On Purpose)

Unlike Ethereum's Turing-complete contracts, Bitcoin Script deliberately cannot loop. This means a script always finishes in predictable time and can never hang a node with an infinite loop. It sacrifices flexibility for rock-solid safety — a very Bitcoin trade-off: do less, but do it bulletproof.


Section 05

Block Structure — What's Inside A Block

A Bitcoin block has two parts: a tiny 80-byte header that miners hash, and a body containing all the transactions (up to ~4 MB with SegWit). The header is the security-critical part — it links to the previous block, commits to all transactions via the Merkle root, and holds the nonce.

Diagram — The 80-Byte Block Header
BLOCK HEADER (80 bytes) Version 4 bytes — rule set Previous Block Hash 32 bytes — the "chain" link Merkle Root 32 bytes — all txs summarized Timestamp 4 bytes — Unix time Difficulty Target (Bits) 4 bytes — how hard to mine Nonce 4 bytes — miner's dial BLOCK BODY Coinbase tx + up to ~3,000 regular transactions (this is what the Merkle root summarizes)
The header is only 80 bytes but contains everything needed to secure the block. The body holds the actual transactions, summarized by the Merkle root.

Section 06

The Genesis Block — Where It All Began

"Chancellor On Brink Of Second Bailout For Banks"
On 3 January 2009, Satoshi Nakamoto mined block #0 — the Genesis Block. Hidden inside its coinbase transaction was a line of text: "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks."

It was the front-page headline of that day's London Times — both a timestamp proving the block wasn't pre-mined, and a political statement about the broken banking system Bitcoin was built to replace. The 50 BTC reward in that block can never be spent, encoded that way in the original software. It sits untouched to this day.
🌱 Facts About Block #0
Date
Mined 3 January 2009 at 18:15:05 UTC. Its timestamp is hardcoded into every Bitcoin node on Earth.
Reward
50 BTC — but uniquely unspendable due to a quirk in how the original code registered it.
Prev Hash
All zeros — there is no block before it. The chain starts here.
Gap
The next block (#1) wasn't mined until 6 days later, on 9 January 2009, hinting Satoshi spent time testing before going public.

Section 07

The Mining Process — Securing The Chain

Mining is the competitive process that adds new blocks and secures Bitcoin. Miners collect pending transactions, assemble a candidate block, and race to find a nonce that makes the block header hash fall below the difficulty target. The winner earns the block reward. This "proof-of-work" makes rewriting history astronomically expensive.

Animated Diagram — The Mining Race
MEMPOOL pending txs Miner A ⛏️ Miner B ⛏️ Miner C ⛏️ B WINS! found nonce NEW BLOCK First to find a valid nonce wins the reward; everyone else moves to the next block.
Thousands of miners hash the same candidate block in parallel. On average, one wins roughly every 10 minutes and broadcasts the new block to the network.
🔐
Why Mining Secures Bitcoin

To rewrite a past transaction, an attacker would need to re-mine that block and every block after it — faster than the entire honest network combined. This requires controlling over 51% of global mining power, costing billions in hardware and electricity. The economic cost of attacking exceeds any possible gain. Security through raw energy.


Section 08

The Coinbase Transaction — Minting New Bitcoin

The very first transaction in every block is special: the coinbase transaction (unrelated to the exchange of the same name). It has no inputs — it creates brand-new Bitcoin out of nothing and pays it to the winning miner. This is the only way new Bitcoin enters existence.

🏷️ What The Coinbase Transaction Contains
Block Subsidy
Freshly minted coins. Started at 50 BTC in 2009, now 3.125 BTC after four halvings.
Transaction Fees
The sum of all fees from the transactions the miner included. As the subsidy shrinks over decades, fees become the main reward.
Coinbase Data
A free-text field (like Satoshi's newspaper headline). Miners often embed their pool name or short messages here.
Maturity
Coinbase rewards cannot be spent until 100 blocks (~17 hours) later — a safeguard against chain reorganizations.
💰
Total Miner Reward = Subsidy + Fees

In 2026, a miner who wins a block earns roughly 3.125 BTC in new coins plus whatever fees the ~3,000 included transactions paid — often another 0.1–0.5 BTC. During congestion, fees can spike dramatically, briefly making the fee reward larger than the subsidy.


Section 09

Difficulty Adjustment — Keeping 10-Minute Blocks

As more miners join, blocks would be found faster — so Bitcoin automatically makes mining harder to compensate. Every 2,016 blocks (about two weeks), the network recalculates the difficulty target so that the average block time stays locked at ~10 minutes, no matter how much mining power exists.

Animated Diagram — The Self-Correcting Difficulty Loop
More miners join hash power ↑ Blocks come faster < 10 min avg Difficulty rises every 2,016 blocks Back to ~10 min equilibrium restored A negative feedback loop that self-corrects every ~2 weeks — no human intervention.
If blocks are mined too fast, difficulty rises; too slow, it falls. This feedback loop has kept Bitcoin's heartbeat at ~10 minutes for over 15 years.
📈
The Formula

New Difficulty = Old Difficulty × (2 weeks / actual time for last 2,016 blocks). If the last 2,016 blocks took only 10 days instead of 14, difficulty jumps ~40% to slow things back down. Adjustments are capped at a 4× change per period to prevent wild swings.


Section 10

The Halving — Bitcoin's Programmed Scarcity

Roughly every four years (every 210,000 blocks), the block subsidy is cut in half. This "halving" steadily reduces the rate of new Bitcoin creation until, around the year 2140, the last satoshi is mined and the supply caps forever at 21 million BTC. Scarcity is not a policy — it is written in the code.

Diagram — The Halving Schedule (Subsidy Over Time)
BTC Year → 50 2009 25 2012 12.5 2016 6.25 2020 3.125 2024 Each halving cuts new supply in half — asymptotically approaching 21 million total
The block reward halves every ~4 years: 50 → 25 → 12.5 → 6.25 → 3.125 BTC. This geometric decay guarantees a hard cap of 21 million coins.
HalvingYearBlock HeightReward
Genesis era2009050 BTC
1st Halving2012210,00025 BTC
2nd Halving2016420,00012.5 BTC
3rd Halving2020630,0006.25 BTC
4th Halving2024840,0003.125 BTC
Final coin~2140~6,930,0000 (fees only)
💎
Why Halvings Matter Economically

Halvings cut the flow of new supply in half overnight while demand often keeps rising. Bitcoin's most dramatic bull runs have historically followed halving events. Whether or not that pattern continues, the halving is what makes Bitcoin disinflationary — its issuance rate only ever falls, unlike fiat currencies that can be printed without limit.


Section 11

The Bitcoin Network — Nodes That Keep It Honest

Bitcoin runs on a global peer-to-peer network of roughly 15,000 reachable full nodes. Each node independently stores the entire blockchain, validates every transaction and block against the rules, and relays valid data to its peers. No node is in charge — the rules are enforced by everyone, everywhere, simultaneously.

Animated Diagram — Gossip Propagation Across The Network
TX One transaction ripples to the whole network in seconds
A new transaction is "gossiped" from node to node. Within a few seconds, virtually every node on Earth has seen and validated it. No central server relays anything.
🖥️
Full Node
the rule enforcers
Stores the entire ~600 GB chain, validates everything independently. Rejects any block or tx that breaks the rules — even from miners.
⛏️
Mining Node
the block producers
A full node that also races to mine new blocks. Provides the hash power that secures the chain against attacks.
📱
Light (SPV) Node
the lightweight clients
Stores only block headers and uses Merkle proofs. Runs on phones. Trusts full nodes for data but verifies proofs cryptographically.
🌐
Why Full Nodes Are Bitcoin's True Power

Miners produce blocks, but full nodes decide what's valid. If miners tried to change the rules (say, print extra coins), every full node would reject their blocks as invalid. This is why anyone running a node — even on a cheap Raspberry Pi — is part of what keeps Bitcoin honest and decentralized. The power lies with the users, not the miners.


Section 12

Golden Rules — Bitcoin Architecture

🔑 Non-Negotiable Truths
1
Coins never move — ownership records change. A transaction consumes old UTXOs and creates new ones. Inputs must always equal outputs plus the fee.
2
UTXOs are indivisible chunks. You can't partially spend one; you consume it whole and receive change. Your balance is just the sum of your spendable UTXOs.
3
Every coin is locked by a Script. To spend it you must satisfy its conditions. Bitcoin Script has no loops — predictable and safe by design.
4
The 80-byte header secures the whole block. It links to the previous block, commits to all txs via the Merkle root, and holds the nonce miners hunt for.
5
The coinbase transaction is the only source of new Bitcoin. It has no inputs and pays the miner the subsidy plus all transaction fees.
6
Difficulty self-adjusts every 2,016 blocks to hold block time at ~10 minutes, no matter how much hash power joins or leaves.
7
The halving enforces scarcity. Every ~4 years the subsidy halves, capping supply at 21 million BTC around 2140. Issuance can only ever fall.
8
Full nodes, not miners, enforce the rules. Miners propose blocks; nodes decide what's valid. Running a node is how ordinary users keep Bitcoin decentralized.
You have completed Introduction. View all sections →