English | 简体中文
TCWasm Compile Tool, providing local compilation tools and contract library file source code.
If you don't want to install the local environment, it is recommended that you use the web online compilation tool.
- Catalyst Thunderchain IDE for the web. Thunderchain contract compilation debugging tool, support evm and wasm.
- Support OS Debian/Ubuntu
- Install git, cmake > 3.4.3, make, python2.7.x to ensure that the disk free space is greater than 5GB
- Execute
wasm_build.sh
intcvm.cdt
directory
- Execute
source env.sh
intcvm.cdt
directory and import the environment variable
Or - add at the end of the
~/.bashrc
file
TCVM_CDT_DIR=<Absolute path of tcvm.cdt>
TCVM_CDT_BIN=<Absolute path of tcvm.cdt>/bin
export TCVM_CDT_DIR
export TCVM_CDT_BIN
- Execute
source ~/.bashrc
Execute in the contract project directory
cmake -D CON_DIR=<contract project directory> <Absolute path of tcvm.cdt>
For example, in the example/hello directory of this repository, execute
cmake -D CON_DIR=${PWD} ../../tcvm.cdt/
make
After that, generate the output.wasm
contract binary in the example/hello
directory.
Output.wasm
is the generated bytecode file, registered as a contract code.
- Guide Wasm Contract Guidance
#include "tcmethod.hpp"//Declare contract method
class Hello : public TCBaseContract{ //TCBaseContract Contract base class
public:
const char* HelloThunder(){ //Contract class public member function
return "Hello Thunderchain"; //Return Value
}
};
TC_ABI(Hello, (HelloThunder)) //TC_ABI Declare contract external interface
See the example
folder for more examples.
Test contract recommendation tool