[Ethereum] About geth’s method eth_call and simulating state changing transactions

go-ethereumtransactions

I am running my own local Geth node and my main objective is to simulate some transactions and see how does the state of the blockchain change from the current one. For instance if I simulate a tx where A sends 3Eth to B, after the simulation I would like to see that in a new simulated block where only that tx was mined, addresses A and B would change. Then I could myself query from this new state the balances using web3.

My questions are:

  1. As I said I'm currently running my own local node. If I simulate a tx and thus create a new state of the blockchain, how would that interfere with my REAL node? Would it get de-sync? Would Geth save a parallel temporary (simulated) state so I can interact with it while the original one keeps getting sync? Would it only save as a new temporary state the addresses that changed?
  2. From what I've read around the way to go is to use geth's method eth_call. However I'm not sure if this is only for calls, or also for state changing transactions (what I'm actually interested in)?
  3. Assuming eth_call is the correct method to call, how could I see what addresses' state changed (not necessarily only eth balances, could also be storage change, etc) inmediately after simulating the transaction?
  4. I know that Truffle has an option to --unlock addresses with permission modifiers so you can simulate transactions calling those addresses anyway, does Geth provide something similar?

I know these are quite some questions, thanks!

Best Answer

  1. It would create a fork, which is soon to be rejected by the rest of the nodes, thus you get desynced, yes.
  2. No, it's only for reading, for writing you need eth_sendTransaction. More on this here: https://eth.wiki/json-rpc/API
  3. I'm not sure how much debugging Geth does provide but this might help: https://github.com/trufflesuite/truffle-plugin-debugger. Simply configure Truffle to connect your Geth node.
  4. I don't know about this.
Related Topic