§ 09 · Difficulty · Overview
Target and difficulty
How hard is it to win a block, and who sets the bar?
On this page 7 sections
Mining is a lottery. Miners buy tickets with work, and a ticket wins if its number is small enough. The targetTarget: The number a winning lottery ticket must not exceed. On Pearl the bar is the target times the work the ticket cost; the block hash is never compared with it. is that “small enough”: a 256-bit number that a winning ticket must not exceed.
The target is the knob that sets the pace. Lower it and winning tickets get rarer, so blocks take longer. Raise it and they come faster. Pearl turns this knob a tiny bit after every block, to keep about one block every 194 seconds.
DifficultyDifficulty: How much harder it is to find a block now than at the easiest level Pearl allows (difficulty 1). It is retuned after every block. is the same knob, written for humans: one friendly number that says how many times harder today’s target is than the easiest one allowed.
Try it
Type a bits value and see the target it stands for and its difficulty. Start with block 130,827’s 0x176af3a6, then try 0x1b00ffff.
Why does a blockchain need a target at all?
Because mining power never sits still. If the bar were fixed, twice as many GPUs would mean blocks twice as fast, and half as many would mean blocks twice as slow.
A moving target fixes that. When blocks come too quickly, the target shrinks and tickets need to be smaller. When they come too slowly, it grows. The pace stays near 194 seconds whatever the miners do, and so does the schedule of new coins, which counts blocks.
What does the target judge on Pearl?
Not the block hash. This is the biggest difference from Bitcoin. A Pearl block hash is a big, random-looking number, nowhere near the target.
The target judges a ticketTicket: A 256-bit BLAKE3 hash of a tile's transcript. It wins a block if, read as a number, it is at most the target times the work that tile cost. inside the block’s certificateCertificate: The proof of work that travels in front of every block: about 60 KB, mostly a zero-knowledge proof. Any node can check it in milliseconds without seeing the miner's matrices.: a BLAKE3 hash of one tile of the miner’s matrix work. And the bar is scaled by how much work that tile cost:
Scaling the bar by the tile’s work means a big tile and a small tile cost the same per unit of work to win with. The whole check, with real numbers, is on tickets and target.
How do bits, target and difficulty fit together?
They are three views of one number.
- BitsBits: A 4-byte field in the header that stores the target in a compact form. Pearl's easiest allowed value, difficulty 1, is 0x1b00ffff. is how the header stores the target: 4 bytes, an exponent and three digits, like scientific notation. Decoding it by hand is on bits.
- Target is the real 256-bit number nodes compare with.
- Difficulty divides the easiest target by the current one:
Bigger difficulty, smaller target, harder block. Here is how it climbed on Pearl’s mainnet:
| Block | Bits | Difficulty |
|---|---|---|
| 0 and 1 | 0x1b00ffff |
1.00000000 |
| 2 | 0x1b00ffea |
1.00032054 |
| 2,017 | 0x1b008475 |
1.93267274 |
| 10,000 | 0x1a0ab2a8 |
23.92961877 |
| 100,000 | 0x1800c4ef |
21,808,883.27997620 |
| 120,000 | 0x180089e0 |
31,150,692.72892112 |
| 130,827 | 0x176af3a6 |
40,157,376.49334089 |
The live figure right now is 40.16 million.
What is the easiest target allowed?
Pearl’s proof-of-work limitProof-of-work limit: The largest target, so the easiest block, the rules allow. On Pearl's mainnet it is 2²⁰⁸ − 1; in compact form that rounds down to bits 0x1b00ffff, which is difficulty 1. is 2²⁰⁸ − 1: a target with 48 leading zero bits. No block may have a bigger target.
In compact form that limit becomes 0x1b00ffff, which decodes to 0xffff × 2¹⁹², a hair below 2²⁰⁸ − 1. That value is the reference for “difficulty 1”. Pearl’s genesis block and block 1 used it.
How much work does a difficulty stand for?
On average, a block at difficulty 1 takes about 281,479,271,743,489 attempts’ worth of work: 2²⁵⁶ divided by the target. Each step of difficulty adds the same again. So block 130,827, at difficulty 40,157,376.49, stood for about 1.13 × 10²² units of work.
Because Pearl scales each ticket’s bar by its tile’s work, that unit works out to roughly one multiply-accumulate. That’s an inference from the design rather than a number Pearl publishes, and it’s the basis of Pearl’s “hashrate”. See chain work.
Who moves the target?
Nobody, by hand. Every node runs the same rule, WTEMAWTEMA: Pearl's difficulty rule. After every block it nudges the target slightly: easier if that block took longer than 194 seconds, harder if it was quicker, with a one-week time constant., after every block. If the last block took longer than 194 seconds, the target grows a little. If it was quicker, it shrinks a little. Each step is tiny: one second off schedule moves the target by one part in 604,800.
Make a guess
Mining power suddenly doubles and stays that way. After one hour, how much higher is the difficulty?
Think of your answer first, then check it.
Answer About 0.6%.
In a simple model where every block arrives exactly when the mining power predicts, about 38 blocks arrive in that hour, each roughly 97 seconds early, and each nudges the target down a hair. The difficulty is up 0.61%. After one day it’s up about 13%, and it reaches half of the needed rise after about 4.85 days. That patience is deliberate: it keeps luck and timestamp games from yanking the difficulty around. The details are on WTEMA.
The rule only works if block times are honest enough, which is why Pearl’s timestamp rules are strict. And when chains compete, the target also decides which one wins: nodes follow the one with the most chain work.
Why difficulty 1 is 0x1b00ffff and not exactly 2²⁰⁸ − 1
The compact format keeps only three bytes of mantissa and always rounds down. 2²⁰⁸ − 1 is 26 bytes of ff. Its top
byte has the high bit set, which the format reads as a minus sign, so the encoder adds a leading 00: the number is now
27 bytes long (exponent 0x1b) and its top three bytes are 00 ff ff. That gives 0x1b00ffff, which decodes to
0xffff × 2¹⁹². Pearl’s code stores both: PowLimit (the exact limit a target is checked
against, in params.go (node/chaincfg/params.go:27-29 at v1.5.2, on GitHub)) and PowLimitBits (the compact form used for
genesis and as the difficulty reference). The difficulty explorers show comes from
getDifficultyRatio (node/rpcserver.go:1034-1050 at v1.5.2, on GitHub):
max := blockchain.CompactToBig(params.PowLimitBits) // 0x1b00ffff on mainnet
target := blockchain.CompactToBig(bits)
difficulty := new(big.Rat).SetFrac(max, target)
outString := difficulty.FloatString(8)