How Blockchain Works
Understanding the process of adding blocks to the chain
Definition
A blockchain transaction is the process of recording a transfer of value or data on a distributed ledger. It involves five key steps: creation (a user signs a transaction with their private key), Broadcast (the transaction is sent to the network), validation (nodes verify the signature and sufficient balance), inclusion (the transaction is grouped into a block with others), and confirmation (the block is added to the chain through Consensus). Key concepts include Mining, Genesis Block, Append.
Each step ensures security and agreement. The digital signature proves the transaction was authorized by the owner. Validation prevents invalid transactions from entering the chain. Block formation groups transactions efficiently for network propagation. Consensus ensures all nodes agree on the order and validity of transactions. The entire process is automated by the network protocol, requiring no central authority.
Real-Life Example
Think of a blockchain transaction like mailing a certified letter. You write the letter (create transaction), sign it (digital signature), put it in an envelope and drop it at the post office (Broadcast to network). The post office checks the stamp and address (validation). Your letter is grouped with others going to the same city into a mail bag (block). The mail bag is transported and delivered (confirmation). Just as the postal system ensures your letter reaches its destination, the blockchain ensures your transaction is recorded correctly.
A practical example: When someone in Nigeria receives a remittance payment from a family member abroad using Bitcoin, the transaction goes through this exact process. The sender creates a transaction for 0.01 BTC, signs it with their private key, and Broadcast it. Within 10-60 minutes (depending on network congestion and fees), the transaction is confirmed on the blockchain. The recipient can verify the funds arrived without asking a bank or payment processor for confirmation.
Interactive Diagram
Launch the interactive diagram to see this in action.
Open Interactive DiagramThe interactive diagram for this chapter demonstrates Problems With Traditional Systems. It shows scenarios showing issues with centralized systems: single point of failure, data tampering, and censorship.
What to explore:
- click to attack the central server; watch all data become unavailable; see how a single change can alter records
- centralized systems have weaknesses — a single point of failure, vulnerability to tampering, and potential for censorship
Introduction
You know that a blockchain is a chain of blocks, and that it is shared across many computers. But how does it actually work? What happens when someone makes a transaction? How does the network verify it is valid? How does a new block get created? Understanding how blockchain works step by step reveals the elegant engineering behind this revolutionary technology.
The process of adding data to a blockchain involves several steps: someone creates a transaction, the transaction is Broadcast to the network, nodes Validate it, valid transactions are grouped into a block, nodes compete to add the block (through Consensus), the winning node Broadcast the block, other nodes verify and add it to their copies, and the chain continues. Each step is designed to prevent fraud and ensure agreement.
In this chapter, you will walk through the complete lifecycle of a blockchain transaction, from creation to permanent recording. You will learn about nodes, miners, validators, and the roles they play. By the end, you will be able to explain how blockchain works from start to finish.
How It Works
Step 1: A transaction is created. Alice wants to send 5 Bitcoins to Bob. She creates a transaction message containing: her address (public key), Bob's address, the amount (5 BTC), and a digital signature proving she is the owner of the sending address. The transaction is then Broadcast to the Bitcoin network — sent to all connected nodes.
Step 2: Nodes receive and Validate the transaction. Each node checks: is the digital signature valid? Does Alice have at least 5 BTC in her account (verified by checking the blockchain history)? Is the transaction formatted correctly? If valid, the node adds the transaction to its pool of pending transactions and forwards it to other nodes. Invalid transactions are rejected and not forwarded.
Household Object Analogy
Think of a blockchain transaction like sending a letter with verification. You write a letter (transaction), sign it with your unique seal (digital signature), and put it in the mail (Broadcast to network). The post office (nodes) checks your seal is authentic and you have enough postage (valid funds). Your letter is grouped with other letters into a mail bag (block). The mail bag is locked with a special lock (Hash) and the key is the next bag's lock (chain).
Deeper Dive
Step 3: Transactions are grouped into a block. Approximately every 10 minutes (on Bitcoin), a node called a miner collects pending transactions and organizes them into a candidate block. The block includes a list of transactions, a timestamp, a reference to the previous block's Hash, and a special field called the Nonce. The miner's goal is to make this block's Hash start with a certain number of zeros.
Step 4: The miner attempts to solve the Proof of Work puzzle. The miner repeatedly changes the Nonce value and calculates the block's Hash. Because Hash functions are one-way and unpredictable, the only way to find a valid Nonce is by trial and error — trying billions of possibilities. This requires enormous computing power and electricity. The first miner to find a valid Nonce Broadcast the completed block to the network.
Step 5: Other nodes verify and accept the block. Receiving nodes check: is the block's Hash valid (does it start with the required number of zeros)? Are all transactions valid (no double-spending)? Does the block correctly reference the previous block? If everything checks out, each node adds the block to its copy of the blockchain. The network now agrees that Alice sent Bob 5 BTC. The transactions in the block are considered confirmed.
Key Insight
The average time between Bitcoin blocks is targeted at 10 minutes. The Bitcoin network automatically adjusts the difficulty of the Proof of Work puzzle so that blocks are created approximately every 10 minutes regardless of how much computing power the network has. If more miners join, the puzzle gets harder. If miners leave, it gets easier.
Advanced
The mempool (memory pool) is where pending transactions wait before being included in a block. Transactions with higher fees are prioritized by miners because miners collect the fees. If the mempool is full (congested network), transactions with low fees may wait hours or even days. This fee market ensures that miners are compensated for their work and that the network self-regulates demand.
Orphan blocks (also called stale blocks) occur when two miners find valid blocks almost simultaneously. The network temporarily splits — some nodes see block A first, others see block B first. Eventually, one chain becomes longer (more blocks built on top) and the shorter chain's block is discarded (orphaned). The transactions in the orphan block return to the mempool. This is why you should wait for multiple confirmations (blocks added after your transaction's block) before considering a transaction final.
Block size limits prevent any single block from being too large. Bitcoin's block size is limited to 1 MB (now adjustable via SegWit). Ethereum has a gas limit that restricts computational work per block. These limits ensure that blocks propagate quickly across the network and that nodes with limited resources can still participate. The block size limit is a trade-off between throughput and decentralization.
Vocabulary Table
| Term | Definition |
|---|---|
| Mining | The process of validating transactions and adding new blocks to the blockchain. |
| Nonce | A random number miners adjust to produce a valid block hash. |
| Hash | A fixed-length string generated from input data, acting as a unique digital fingerprint. |
| Genesis Block | The very first block in a blockchain, with no previous hash. |
| Consensus | An agreement protocol among distributed nodes to accept a new block. |
| Broadcast | Sending a transaction or block to all nodes on the network. |
| Validate | To check that a transaction or block follows the network's rules. |
| Append | To add a new block to the end of the existing blockchain. |
Fun Facts
A Bitcoin block contains approximately 2,000 to 3,000 transactions. The exact number depends on transaction sizes.
The Bitcoin network's total computing power exceeds 200 exahashes per second (200 quintillion Hash per second), far more than the world's top 500 supercomputers combined.
A typical Bitcoin transaction uses about the same amount of electricity as a US household does in one day, due to the energy consumed by Mining.
The smallest unit of Bitcoin is called a 'Satoshi', named after the creator. One Satoshi equals 0.00000001 BTC (one hundred millionth of a Bitcoin).
As of 2025, over 750,000 blocks have been mined on the Bitcoin blockchain since the Genesis Block in 2009.
Common Misconceptions
Misconception: Blockchain transactions are instant.
Truth: Transactions are not instant. On Bitcoin, it takes approximately 10 minutes for a block to be mined, and most services require multiple block confirmations (1-6 blocks, taking 10-60 minutes) before considering a transaction final.
Misconception: All nodes are miners.
Truth: Most nodes are not miners. Full nodes Validate and relay transactions but do not compete to create blocks. Mining requires specialized hardware (ASICs) that most users do not have.
Misconception: A transaction is confirmed as soon as you send it.
Truth: A transaction is unconfirmed until it is included in a block. Unconfirmed transactions can be replaced or could disappear if the network does not include them in a block.
Misconception: Blockchain can process as many transactions as Visa.
Truth: Bitcoin processes about 7 transactions per second. Visa processes up to 24,000. Scalability is one of the biggest challenges facing blockchain technology.
Knowledge Check
1. What happens if a historical block's data is edited?
Answer: Subsequent block hash links break
2. What is the role of a 'nonce' in mining?
Answer: It is a random number adjusted to create a valid hash
3. Approximately how often does Bitcoin add a new block to its chain?
Answer: Every 10 minutes
