Ethereum / Geth: How to execute view code without deploying a contract?

Viewed 306

Ethereum/smart contracts enthusiasts,

I want to execute some code which does not modify the state variables on my own Geth ETH-Node without deploying a contract. Is that somehow possible?

My current thoughts: I have debugged the geth a little bit. I found by executing a view function the StaticCall is executed from the evm class. It seems at this point I can also inject some bytecode of my own view functions, without deploying it. From my understanding, a view function does not edit some state variables it only reads and returns them. This would mean I can technically do that, without destroying the chain. But this way of changing the code seems to be a little bit oversized, is there a simpler way?

Thanks.

1 Answers

It is not possible. You need EVM to execute the code. The EVM is an entirely isolated and sandboxed runtime environment. There are some key elements that are required by the execution environment to execute the code.

enter image description here

Deploying a contract is creating an instance of a contract. Then you interact with the contract instance

Related