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()?

0

1 Answer 1

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.

4
  • Well, what do you mean by "node software" ?
    – Shuai Xu
    Commented Dec 5, 2018 at 20:54
  • Go Ethereum, Parity or similar. Whatever you run to sync with peer-to-peer Ethereum network. Commented Dec 5, 2018 at 21:02
  • Well, run the Go Ethereum. So do you have some idea about that ?
    – Shuai Xu
    Commented Dec 5, 2018 at 21:08
  • Yes, it stores data on your hard disk using LevelDB (guess, not 100% sure). Commented Dec 5, 2018 at 21:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.