I was wondering if its possible to query the state of a contract at an old block?

2 Answers 2


Similar to other RPCs you can pass a block hash to the contracts_getStorage RPC (using the at parameter) in order to query the state at a historical block:

Using polkadot.js Apps to call the contracts_getStorage RPC

It is not possible to do that on-chain (i.e from a contract) as accessing historical data depends on whether the queried node has this block available which is not a requirement.


Adding to Alexander's answer, bear in mind that depending on what the type of node you are querying, you may not be able to get the state at any height.

For example, Polkadot full nodes keep only the state at the last 256 blocks. To access the state of the blockchain at any block you will need to query (run locally?) an archive node. See this guide for more info.

  • Public RPC nodes are usually archive nodes. Jun 27, 2022 at 15:38

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.