Skip to content

tcvm-cdt (Contract Development Toolkit) is a suite of tools used to build tc-wasm contracts

License

Notifications You must be signed in to change notification settings

regentropfenbinacs/tcvm-cdt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 简体中文

TCWasm Compile Tool

License Apache 2

TCWasm Compile Tool, providing local compilation tools and contract library file source code.

Contract compilation

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.

Guided Installation (Building from local)

Install the wasm build environment
  • 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 in tcvm.cdt directory
Import environment variables
  • Execute source env.sh in tcvm.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
Compile contract

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.

Docs

  • Guide Wasm Contract Guidance

Contract Example

Hello Thunderchain
#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.

Contract Test

Test contract recommendation tool

  • tc-wasm Thunderchain virtual machine cmd/tcvm Contract bytecode debugging tool
  • catalyst Catalyst-Thunderchain IDE Thunderchain contract compilation debugging tool, support evm and wasm.

About

tcvm-cdt (Contract Development Toolkit) is a suite of tools used to build tc-wasm contracts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.5%
  • C 2.8%
  • HTML 0.3%
  • Python 0.3%
  • CMake 0.1%
  • Awk 0.0%