Skip to content

Getting started


To build with Etch, you will need a running node.


At the root of your ledger installation directory cd into build folder.

Run make etch.


At the root of your ledger installation directory cd into apps/etch.

Run ./etch with filename, flags, and arguments:

./etch [options] <filename> -- [script args].

For example:

./etch hello-world.etch -data test.json.

This runs a hello-world.etch file and produces a json file containing info on the data required by the contract.

Hello world with Etch

Let's use the etch simulator for the development process. Unlike Smart Contracts, Etch code needs a main() function as it's entry point.

function main()

    printLn("Hello, world");


You can test this contract with the etch executable. Save this code snippet to hello_world.etch Run the following from your build directory:

./apps/etch/etch hello_world.etch

This produces an output similar to:

 F E ╱     etch v0.4.1-rc3
   T C     Copyright 2018-2019 (c) Fetch AI Ltd.

Hello, world!

main is the default runner function in etch. When submitting the smart contract to the ledger, we do not need the main function as it is inaccessible to the ledger code.

Compile and run two or more etch files

It is possible to compile and run two or more etch files in one go.

The files are not order dependent and the single main() function can be in any of the files.

For example, run ./etch file-1.etch file-2.etch file-n.etch.

Etch playground

You can run all the examples in these docs in the etch playground here as well as on the command line.