Minimum difficulty target

Hi,
I’m trying to understand the difference between genesis.nBits and consensus.powLimit:
in my mind, the two should be the same (the minimum difficulty target) but when I run the code to expand

genesis.nBits = 0x1f07ffff;

on paper, I get

0x0007ffff00000000000000000000000000000000000000000000000000000000

whereas powLimit is defined as

consensus.powLimit = uint256S("0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");

I’d really appreciate it if a dev could point me in the right direction :slight_smile:

cheers!

Those two values are consistent. consensus.powLimit is the absolute highest target (lowest difficulty) allowed. But in practice, it is identical to genesis.nBits because the difficulty target is canonically stored in compact form. If you take consensus.powLimit, convert to compact form and then convert back, you get genesis.nBits :slight_smile:

Aha, must’ve made a mistake running the uint256 and arith_uint256 functions on paper! thank you!