py-substrate-interface icon indicating copy to clipboard operation
py-substrate-interface copied to clipboard

historical TotalIssuance

Open colossus-digital opened this issue 3 years ago • 2 comments

hi guys, is there a way to get the TotalIssuance value at a given era or block number/hash ?

tnks A.

colossus-digital avatar Jul 21 '22 09:07 colossus-digital

For a certain block hash you can use:

total_issuance = substrate.query("Balances", "TotalIssuance", block_hash="0x11a4a00cfb10aa94884afc79d31b34bb212017449748a7a130d8015108a55cb4")
print(total_issuance.value)

This will work for all storage functions, to query the state at the time of the block hash.

arjanz avatar Jul 21 '22 12:07 arjanz

wow, great , thank you very much last question, how can i get the start block number (or hash) for a given era ?

colossus-digital avatar Jul 21 '22 12:07 colossus-digital