#blockchain #ethereum #wasm

app chisel

Some useful utilities to transform WebAssembly binaries, most importantly for WebAssembly used in a deterministic / blockchain context

6 releases (breaking)

0.6.0 Jan 15, 2020
0.5.0 Jul 26, 2019
0.4.0 Jun 4, 2019
0.3.0 May 23, 2019
0.1.0 Nov 15, 2018

#2881 in Magic Beans

Download history 5/week @ 2024-02-19 4/week @ 2024-02-26 89/week @ 2024-04-01

89 downloads per month




Build Version

Some useful utilities to transform WebAssembly binaries, most importantly for WebAssembly used in a deterministic / blockchain context, such as with ewasm.



Provide a list of imports (with namespace and name) and replace them with a new set of namespace and name pairs.

This can be very useful together with compilers, which do not support the specification of a namespace in imports yet. As of writing mid-2018, that includes pretty much every compiler (one exception is AssemblyScript).

It supports the same presets as verifyimports.


Removes all exports, but the ones specified.

This comes with some presets:

  • ewasm: keeps main and exported memory
  • pwasm: keeps _call


Remove start function.

This comes with the following preset:

  • ewasm: removes start function if present


Verifies that the module's imports are compliant with the provided import interface. Can be set to require the existence of the entire import set, or just the validity of existing imports with matching identifiers. Can be set to allow or prohibit unlisted additional imports.

The following presets are provided:

  • ewasm: Verifies the ewasm EEI. Disallows unlisted imports, and does not require that the entire interface be imported.
  • debug: Debug utilities for ewasm.
  • bignum: Big-number library for ewasm.
  • eth2: Verifies imports according to Scout.


Verifies that the module's exports are compliant with the provided export interface. Can be set to allow or prohibit unlisted additional exports.

The following presets are provided:

  • ewasm: Verifies that the main function and memory is exported. Disallows any unlisted exports.


Removes selected sections from the module.


Wraps module into an ewasm-compatible constructor. It has two presets:

  • memory: wrap the module as a pre-defined memory section
  • customsection: include the module as a custom section


Re-serializes the module. It will drop any unknown (custom) sections.


If there is a start section, export it as main (replacing any pre-existing main export) and remove the start section


Wraps wasm-snip and turns on removing Rust formatting and debugging from wasm.


Drops the NamesSection if present.


chisel is available as a command line tool. It supports two usage patterns, config-driven and unix-style, also known as oneliner.

It uses features implemented in the library as well in wasm-gc and wasm-utils. It comes with a configuration file chisel.yml.

chisel run: searches for chisel.yml in the current directory, if not specified otherwise using the flag -c. Runs the modules specified in the configuration, outputs a new file if any changes were made by translator or creator modules, and prints a brief report of each module's results.

chisel: Invokes unix-style mode. It requires the flags --modules and --config.

  • --modules takes a comma-separated list of modules to be invoked. An example of a valid module list is: --modules remapimports,verifyimports

  • --config takes a comma separated list of key-value options for the modules to be invoked, in the form module.option=value. An example of a valid configuration is: --config remapimports.preset=ewasm,verifyimports.preset=ewasm

Configuration file

The configuration file starts with a ruleset entry, where the name can be anything. Inside the ruleset are its options.

The only required field is file, which specifies the path to the Wasm binary to be chiseled.

Optionally, one may also specified an output file through the output option.

It is important to note that the configuration parsing will not work if all the rules are prepended with a hyphen. Please avoid this until the configuration parser is generalized.

  file: "target/wasm32-unknown-unknown/release/sentinel.wasm"
  output: "out.wasm"
    preset: "ewasm"




A changelog is available.



Apache 2.0.


~292K SLoC