An open API service indexing awesome lists of open source software.

https://github.com/platonnetwork/platon-cdt

Wasm contract Development Kit
https://github.com/platonnetwork/platon-cdt

Last synced: about 1 month ago
JSON representation

Wasm contract Development Kit

Awesome Lists containing this project

README

        

![logo](./docs/images/platon-cdt-logo.png)

[中文](./README_cn.md)

# 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
- Tar
- Wget
- Golang 1.14+

### Ubuntu

**Required:** 18.04

- **Install Dependencies**

``` shell
sudo apt install build-essential cmake libz-dev libtinfo-dev tar wget
```

- **Get Source Code**

```shell
git clone https://github.com/PlatONnetwork/PlatON-CDT.git
cd PlatON-CDT
git checkout feature/wasm
```

- **Build Code**

- **Build with script**

``` sh
./scripts/build.sh
cd build
sudo make install
```

- **cmake build**

``` sh
mkdir build && cd build
cmake ..
make -j
sudo make install
```

Some common cmake options:
- `-DTEST=ON` To build a unit test module, you need to install go1.13 and above first (the unit test module is not built by default).
- `-DCMAKE_INSTALL_PREFIX=directory` Specify the directory to install cdt related tools and dependent libraries (default `/ usr / local`).
- `-DCDT_BUILD_TYPE=type` The valid options for the build type are Debug and Release. Debug mode assertion checking will be enabled, and the log file will print debugging and error information. (The default is Release).

If you are building a unit test module, you need to download PlatON-Go in the ./tools/platon-test/node directory, and compile it after the download is complete.

```shell
cd tools/platon-test && mkdir node && cd node
git clone [email protected]:PlatONnetwork/PlatON-Go.git --recursive
cd PlatON-Go
git checkout ${BRANCH}
make all
```

## Usage

If you use the CMAKE_INSTALL_PREFIX option to specify the installation directory, you must add the executable file path generated by PlatON-CDT to the PATH environment variable before using PlatON-CDT (installed in the /usr/local/bin directory by default).

``` bash
platon-cpp test.cpp
```

run command could generate test.wasm and test.abi.json in current dirctoy.

## License

GNU General Public License v3.0, see [LICENSE](https://github.com/PlatONnetwork/PlatON-CDT/blob/master/LICENSE).