Skip to content

Instantly share code, notes, and snippets.

@LarryRuane
Created March 22, 2023 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarryRuane/2c52467afe0090432a2a0ed592054d72 to your computer and use it in GitHub Desktop.
Save LarryRuane/2c52467afe0090432a2a0ed592054d72 to your computer and use it in GitHub Desktop.
calculate total amount of chain witness data
#!/usr/bin/env python3
from bitcoinrpc.authproxy import AuthServiceProxy
api = AuthServiceProxy("http://lmr:lmr@127.0.0.1:8332")
info = api.getblockchaininfo()
tip_height = info['blocks']
print("tip height", tip_height)
witness = 0
for i in range(0, tip_height+1):
blockhash = api.getblockhash(i)
b = api.getblock(blockhash)
witness += b['size']-b['strippedsize']
print("witness bytes", witness)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment