Mining
Mining, Proof of Work and Difficulty Adjustment
“Proof of Work is the soul of Bitcoin: it turns energy into security.” — Cypherpunk principle
1. Introduction
The mining is the mechanism that secures the Bitcoin network by enabling:
Issuance of new bitcoins
Protection against attacks
Temporal ordering of transactions
Probabilistic consensus
Cumulative immutability
Defense against tampering
The tool that makes this possible is Proof of Work (PoW).
This chapter explains:
How PoW works
Why it makes the network secure
The critical role of difficulty adjustment
Economic incentives of miners
Mathematical security models
Potential attacks (and why they are impractical)
2. What is mining in Bitcoin?
Mining is the process by which specialized nodes:
group valid transactions,
compete to find a valid hash for the header,
propagate the winning block to the network,
receive reward (subsidy + fees).
2.1. Formal definition of PoW
A miner must find:
where:
Target is a number that defines the difficulty
the probability of success is inversely proportional to the
hashrateglobal
3. Structure of the header used in PoW
The 80-byte header is the only data subjected to PoW:
version
4
Consensus rules
prev_block_hash
32
Chaining
merkle_root
32
Transactions
timestamp
4
Timestamp
bits
4
Target compression
nonce
4
Value that is incremented
4. The “nonce” and the search space
The miner tests billions of nonces per second.
The nonce is 32 bits → 4 billion possible values. But if it is exhausted, the miner modifies:
extraNonce (in coinbase)
merkle_root
timestamp
which creates a practically infinite space for PoW.
5. Difficulty: heart of economic security
Bitcoin adjusts the difficulty every 2016 blocks (~2 weeks) to maintain an average interval of:
If blocks are mined faster:
hashrate ↑
difficulty ↑
If they are mined slower:
hashrate ↓
difficulty ↓
5.1. Difficulty adjustment formula
The new difficulty is calculated as:
where:
(2 weeks)
= actual time it took for the last 2016 blocks
Limits:
maximum adjustment ±4×
prevents exaggerated manipulation
6. The target: numerical threshold
Difficulty is an abstract value. The target is the concrete number the hash must be less than.
Simplified example:
HASH (in hex): 0000000af3c1... TARGET: 0000000fffff...
Since HASH < TARGET → valid block
7. Pseudocode example of PoW
8. Why is PoW secure?
Because it physically costs energy to generate hashes, while verifying them is trivial:
Costs for the attacker:
specialized hardware (ASICs)
electricity
infrastructure
lost economic opportunity
financial risk
social coordination
Costs for the verifier:
a single hash per node
less than 1 ms per block
8.1. Accumulated security
PoW creates a “cryptographic wall”:
No matter how many nodes exist: security comes from the total work buried under each block.
9. Economic incentives: game theory applied
We could define mining as a strategic interaction between economic agents.
9.1. Block reward
It is composed of:
Subsidy:
where .
9.2. Aligned incentives
Miners → maximize profits
Nodes → verify rules
Users → want security
Developers → improve efficiency
Incentives are set up to favor:
Honesty > Attack
9.3. Why attacking the network is irrational
To rewrite old blocks you must redo all the accumulated PoW competing against all honest miners at a cost higher than the benefit.
Even an attacker with 51%:
cannot steal funds
cannot modify rules
cannot create inflation
can only reverse their own payments
And at a ruinous cost.
10. Global hashrate: security metric
(terahashes/second)
The higher it is, the more expensive it is to attack the network.
10.1. Conceptual example
If the network has:
(300 quintillion hashes/s)
An actor would have to match that power just to compete.
11. Mining pools
Miners usually group into pools.
Reasons:
reduce variance
stable income
share work
The pool:
Miners → send shares → Pool aggregates PoW → Pool produces block → Distributes reward
11.1. Does this increase centralization risk?
Yes, but not as much as it seems:
changing pools is trivial
pools do not control private keys
they only coordinate work
if they abuse, miners migrate
12. Types of hardware in the history of mining
2009
CPU
Very low
Months
2010
GPU
50× CPU
~1 year
2012
FPGA
10× GPU
Short
2013-present
ASIC
1,000× GPU
Dominant
ASIC = Application-Specific Integrated Circuit
13. Mathematical models of block time
Mining follows a Poisson process.
Expected time per block:
where:
Variability: some blocks take seconds, others hours. But the long-run mean converges to ~10 minutes.
14. Attacks on the PoW system
14.1. 51% attack
Allows:
reversing own payments
censoring transactions (temporarily)
Does not allow:
creating bitcoins
stealing funds
breaking signatures
changing consensus rules
14.2. Selfish mining
Theory: miner withholds blocks to gain advantage.
Reality:
requires threshold > 33%
not very profitable
easy to detect
partially solved with
BIP32, P2P improvements and topologies
14.3. Timestamp attacks
Manipulate time to adjust difficulty. Mitigation:
strict limits
allowed window ± 2h
nodes reject impossible timestamps
15. Why PoW is superior to PoS (according to original design)
Cypherpunk / engineering perspective:
Based on physics, not on wealth
Objective cost of attack
History protected with irreversible work
Australian Fairness → everyone can compete
Proven dynamics since 2009 without failures
PoW is a mechanism neutral, resilient, verifiable and politically independent.
16. Chapter conclusion
Mining and Proof of Work are:
The physical security layer of Bitcoin
The source of its immutability
The engine of its issuance
The foundation of its consensus
The economic barrier against attackers
PoW turns electricity into digital security. Difficulty adjustment turns fluctuations into stability. Incentives turn competition into collective protection.
Mining is not “wasting energy”. It is spending energy to prevent fraud, a military function without violence.
Last updated
Was this helpful?

