I understand that public state variables automatically creates a getter function when deployed, its value can be accessed via the getter function.
However, if a state variable is not public, how can we access the value? I am doing this for experiment purpose. Since everything is on the blockchain, even if a state variable is not public, we should still be able to find its value in the contract storage right?
I am running my contracts on Ganache, I saw one of the RPC for ganache is eth_getStorageAt()
, maybe somehow it can be accomplished here?
eth_getStorageAt
seems to return very raw information, if we can access the non-public state variable values, how do we locate it in the storage?