Proof of Work
Mining and difficulty.
Proof of Work is a free Web3 & DApp Development Fundamentals lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Web3 & DApp Development Fundamentals learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Consensus Problem
In an open network, anyone can propose the next block. How does the network agree on a single valid block without a leader?
Proof of Work (PoW) was the first practical answer, introduced by Bitcoin.
What Is Proof of Work?
Proof of Work requires miners to solve a hard computational puzzle to earn the right to add a block.
The puzzle is hard to solve but easy for everyone else to verify — an asymmetry that secures the chain.
The Mining Puzzle
Miners repeatedly hash the block header while changing a value called the nonce, searching for a hash below a target threshold.
Because hashing is unpredictable, the only strategy is trial and error.
target = 0x0000ffff...
loop:
hash = sha256(header + nonce)
if hash < target: SOLVED
else: nonce = nonce + 1The Nonce
The nonce is the field miners change on each attempt. Each new nonce produces a completely different hash thanks to the avalanche effect.
Finding a valid nonce can take quintillions of guesses across the whole network.
Difficulty
Difficulty controls how hard the puzzle is by setting how small the target hash must be. A smaller target means more leading zeros are required.
Networks adjust difficulty automatically to keep block times steady (about 10 minutes for Bitcoin).
Easy target: 0x00ffffff... (few zeros)
Hard target: 0x000000ff... (many zeros)
More zeros required = more workDifficulty Adjustment
If miners join and blocks come too fast, difficulty rises. If miners leave and blocks slow down, difficulty falls.
This self-tuning keeps the average block interval predictable regardless of total mining power.
Hash Rate
Hash rate measures how many hashes the network computes per second. Higher hash rate means more security, since attacking requires out-hashing everyone else.
Modern Bitcoin hash rate is measured in exahashes (10^18) per second.
Block Rewards and Incentives
Miners are rewarded with newly minted coins plus transaction fees. This block reward incentivizes them to spend real electricity securing the network.
Honest mining is more profitable than attacking, which aligns incentives with security.
The 51% Attack
If a single party controlled more than half the hash rate, they could potentially rewrite recent blocks — a 51% attack.
On large networks this is prohibitively expensive, which is precisely what makes PoW secure.
Energy Cost Trade-off
PoW's security comes from real-world energy expenditure, which critics call wasteful.
This concern motivated alternatives like Proof of Stake, which we cover next. PoW trades energy for battle-tested security.
Putting It Together
Proof of Work secures a blockchain by making block creation costly (mining) but verification cheap.
Difficulty keeps timing stable, rewards keep miners honest, and the sheer cost of hashing deters attacks.
Quick Check
Test your Proof of Work knowledge.
Recap: Proof of Work
You learned that:
- PoW makes miners solve a hard hashing puzzle
- The nonce is varied to find a hash below the target
- Difficulty auto-adjusts to keep block time stable
- Rewards align miner incentives with security
- A 51% attack is the main theoretical threat
Next: Proof of Stake.
Frequently asked questions
Is the “Proof of Work” lesson free?
Yes — the full text of “Proof of Work” is free to read here on the web, and the Web3 & DApp Development Fundamentals course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Web3 & DApp Development Fundamentals course, upgrade to CoddyKit PRO.
What will I learn in “Proof of Work”?
Mining and difficulty. You practise Web3 & DApp Development Fundamentals with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Web3 & DApp Development Fundamentals?
No prior experience is required. Web3 & DApp Development Fundamentals on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Proof of Work” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Web3 & DApp Development Fundamentals lesson?
Yes. Every Web3 & DApp Development Fundamentals lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Proof of Work
- Proof of Stake
- Other Mechanisms
- Finality and Forks