Lesson 2 — Network security: hashrate, difficulty and mining economics
Lesson 2 of 10 · 4 min
How Bitcoin protects itself with proof-of-work: hashrate, difficulty adjustment every 2016 blocks, 51% attack, mining economics, energy use and the role of nodes.
Bitcoin's security rests on proof of work: miners spend energy to propose blocks, and rewriting history would require repeating that work faster than the rest of the network. The hashrate measures this computing power and the difficulty adjusts so that blocks come out, on average, every 10 minutes. In this lesson you see how the adjustment is calculated, how much a miner earns and why nodes matter as much as mining.
Hashrate: the network's computing power
The hashrate is the number of attempts per second that all miners make to find a valid block. It is measured in exahashes per second (EH/s; 1 EH/s = 10¹⁸ attempts per second). It is not measured directly: it is estimated from the speed at which blocks appear and from the difficulty. Check Bitcoin Hashrate and Difficulty to see the current value, the difficulty and the estimate of the next adjustment.
The difficulty adjustment
Every 2016 blocks (about two weeks), the network compares the time those blocks took with the target of 20 160 minutes (2016 × 10).
How it is calculated: new difficulty ≈ previous difficulty × (20 160 minutes ÷ minutes the last 2016 blocks took), with the adjustment limited to a factor of 4 in either direction. Hypothetical example: if the blocks took 12 days instead of 14, the difficulty rises by about 14 ÷ 12 − 1 ≈ 16.7%. If miners switch off machines and the blocks take 16 days, it falls by about 12.5%.
This mechanism explains why the issuance rate is predictable even when the hashrate changes a lot — and why, after a halving, less efficient miners can switch off without stopping the network. The article Bitcoin Halving connects the two things.
Mining economics
How it is calculated, in simplified form: expected daily revenue ≈ (your hashrate ÷ network hashrate) × 144 blocks per day × (subsidy + average fees per block). Hypothetical example: 100 TH/s on a 700 EH/s network represents about 1.43 × 10⁻⁷ of the network; with a subsidy of 3.125 BTC (since the halving of April 2024) and without counting fees, it gives about 0.000064 BTC per day. Then you subtract electricity, equipment and maintenance.
Try it on the Bitcoin Mining Calculator with the electricity price in Portugal and the consumption of a machine. In most domestic scenarios, the electricity bill eats up the revenue — and the estimate changes with every difficulty adjustment. The article How Bitcoin Mining Works details the process.
The 51% attack
Whoever controls more than half of the hashrate can, for a while, reorganise recent blocks and spend the same coins twice. They cannot steal other people's coins or change the rules (for example, create bitcoins outside the schedule), because the nodes would reject those blocks. On small proof-of-work networks, such attacks have already happened; on Bitcoin, the cost in equipment and energy makes them very difficult. That is why exchanges ask for more confirmations on networks with less hashrate.
Energy
Proof of work consumes a lot of electricity, and the exact value is an estimate with a wide margin. Check Bitcoin Energy Consumption: it shows the Cambridge University index estimate, with the minimum–maximum range. Compare proof-of-stake networks, such as Ethereum since 2022, which consume much less but protect themselves in another way (read Ethereum vs. Bitcoin).
The nodes: who enforces the rules
Miners propose blocks; the nodes decide if they are valid. If a miner includes an invalid transaction, the nodes reject the block and it loses the reward. Review Bitcoin Network Nodes: a network with many independent nodes in many countries is more resistant to pressure. Running your own node is the most direct way to verify everything without trusting third parties. The article Blockchain recalls the connection between blocks.
Summary
- The hashrate measures the network's work; the difficulty adjusts every 2016 blocks.
- New difficulty ≈ previous × (20 160 ÷ actual minutes), limited to 4×.
- Mining revenue depends on your share of the hashrate, the subsidy, the fees and the electricity.
- A 51% attack allows reorganising blocks, not stealing other people's coins or changing rules.
In the next lesson you enter the world of derivatives: futures, funding and open interest — as a risk warning.
Frequently asked questions
What happens to the network if the hashrate drops a lot?
Blocks become slower until the next adjustment; then the difficulty drops and the pace returns to about 10 minutes per block.
Is it worth mining Bitcoin at home?
In most cases, the cost of electricity in Portugal exceeds the expected revenue. Simulate with real data before buying equipment.
Does a 51% attack allow stealing my bitcoins?
No. It allows reorganising recent blocks and spending the same coins twice, but not signing transactions with your keys.
Practise with the tools
- Bitcoin hashrate and difficulty — Bitcoin’s network hashrate, current difficulty and the estimated next adjustment, with mempool.space data. No price forecasts.
- Bitcoin mining calculator — Estimate Bitcoin mining rewards and electricity cost using live hashrate and difficulty from mempool.space and the CoinGecko price. It is an estimate, not advice.
- Bitcoin energy consumption — See the public Cambridge Bitcoin Electricity Consumption Index (CBECI) estimate: power in GW and annualised consumption in TWh, with the source’s min–max range.
- Bitcoin network nodes — See Bitnodes’ public snapshot: how many nodes were found, how many the source marks as reachable, and the block height.
Read next
- How does Bitcoin mining work? A simple explanation for beginners
- Bitcoin halving: what it is, past dates and why it matters
- Ethereum vs Bitcoin: what are the differences? A simple comparison for beginners
- What is a blockchain? How it works, simply explained