0

The target for the next block is available in getblocktemplate but I can not figure out if there is a way to get the target without also getting all of the pending transactions, which can take a very long time and generate lots of data.

You could also use getbestblock to get the top block and then use getblockheader to get the previous 2016 blocks and then do the math based on the times, but again this is very slow and data heavy.

Is there a fast way to determine the target for the next block from bitcoin-core over RPC?

0

You can easly calculate that from the difficulty

So just with the RPC call getdifficulty calculate this:

target = targetmax / difficulty

Where targetmax = 26959535291011309493156476344723991336010898738574164086137773096960

target max is a fix number from the genesis block

If the hash value (Converted to decimal) is lower then this value, it's a valid Block

1
  • 2
    That reports the difficulty of the last block, not the next block. – Pieter Wuille May 7 at 2:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.