How to quickly get the target of the next block to be mined from bitcoin-core over RPC? 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?
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