Skip to content

evmdasm

tintin edited this page Oct 11, 2018 · 1 revision

Library

The idea 💡

Working with EvmBytecode

  • Create an EvmBytecode(<str_bytecode>) object from the contract bytecode.
  • disassemble it by calling EvmBytecode().disassemble() to receive an EvmInstructions() object

Working with EvmInstructions

  • Take a list of [evmdasm.Instruction, ...] or the disassembly from EvmBytecode().disassemble()
  • manipulate the list
    • insert new evmdasm.Instructions
  • draw statistics
    • get stack balance - positive value means more pushes than pops, negative value means more pops than pushes
    • get required gas - to return the sum of gas for every instruction in the sequence. does not take account of branches and terminating instructions
  • assemble the list of instractions to an EvmBytecode() object
    • modify, transform or print the bytecode

Clone this wiki locally