My goal is to reproduce the way Ethereum run smart contract in the EVM.
This is purely educative and experimental.
- First script contains my variables declaration and functions.
- A setter function that set the value of a variable from step 1 code.
- A getter function that return the value of that variable.
These 3 scripts are compiled and run independently in the VM. Now I would like to know how I can retrieve
the bytecode from my VM context that will hold the name.
I want to be able to update the bytecode in step 1 with the variable that was set in step 2.
So next time I run the bytecode it still know about that variable value.
Just like when you call a smart contract to execute some functions. Once you are done, the state get updated.
So after my second step. The state is updated in that VM instance. How can I extract that bytecode out of there and use it as my next reference with the the variable value still present?