2

It's known to all that once the smart contract is deployed to the Ethereum network, it won't be modified. But what about the value of a contact's variant? Say a smart contract looks like:

...
contract Hello{
      uint256 var1 = 10;
      function changeVar1() public{
             var1 = 100;
      }
}
...

So my question is where is the variant var1 stored in Ethereum? Is it a part bytecode of the smart contract?(I guess it is stored this way) If so, its value exists in memory of EVM when you run the contract and each time you run the smart contract again the value of var1 is initialized as 10. If not, where is it stored exactly ? And can I see the value of var1 changed by the previous transaction which called the function changeVar1()?

Shuai Xu
  • 101
  • 1
  • 4

1 Answers1

1

Ethereum node storage system depends on what node software you are running. It is an implementation detail.

For example, Parity uses RocksDB and you can find these files on your disk when running a Parity node.

Furthermore you can run your node in the full archive mode and it stores all historical states on the disk. It is around 2 TB at the moment.

Mikko Ohtamaa
  • 22,269
  • 6
  • 62
  • 127