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.


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 -d '{}' -H 'Content-Type: application/json'

| improve this answer | |
  • Thanks for the pointers but doesn't seem to work for me. I'm running 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 Jan 18 '17 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 Jan 18 '17 at 11:34
  • Oh - that recent :-) I'll patiently wait for the next release then. Thanks. – assylias Jan 18 '17 at 12:42

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.