Using the bitcoin client's JSON API (or any other altcoin client) how do I find out the reward given for finding that block?


The information you get for a getblock call doesn't seem to include the block reward. You could find it with a gettransaction call for the first transaction, but bitcoind only allows lookup for transactions in your own wallet, so that won't work either.

So indeed, as Diego points out, the only option is to look at the block height. This wiki page lists the different reward values for the different block height intervals.

  • That should be fine for my need. I only need to know the reward value for blocks I find. So it's safe to assume that the first transaction will always be the block reward?
    – Tuaris
    Mar 8 '14 at 0:29
  • 2
    The first transaction is the coinbase transaction and the output of this transaction contains the block reward + the combined transaction fees of the other transactions. Mar 8 '14 at 2:09

All you need is the block number. The reward started at 50 and it halves every 210k blocks. Currently it's at 25, and as I write this the current block number is 286459. For other altcoins, you need to know the schedule.


a bit old but maybe useful for people doing e2e tests in regtest

// from bitcoin-core implementation
// return in satoshis
function getBlockReward(height, halvingBlocks = 150) {
    const halvings = BigInt(height) / BigInt(halvingBlocks);
    if (halvings >= 64)
        return 0;

    let reward = BigInt(50 * 100000000);
    reward >>= halvings;
    return Number(reward);

and use it with bitcoin rpc client and getblockcount. Ex:

const blockNumber = await bitcoindClient.getBlockCount();

Pease notice that if you will use other network you must pass halvingBlocks params or change default value.

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.