EVM Toolkit (etk)

EVM Toolkit (etk) is a comprehensive collection of tools designed for writing, reading, and analyzing EVM bytecode. Developed in Rust, this toolkit simplifies the process of working with Ethereum Virtual Machine (EVM) bytecode, providing developers with powerful utilities to streamline their workflow.

Overview

The etk toolkit includes several key components:

  • eas: A command-line assembler for EVM bytecode.
  • disease: A disassembler for reading EVM bytecode.
  • etk-asm: A suite of tools for assembly and disassembly operations.

These tools enable developers to write EVM bytecode with ease, read and understand existing bytecode, and perform various analyses to ensure code correctness and efficiency.

Documentation

For a comprehensive guide on using etk, refer to the etk book. This documentation includes:

Examples can also be found in the etk-asm/tests/asm directory in the repository. For further questions or community support, join the Telegram chat.

Quickstart

Installation

To install etk, you need the latest stable version of rustc. Use the following command to install the necessary components:

cargo install --features cli etk-asm etk-dasm

Project Templates and Syntax Highlighting

  • etk-Foundry Template: etk-Foundry Template provides a project template for getting started quickly.
  • vim-etk: Syntax highlighting for Vim users can be added with vim-etk.

Usage

Here's a simple example to illustrate how to use etk for assembling and disassembling EVM bytecode.

contract.etk:

push1 42
push1 13
add
pop
$ eas contract.etk out.hex
$ disease --hex-file out.hex
   0:   push1 0x2a
   2:   push1 0x0d
   4:   add
   5:   pop

Dependencies

etk requires z3 to build. For instance, on Ubuntu, you can install z3 and its development libraries using the following commands:

sudo apt-get update -y
sudo apt-get install -y z3
sudo apt-get install -y libz3-dev

Ensure that the installation completes without errors by checking the system logs.

EVM Toolkit (etk) provides a powerful set of tools for developers working with EVM bytecode, facilitating tasks from assembly to analysis, all within the robust and efficient Rust ecosystem.

Similar Projects