I would like to know if is possible to inquiry variable values using older blocks.
For example I have
contract Simple {
string32 message public;
function Simple() {
message = msg.sender;
}
}
Is it possible to retrieve the value of the message 1 month ago? Is there a method that let me inspect such variable on particular blockheight?
Is there a method that retrieves all different values that are found on the blockchain?
Thank you very much.
Best Answer
There is no way for a contract to access a variable that is no longer located in storage. You can access these variables from web3, however.
I would recommend using Events, which you could index by timestamp to make searching easier.
With web3, there is a possible solution (probably not the fastest or the most elegant, but it is to show how it can be done). We retrieve the first variable of the contract (index 0), which is of type uint:
You can try it on Testnet, where the contract with this address has been deployed.