polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
240 stars 114 forks source link

historical TotalIssuance #228

Closed colossus-digital closed 11 months ago

colossus-digital commented 2 years ago

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

tnks A.

arjanz commented 2 years ago

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.

colossus-digital commented 2 years ago

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