/PlatON-CDT

Wasm contract Development Kit

Primary LanguageC++GNU General Public License v3.0GPL-3.0

logo

中文

PlatON-CDT (Contract Development Toolkit)

PlatON-CDT is a toolchain for WebAssembly(WASM) and set of tools to faciliate contract writing for the PlatON platform.

Build

Required

  • GCC 5.4+ or Clang 4.0+
  • CMake 3.5+
  • Git
  • Python

Ubuntu

Required: 16.04+

  • Install Dependencies
sudo apt install build-essential cmake libz-dev libtinfo-dev
  • Get Source Code
git clone https://github.com/PlatONnetwork/PlatON-CDT.git
cd PlatON-CDT
git submodule update --init --recursive
  • Build Code
cd PlatON-CDT
mkdir build && cd build
cmake .. 
make && make install

Windows

Required: MinGW-W64 GCC-8.1.0

NOTES: MinGW and CMake must be installed in a directory without space.

  • Get Source Code
git clone https://github.com/PlatONnetwork/PlatON-CDT.git
cd PlatON-CDT
git submodule update --init --recursive
  • Build Code
cd PlatON-CDT
mkdir build && cd build
cmake -G "MinGW Makefiles" .. -DCMAKE_INSTALL_PREFIX="C:/platon.cdt" -DCMAKE_MAKE_PROGRAM=mingw32-make
mingw32-make && mingw32-make install

Usage

Skeleton Smart Contract Without CMake Support

  • Init a project
platon-init -project example -bare
  • Build contract
cd example
platon-cpp -o example.wasm example.cpp -abigen

Skeleton Smart Contract With CMake Support

  • Init CMake project
platon-init -project cmake_example
  • Build contract

    • Linux
    cd cmake_example/build
    cmake ..
    
    • Windows

    Required:

    cd cmake_example/build
    cmake .. -G "MinGW Makefiles" -DPLATON_CDT_ROOT=<cdt_install_dir>

License

GNU General Public License v3.0, see LICENSE.