I want to know how this works: web3.eth.getStorageAt(addressHexString, position [, defaultBlock] [, callback])

What data we can store at any address and how? And what will this eth API return?


3 Answers 3


Each contract consists of a EVM bytecode handling the execution and a storage to save the state of the contract. This is a low level function to get the state of the contract's storage. The storage is essentially a key/value store.
The function returns the value the contracts storage has at a certain position.

Refer to the GitHub wiki pages.

More on storage here.


As of version 1.0 of web3.js, the web3.utils.hexToAscii function should be used. Correct syntax:

web3.eth.getStorageAt('/* Contract Address */', 0).then(result => {

for instance if you look at this contract source and you type this in geth:


it returned the following

  • Would you be able to also provide an example for getting the address of a dynamic array? i've tried with web3.sha3("0x01") to calculate the address but can't figure it out.
    – slothbag
    Commented Jun 27, 2016 at 23:53

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.