0

I am interested in the difficulty right now. That is, the miners are working a block right now and they have a target. Both of the RPC commands "getmininginfo" (or "getdifficulty") and "getblocktemplate" can be used to get a number that represents a "difficulty".

"getmininginfo" (or "getdifficulty") gives a difficulty value directly. "getblocktemplate" gives the "target" and the "bits", both of which can be used to derive a difficulty value. I understand that miners work according to a "target." But, which target?

I list two possibilities below. Which (if either) is the correct case?

1) "getmininginfo" gives the difficulty right now, and "getblocktemplate" gives the difficulty for the next block under the assumption that this block will be solved within the next second.

2) "getblocktemplate" gives the difficulty right now (through the "bits" or "target"), and "getmininginfo" gives what the difficulty was for the most recently solved block.

If both of these are wrong, what exactly do the difficulties given by the two commands really represent?

2

1) "getmininginfo" gives the difficulty right now, and "getblocktemplate" gives the difficulty for the next block

That is correct. getmininginfo gives the diffculty of the block at the current blockchain tip, and getblocktemplate gives the target for the block to be mined on top of the current tip, i.e. the next block.

under the assumption that this block will be solved within the next second.

There is no such assumption. The difficulty doesn't change by the second, it only changes at the end of each difficulty adjustment interval. If you are fully synced, you will always know what the difficulty of the next block will be. The calculation is completely deterministic and any block that has your current tip as its previous block will have the exact same target.

  • so the target that the miners are working on right now is or is not the one given by "getblocktemplate" ? – SDiv Jul 6 at 10:39
  • Miners are always working on the next block. So they want to meet the target of the next block, which is given by getblocktemplate. – Andrew Chow Jul 6 at 16:25

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.