Code Monkey home page Code Monkey logo

c_ewasm_contracts's Introduction

This repository has some Ewasm contracts written in C.

Get dependencies.

# hopefully you have llvm 8+, check:
clang --version
# if not
make llvm-install	# should do this manually since it may need a restart. Copy the Makefile recipe or see LLVM getting started website.
# Note: LLVM version 8+ support Wasm by default. Earlier versions must be compiled with experimental wasm flag, and have different linker. We use the linker from LLVM 8+.

# install everything else
make install
# or install things individually
make wabt-install
make binaryen-install
make pywebassembly-install

# you can also install things anywhere in your system, and update paths in the Makefile or as arguments

Compile stuff.

# compile contracts in src/
make all

# compile individual project with a recipe in the Makefile
make blake2b_ref

# compile arbitrary my_contract.c
make PROJECT=my_contract SRC_DIR=path/to/my_contract/src/dir

# compile with custom tool directories
make WABT_DIR=path/to/wabt/build/ LLVM_DIR=path/to/llvm/binaries PROJECT=mul256

# clean up
make clean

WARNING: Ewasm is not yet finalized. This toolchain is changing. There are experiments in the src directory.

NOTE ABOUT C++: Basic things like std::vector require memory managment, which most standard C++ libraries implement as system calls. Ewasm doesn't support system calls, so memory management must be done in Wasm. So far, a custom malloc() is in ewasm.h, but other things are still needed before we can try to compile against C++ standard library without requiring system calls.

c_ewasm_contracts's People

Contributors

poemm avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.