Ethereum smart contracts in Nim
Go to file
Yuriy Glukhov 31efdaa8c7
Update README.md
2018-11-13 14:15:28 +02:00
examples Renamed test.nim to wrc20.nim 2018-08-10 18:13:55 +03:00
include Added WRC20 challenge example 2018-07-09 10:32:44 +03:00
LICENSE-APACHEv2 Initial commit 2018-07-05 11:39:04 +03:00
LICENSE-MIT Initial commit 2018-07-05 11:39:04 +03:00
README.md Update README.md 2018-11-13 14:15:28 +02:00
eth_contracts.nim Added WRC20 challenge example 2018-07-09 10:32:44 +03:00
eth_contracts.nimble Renamed test.nim to wrc20.nim 2018-08-10 18:13:55 +03:00
postprocess.sh Initial commit 2018-07-05 11:39:04 +03:00

README.md

Ethereum smart contracts in Nim

Disclaimer: WIP

This is a sample of how building eWASM contracts in Nim is possible. Requirements:

  • clang 7.0 or later with WebAssembly support. Most likely has to be built manually.
  • 32bit version of libc. On linuxes it is usually provided by the package manager.
  • wasm2wat and wat2wasm from wabt (WebAssembly binary toolkit)
  • [optional] wasm-gc optimizer

Compiling examples

export WASM_LLVM_BIN=/path/to/llvm/bin/folder
nimble examples

Troubleshooting

  • Emscripten doesn't work! It is not expected to. Use clang with wasm target enabled.
  • clang is difficult to build. No, it's easy. Follow these steps:
tag=release_70
INSTALL_PREFIX=$(pwd)/llvm-wasm
git clone --depth 1 --branch $tag https://github.com/llvm-mirror/llvm.git
cd llvm/tools
git clone --depth 1 --branch $tag https://github.com/llvm-mirror/clang
git clone --depth 1 --branch $tag https://github.com/llvm-mirror/lld
cd ..
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly ..
make -j 4 install
  • C compiler errors: headers not found. Make sure you have 32bit libc installed and visible to your clang.

License

Licensed under one of the following: