How Bitcoin Works
Understanding Bitcoin and Cryptocurrencies: A Step-by-Step Introduction
1. From Communal Ledger to Digital Currency
The core question: What does it mean to have a Bitcoin? Bitcoin is a fully digital currency with no central government or bank to issue it, manage accounts, or verify transactions. Its inventor remains unknown. To understand Bitcoin, it helps to imagine inventing your own version from first principles — starting with a simple communal ledger and progressively adding cryptographic tools to remove the need for trust. The result is a cryptocurrency: a decentralized, trustless system for digital payments. Bitcoin was the first implemented cryptocurrency; thousands now exist.
Cryptocurrency: A digital currency that uses cryptography to secure transactions, control the creation of new units, and verify transfers without a central authority.
The journey begins with a communal ledger shared among friends. Everyone can view the ledger and add lines recording payments (e.g., "Alice pays Bob 20"). At the end of each month, participants settle up in cash: those who spent more than they received contribute money; those who received more take money out. This simple protocol has a critical flaw: anyone can add any transaction, so how do we prevent forgery?
2. Digital Signatures: Proving Ownership
To ensure that only the sender authorizes a payment, we introduce digital signatures. Like handwritten signatures, a digital signature proves that the sender has seen and approved a specific transaction. Unlike handwritten signatures, a digital signature changes with each message, making it impossible to copy and reuse on another transaction.
Each user generates a public key - private key pair.
The private key (SK) is kept secret; only the owner knows it.
The public key (PK) is shared openly; anyone can use it to verify signatures.
To sign a transaction, Alice uses a function that depends on both the message (the transaction details) and her private key. The output is a unique signature — a string of bits (commonly 256 bits).
To verify, anyone can use a second function that takes the message, the signature, and Alice's public key, and outputs true or false.
It is computationally infeasible to forge a signature without knowing the secret key. The only strategy is brute-force guessing, and there are 2256 possible 256-bit signatures — an astronomically large number.
Preventing replay attacks: Even with signatures, an attacker could copy an old signed transaction and replay it. To stop this, each transaction must include a unique ID (e.g., a sequence number). That way, signing a transaction once does not authorize it again; a new signature is required for each duplicate.
Digital signature: A cryptographic scheme where a message-dependent signature, created with a private key, can be verified by anyone using the corresponding public key, guaranteeing authenticity and non-repudiation.
3. Eliminating Cash Settlement: Ledger Dollars
The next step removes the need to settle in cash at all. Instead of trusting everyone to pay up at month's end, enforce that no one can spend more than they currently hold in the ledger. This requires each participant to initially deposit money (e.g., 100 LD — "ledger dollars") into the system. The first ledger entries credit everyone's account.
A transaction is valid only if the sender has enough funds (based on the entire history of previous transactions).
Verifying a transaction now requires knowing the full ledger history up to that point.
The ledger dollars become an independent currency: they have no intrinsic link to real US dollars, though people may exchange them on the open market.
The ledger is the currency. In Bitcoin (and any cryptocurrency), the history of all valid transactions is the money. There is no other record of ownership.
4. The Central Challenge: Distributed Consensus
So far, the ledger is hosted on a central website — a single point of trust and failure. To remove that trust, every participant keeps their own copy of the ledger. When someone wants to make a payment, they broadcast the signed transaction to the network. Everyone listens and records it locally.
But this creates a fundamental problem: how can all participants agree on the same set of transactions in the same order? Without agreement, a payment recorded by Alice might not be recognized by Bob. This is the Byzantine Generals Problem — achieving consensus in a decentralized, trustless network.
Bitcoin's solution: trust whichever ledger has the most computational work invested in it. This relies on two key cryptographic tools: cryptographic hash functions and proof of work.
5. Cryptographic Hash Functions
A hash function takes an input of any size (message, file, etc.) and produces a fixed-length output, called the hash or digest. For a cryptographic hash function like SHA-256 (used in Bitcoin):
Deterministic: same input always gives same output.
Avalanche effect: changing even one character of the input completely changes the hash (unpredictably).
One-way (preimage resistance): given an output, it is infeasible to find any input that produces that output. The only method is brute-force guessing.
Collision resistance: infeasible to find two different inputs with the same hash.
SHA-256: A cryptographic hash function producing a 256-bit output. It underpins Bitcoin's Proof-of-Work and is widely used in internet security (e.g., TLS).
For example:
Changing "Hello" to "hello" yields a completely different hash.
6. Proof of Work
Proof of Work (PoW) is a system that proves a certain amount of computational effort was expended on a specific piece of data. The classic implementation:
Given a block of data (e.g., a list of transactions), find a number (called a nonce) such that the SHA-256 hash of the block plus nonce starts with a specified number of zero bits.
Example: require that the hash starts with 30 zeros. The probability is 1/230, about 1 in a billion. Finding such a nonce requires trying roughly a billion candidates.
Verification is trivial: compute the hash once and check the prefix zeros.
Because SHA-256 is one-way, there is no shortcut: the miner must do brute-force work. Changing any transaction in the block invalidates the proof of work, forcing a new search.
Proof of Work: A piece of data (the nonce) that makes the cryptographic hash satisfy a difficulty target, proving that a certain amount of computation was performed.
7. The Blockchain
To create an immutable, ordered ledger, transactions are organized into blocks. Each block contains:
A list of transactions (including a special "coinbase" transaction for the miner's reward).
The hash of the previous block (this chains the blocks together).
A nonce that makes the block's hash satisfy the current difficulty target.
Because each block includes the hash of its predecessor, altering any transaction in a previous block changes that block's hash, which changes the next block's hash, etc., requiring re-mining all subsequent blocks. This chaining gives the blockchain its name.
The blockchain is the definitive record of all transactions. Every participant maintains their own copy, and they all follow the same protocol for accepting new blocks.
8. Mining and Block Rewards
Mining is the process of creating new blocks. Miners:
Listen for broadcast transactions.
Collect them into a candidate block.
Include a special coinbase transaction that awards themselves a certain number of new coins (the block reward).
Perform Proof of Work by searching for a nonce that makes the block hash meet the difficulty target.
Broadcast the completed block to the network.
The block reward is an exception to normal rules: it creates new money out of thin air (no sender signature needed). This is how new coins enter the economy.
Mining is like a lottery: every miner guesses nonces, and the first to find a valid block claims the reward.
Over time, block rewards are reduced (halved) to control total supply.
In addition to the block reward, miners can collect transaction fees: senders may voluntarily include a small fee with their transaction to incentivize miners to include it in the next block. As block rewards decrease, transaction fees become the primary miner incentive.
9. Achieving Consensus: The Longest Chain Rule
When participants hear about a new block, they append it to their local copy of the blockchain. If they hear about two conflicting chains (forks), the protocol is: always trust the chain with the most cumulative Proof of Work — the longest chain (by total difficulty, not just number of blocks).
Why this works: Suppose an attacker wants to double-spend. They create a private fork containing a transaction that pays them, while the public network builds on a separate chain that includes a different transaction. The attacker must keep their private fork longer than the public chain to have it accepted. Unless the attacker controls more than 50% of the total mining power (a 51% attack), the public chain will grow faster, and the honest chain will always win.
Confirmations: Users should not consider a transaction fully settled immediately. They should wait for several new blocks to be built on top of the block containing their transaction. After 6 confirmations (blocks), the probability of reorganization becomes negligible.
Decentralized consensus: All participants independently follow the same longest-chain rule, ensuring they eventually agree on a single history without needing a central authority.
10. Bitcoin Protocol Specifics
Difficulty Adjustment
The target number of leading zeros (difficulty) is adjusted every 2,016 blocks (roughly two weeks) to maintain a 10-minute average block time.
As more miners join, the difficulty increases; as miners leave, difficulty decreases.
Block Reward Halving
Every 210,000 blocks (about 4 years), the block reward is cut in half.
Started at 50 BTC per block → 25 BTC → 12.5 BTC → etc.
This geometric decrease means the total supply approaches 21 million BTC asymptotically.
Transaction Fees
Senders can optionally attach a fee to their transaction.
Miners choose which transactions to include, prioritizing those with higher fees.
As the block reward shrinks, fees become the main income for miners.
Block Size and Throughput
Bitcoin blocks are limited to about 1 MB, allowing roughly 2,400 transactions per block.
This gives a maximum throughput of ~7 transactions per second.
For comparison, Visa handles an average of 1,700 transactions per second with peaks over 24,000.
This limitation can lead to high fees during periods of network congestion.
Other Cryptocurrencies
Many alternative cryptocurrencies (altcoins) modify Bitcoin's design:
Shorter block times (e.g., Litecoin: 2.5 minutes)
Different consensus algorithms (e.g., Proof-of-Stake, Delegated Proof-of-Stake)
Larger block sizes or dynamic block sizing
Different monetary policies
11. Practical Use and Understanding
You do not need to know these technical details to use a cryptocurrency, just as you don't need to understand credit card processing to swipe a card. User-friendly wallets and exchanges handle the complexity.
However, understanding the fundamentals — blockchain, Proof of Work, digital signatures, mining — is crucial for making informed decisions about buying, investing, or using cryptocurrencies.
The technology is a trustless, decentralized verification system built on cryptographic principles. It replaces the need for centralized banks with a consensus protocol secured by economic incentives and computation.
Key Takeaways
A cryptocurrency is a ledger of all transactions; the history itself defines ownership.
Digital signatures ensure only the rightful owner can authorize transfers.
Cryptographic hash functions provide the building blocks for Proof of Work.
Proof of Work makes tampering with the ledger computationally expensive and verifiable.
The blockchain chains blocks of transactions, making past records immutable.
Mining secures the network, introduces new coins, and processes transactions.
The longest chain rule provides decentralized consensus without central authority.
Bitcoin's 10-minute block time, halving schedule, and 21 million supply cap are specific design choices; other cryptocurrencies vary them.
Transaction fees incentivize miners, especially as block rewards decline.
Understanding these concepts separates informed participants from those relying on vague analogies.

Ask anything
We've read this whole study set, so questions about it get the best answers.