wasm-cdt

command module
v0.0.0-...-c2a49b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

README

wasm-cdt

justitita wasm contract development kit

Build Status codecov

Getting started

Running it then should be as simple as:

$ make all
Testing
$ make test
Build Docker Image

We use docker so that wasm-cdt command can run on any type system. You can compile from the source code or directly use pre-build binary to build docker image.

  1. Make build directory, structure:

     -\
       -llvm\
       -misc\
       -Dockerfile
       -wasm-cdt
    

    llvm: llvm binary files

    misc: base header files

    Dockerfile: Docker build file

    wasm-cdt: go build binary file.

  2. Start Building:

     $ docker build -t wasm-cdt .
     $ docker run –rm -it wasm-cdt --help (verify your image)
    

Write Wasm Contract

  1. For your C file must have invoke method, and invoke is the only entry point of the contract. invoke method format:

    $ char *invoke(int argc, char *argv[])
    
  2. You can use justitia.h in your contract to get info relate to chain:

    #include <stdio.h>
    #include <string.h>
    #include "justitia.h"
    
  3. demo.c is our demo contract, you get some detail to write wasm contract.

  4. To deploy a contract, you can use our deploy command.

    docker run --rm -it -v ${local_workspace}:/workspace wasm-cdt deploy -f ${wasm_file} -ac ${deploy_account} -ep ${endpoint_address}
    
  5. To call wasm contract, you can use our rpc api wasm-call and wasm-transaction.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL