btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
477 stars 410 forks source link

function to know the number of bitcoin mined at a given block number #123

Closed frranck closed 4 years ago

frranck commented 6 years ago

Hello, Is there a function in this library to know the number of bitcoin mined at a given block number ? Regards

onyb commented 4 years ago

@frranck You can use the getblockstats RPC command to get the subsidy (in satoshis) at the specified block height.

$ curl --user myuser:mypass --data '{"method":"getblockstats","params":[628768],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST "rpcServerURL"  | jq ".result.subsidy"
1250000000
onyb commented 4 years ago

@frranck I'm assuming from the 🚀 reaction that we can close this issue. 🙂