Proof of Work
การขุดและความยาก
Proof of Work เป็นบทเรียน Web3 & DApp Development Fundamentals ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Web3 & DApp Development Fundamentals และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Web3 & DApp Development Fundamentals มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
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.
คำถามที่พบบ่อย
บทเรียน “Proof of Work” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “Proof of Work” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Web3 & DApp Development Fundamentals ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Web3 & DApp Development Fundamentals มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “Proof of Work”
การขุดและความยาก คุณปฏิบัติ Web3 & DApp Development Fundamentals ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Web3 & DApp Development Fundamentals หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Web3 & DApp Development Fundamentals บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน
บทเรียน “Proof of Work” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Web3 & DApp Development Fundamentals นี้ได้ไหม
ได้ บทเรียน Web3 & DApp Development Fundamentals ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- Proof of Work
- Proof of Stake
- กลไกอื่น
- ความสิ้นสุดและฟอร์ก