2

What's the easiest way to calculate the median size of the last 100 blocks programmatically?

I have tried using monerod and the print_block and print_bc commands but neither shows the block size directly.

1 Answer 1

5

If you have a recent enough daemon, you can run the bc_dyn_stats 100 command, which will include the median block size over the last 100 blocks, among other things.

If you have a recent, but not so recent daemon, you can try the getinfo RPC call, which includes the current block size limit, which is twice the last 100 blocks median:

curl -v -X POST http://127.0.0.1:18081/getinfo -d '{}' -H 'Content-Type: application/json'

3
  • Thanks for the pointers but doesn't seem to work for me. I'm running 0.10.1.0: bc_dyn_stats is unknown and the curl thingy doesn't seem to contain the block size limit (it's got: alt_blocks_count, cumulative_difficulty, difficulty, grey_peerlist_size, height, incoming_connections_count, outgoing_connections_count, status, target, target_height, testnet, top_block_hash, tx_count, tx_pool_size, white_peerlist_size)
    – assylias
    Commented Jan 18, 2017 at 9:55
  • I added emphasis on "recent enough daemon". Recent enough should be three days ago for bc_dyn_stats, and a week before that for the getinfo field.
    – user36303
    Commented Jan 18, 2017 at 11:34
  • Oh - that recent :-) I'll patiently wait for the next release then. Thanks.
    – assylias
    Commented Jan 18, 2017 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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