The documentation at http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage commonly linked to in other questions does not go into enough detail to replicate the process for complex types like dynamic arrays. Following the instructions I to try access my contract storage, I can easily get the first few elementary types but I can't seem to find the right address for a dynamic sized array.
The dynamic array is at index 3 (position 4) and it is an array of struct.
I can easily get the array length with:
web3.eth.getStorageAt(myContractAddress, 3);
But I cannot get any array values using:
var hash = web3.sha3("0x04"), {encoding:"hex"});
web3.eth.getStorageAt(myContractAddress, hash);
I have also tried with "0x4" and "0x3" and "0x5" and many other combinations.
Can someone please provide specific examples using the web3 library to retrieve the address of a dynamic array?