1

I'm just engaging in geth development and was trying to put some changes into evm opcode implementation(functions like opAdd) for debugging.

After compilation done, I found that there is a command 'evm' that allows me to run bytecode without deploying it to a private chain.

However the help message is confusing, and guide about this command is limited. Is there any guide or example to help learn more about the usage of this command? Or I should just keep using 'geth' instead of 'evm'?

Thank you!

1 Answer 1

1

This answer is so belated but may help late-comers. First, the old evm tool shipped with geth has been unmaintained for about four years. So it had been deprecated before the question was posted. However, the new one with README compiled by the command make all is still active and added many useful functions.

Second, if you still need this tool, please read its help information by executing evm. Sorry for some Chinese characters, but you would not encounter problems assisted with translation and easily understand its exact meaning. Also, Hyperledger Besu and outdated evmlab offer some examples. I mainly use it for stack tracer logs with evm --codefile FILE_PATH --debug --statdump run.

At last, the EVM Tracing and the debug JSON-RPC probably are the nice choices now.

evm [global options] command [command options] [arguments...]

VERSION:
   1.10.17-stable-25c9b49f

COMMANDS:
   compile                            compiles easm source to evm binary //evm 抽象语法树,已经废弃
   disasm                             disassembles evm binary //字节码生成操作码
   run                                run arbitrary evm binary //运行字节码,预期的下一个参数是一串16进制字节码,而不是文件
   statetest                          executes the given state tests //不清楚它检查状态输入是什么
   transition                         executes a full state transition //不清楚状态转移的工具是什么
   transaction                        performs transaction validation
   block-builder                      builds a block
   help                               Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --bench                            benchmark the execution //基准测试
   --create                           indicates the action should be create rather than call
   --debug                            output full trace logs //跟踪执行堆栈、存储
   --verbosity value                  sets the verbosity level (default: 0)
   --code value                       EVM code //直接在命令行中以字节码为参数
   --codefile value                   File containing EVM code. If '-' is specified, code is read from stdin //从文件在寻找输入
   --gas value                        gas limit for the evm (default: 10000000000)
   --price value                      price set for the evm (default: 0)
   --value value                      value set for the evm (default: 0)
   --dump                             dumps the state after the run
   --input value                      input for the EVM //部署时的构造函数参数
   --inputfile value                  file containing input for the EVM //从文件中读取构造函数参数
   --memprofile value                 creates a memory profile at the given path
   --cpuprofile value                 creates a CPU profile at the given path
   --statdump                         displays stack and heap memory information
   --prestate value                   JSON file with prestate (genesis) config
   --json                             output trace logs in machine readable format (json)
   --sender value                     The transaction origin
   --receiver value                   The transaction receiver (execution context)
   --nomemory                         disable memory output
   --nostack                          disable stack output
   --nostorage                        disable storage output
   --noreturndata                     enable return data output
   --help, -h                         show help
   --version, -v                      print the version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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