After a long debugging I found that I had two following problems in a private ethereum network using geth:

  • If I have a require statement then the code is not executed on the EVM. The solution I found was to use a boolean and a if (test) { ...} statement
  • Some code did not work to the end (that is emission of emit Statement(...) in my case). The problem appeared to be insufficient gas. The raw solution to that was to double the gas as given by eth_estimate_gas.

What would be the real solution to those problems? What documentation exist about this kind of problems?

  • 4
    Please share your code (only the part relevant to this question). Your verbal description is rather obscure, and it does not provide a clear picture. Mar 21, 2019 at 12:13
  • What does the genesis file of your private network looks like? What version of solidity compiler are you using? The REVERT opcode is new since byzantinum fork, if your genesis doesn't have those opcodes enabled and the compiler is less than two years then the compiled bytecode will fail with invalid OPCODE. Gas estimation is tricky. What tools/framework do you use? I usually add 10% on top of estimation.
    – Ismael
    Mar 22, 2019 at 3:40
  • After a long search, I found the solution to the problem. I was calling the eth_estimateGas with a different code than the one with the rawTransaction. More precisely the value array was unset in the eth_estimateGas while it was set in the rawTransaction call. Jun 17, 2019 at 10:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.