I am trying to work out where the data is actually stored. If a contract is deployed with a dynamic array defined, then at the time of deployment no allocation is made for the storage.

I understand there is a sha addressing based system to a disk location for the state variables. But where is that storage? Is this part of the blockchain node?

If the persistent storage is defined based on the contract instance and the storage is dynamic, there must be some kind of pointer to storage.

My reason for asking about this, is to address the scaling question. If contracts start defining large dynamic arrays in state, then the blockchain will need to manage that across the nodes.

I know also a hash tree is kept with a root hash on each node but that does not explain how the state variables are stored in persistent storage for a contract instance.

1 Answer 1


Full nodes store the state of every smart contract on the chain. You're right, it's starting to get quite large. The Ethereum devs are working on a solution to this issue called sharding (you can look it up).

Note: It is possible to run a local node that does not store the entire state. That's why I said 'full node' above. See your node's documentation.

There is a 'pointer' of sorts called the stateRoot in the header of each block (as described here: eth_getBlockByHash). You may retrieve values from the state with this RPC command: eth_getStorageAt. The returned data is anything but easy to extract information from.

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.