I'm having trouble figuring out how variables are stored on the block chain. How can a smart contract be immutable and have global variables that can change?
Just say I a simple contract like below...
contract SimpleStorage {
uint storedData;
function set(uint x) {
storedData = x;
}
function get() constant returns (uint) {
return storedData;
}
}
I understand this code will be broken down into byte code and stored on the blockchain. What I don't understand is where the storedData variable will be saved when I set a new value on it. Wouldn't the bytecode on that block need to be updated once I update the value?