THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Bitcoin Mining and Proof of Work: How Blocks Are Produced

permalink THAMER
#bitcoin-consensus#bitcoin-mining#block-subsidy#difficulty-adjustment#proof-of-work#sha256

Bitcoin mining is the process of constructing candidate blocks and searching for a block header hash that meets the network's proof-of-work target. The work makes rewriting accepted chain history costly, while full nodes independently enforce the rules that determine whether a block is valid.

What miners actually do

A miner selects transactions, constructs a block with a coinbase transaction, calculates a Merkle root, and repeatedly changes available header or coinbase-derived data while hashing the 80-byte block header with double SHA-256. A valid header hash must be numerically at or below the target encoded in the block header's nBits field.

Mining does not grant permission to change consensus rules. A block that pays too much subsidy, spends invalid inputs, or violates other consensus rules can be rejected even if its header satisfies proof of work.

Difficulty adjustment

On Bitcoin mainnet, the proof-of-work target is adjusted every 2,016 blocks according to the protocol's difficulty rules, subject to limits. The approximate goal is an average block interval of ten minutes, not a promise that each block arrives exactly ten minutes after the previous one. Testnet rules can differ from mainnet.

The coinbase transaction

The first transaction in a block is the coinbase transaction. It creates the permitted block subsidy and collects transaction fees, subject to consensus limits. The subsidy follows a halving schedule, and newly created coinbase outputs generally require 100 confirmations before they can be spent.

Mining versus validation

Miners propose blocks; independently operated full nodes validate them. This separation matters: mining power influences which valid blocks are found, but does not make invalid transactions acceptable to validating nodes.

Security and chain selection

Bitcoin nodes follow the valid chain with the most accumulated proof of work, rather than merely counting the number of blocks. Competing blocks can cause temporary forks and reorganizations. Greater confirmation depth generally makes reversal more expensive, but no fixed number offers an unconditional guarantee.

Primary references

  • Bitcoin whitepaper, section 4: https://bitcoin.org/bitcoin.pdf
  • Bitcoin developer guide on block chains: https://developer.bitcoin.org/devguide/block_chain.html
  • Bitcoin developer reference on block headers: https://developer.bitcoin.org/reference/block_chain.html

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects