0Pricing
Web3 & DApp Development Fundamentals · 课时

工作量证明

挖矿与难度

工作量证明 是 CoddyKit 上的免费 Web3 & DApp Development Fundamentals 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 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 + 1

The 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 work

Difficulty 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.

常见问题解答

「工作量证明」课时是免费的吗?

是的 — 「工作量证明」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Web3 & DApp Development Fundamentals 课程的其余内容,请升级到 CoddyKit PRO。 Web3 & DApp Development Fundamentals 课程共包含 4 节课。

「工作量证明」这节课中我会学到什么?

挖矿与难度 你通过在浏览器中直接运行的动手代码来练习 Web3 & DApp Development Fundamentals,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Web3 & DApp Development Fundamentals 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Web3 & DApp Development Fundamentals 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。

「工作量证明」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Web3 & DApp Development Fundamentals 课中编写并运行代码吗?

能。每节 Web3 & DApp Development Fundamentals 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 工作量证明
  2. 权益证明
  3. 其他机制
  4. 最终性与分叉
← 返回 Web3 & DApp Development Fundamentals