4

According to ink!:

"Storage data is always encoded with the SCALE codec. The storage API operates by storing and loading entries into and from a single storage cells, where each storage cell is accessed under its own dedicated storage key."

How can i query pallet contract to return the Scale encoded value of a contract Storage key?

I want to do this such that i can always fetch the value of a particular contract storage item without interacting with the contract itself but the blockchain pallet contract.

Think of it like how you can query a slot in Ethereum and fetch the value stored for a contract in it which is done by calculating the keys(e.g for Arrays, Maps e.t.c)

1 Answer 1

1

You can do it via a runtime API call, using the contractsApi endpoint provided by the contracts pallet.

The endpoint provides a getStorage method, where you have to specify as argument the contract address and the Contract Root Storage Key.

Check this in the docs for more info and an example: Accessing storage items with the contractsApi runtime call API.

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.