In the last lesson, we explored what a Bitcoin miner is and how it builds a candidate block using unconfirmed transactions from its memory pool (mempool). Now, let’s take a deeper look at what actually happens during the mining process.
If this sounds confusing, don’t worry—start with the earlier lessons in the Beginner’s Guide to Bitcoin Mining. But if you’re ready to continue, let’s dive in!
Anatomy of a Candidate Block
Think of a candidate block as having two main parts:
- Block Header (summary of the block)
- Block Body (list of transactions)
Miners assemble this block from the transactions waiting in their mempool. The block body holds the transactions, while the header contains metadata—information about the block itself.
What’s Inside the Block Header?
The block header includes several key pieces of data:
- Timestamp – Marks when the block was created.
- Previous Block Hash – A unique identifier (hash) of the last block in the blockchain. This ensures the new block links to the previous one.
- Transaction Summary Hash – A hash (called the Merkle Root) that acts as a digital fingerprint for all transactions in the block. If any transaction changes, the hash changes, signaling tampering.
Generating the Block Hash
To add a block to the blockchain, the miner takes the block header and runs it through a hash function. This produces a unique output called the block hash.
But not just any block hash will do…
The block hash must begin with a certain number of zeros—a requirement set by Bitcoin’s software and known as the mining difficulty.
- The more zeros required, the harder it is to find a valid block hash.
- This makes mining a computational guessing game.
Enter the Nonce
Since the block header is mostly fixed, miners use a special field called the nonce to modify the input and try again.
- The nonce is a number the miner keeps changing.
- Each time the nonce is adjusted, the hash output changes.
- The goal is to find a nonce that produces a block hash starting with the required number of zeros.
This process is repetitive and requires trying millions or billions of guesses per second. It’s like trying different combinations to unlock a safe.
Mining Is Just Guesswork (Not Complex Math)
Despite what many say, mining doesn’t involve solving complex problems—it’s just trial and error. Miners are simply guessing nonces as fast as possible to find a valid block hash.
This process is known as Proof-of-Work (PoW).
Winning the Race
The first miner to find a valid block hash:
- Gets to add the block to the blockchain.
- Broadcasts the new block to the rest of the network.
- Receives a block reward, which includes:
- Newly created bitcoins (currently 3.125 BTC as of April 2024)
- Transaction fees from the transactions included in the block
After a block is confirmed, the network resets. All miners begin working on the next candidate block, using the hash of the new block as the reference.
Why the Blockchain Is So Secure
Every block contains the hash of the block before it. That means:
- If someone tries to change a transaction in an old block, they’d have to redo the Proof-of-Work for that block and every block that comes after it.
- This requires enormous computing power—making it nearly impossible to alter the blockchain once a block is confirmed.
This is why Bitcoin’s blockchain is considered immutable and highly secure.
Difficulty Adjustment: Keeping Blocks on Schedule
Bitcoin’s software automatically adjusts the mining difficulty every ~2 weeks.
- If miners are finding blocks too quickly, the difficulty increases.
- If blocks are being mined too slowly, it decreases.
This ensures that, on average, one block is mined every 10 minutes, no matter how many miners are participating.
Why Honest Mining Is More Profitable Than Cheating
Mining is energy-intensive and costly. Anyone powerful enough to attack the Bitcoin network is much better off mining honestly and earning the block reward.
Summary: How Mining Works in a Nutshell
- Miners collect transactions into a candidate block.
- They hash the block header using a random nonce.
- If the hash doesn’t start with enough zeros, they try a new nonce.
- When a miner finds a valid hash, the block is added to the blockchain.
- That miner earns bitcoin as a reward.
- The network resets, and the process begins again.
What’s Next?
Now that you understand how mining works, you’re ready to explore the broader Bitcoin ecosystem—where miners, users, wallets, and nodes all work together to keep the system decentralized and secure.


