C++ contract compilation tool

Updated at:

The Ant Blockchain contract platform supports C++ contract development. You can compile contract source code with the mychain.mycdt compilation tool from Ant Blockchain or online using Cloud IDE. This topic provides installation instructions for the mychain.mycdt tool.

Note

For more information, see Use Cloud IDE.

mychain.mycdt is an Ant Blockchain tool that compiles contract code into wasm bytecode. Installation packages vary by operating system. Download the package that corresponds to your operating system:

Operating system

System version number

Installation package

Linux

centos7.2

MYCDT-2.19.3-Linux-x86_64.tar.gz

macOS

High Sierra 10.13.6

MYCDT-2.19.3-Darwin-x86_64.tar.gz

The following examples show how to install the mychain.mycdt tool and verify the installation.

Linux installation example

  1. Download the mychain.mycdt installation package. Decompress the package and place it in the $HOME directory.

    $ cd $HOME
    $ tar xf MYCDT-2.19.3-Linux-x86_64.tar.gz
  2. Run the following command to export the environment variable.

     $ export PATH="$HOME/MYCDT-2.19.3-Linux-x86_64/bin:$PATH"
  3. Run the following command to verify the installation.

     $ my++ --version

    If the following message appears, the installation is successful.

     my++ version 2.19.3

macOS installation example

  1. Download the mychain.mycdt installation package. Decompress the package into your desired installation directory, such as /HOME.

  2. Run the following commands to install mychain.mycdt.

     $ cd /HOME
     tar -zxvf MYCDT-2.19.3-Linux-x86_64.tar.gz
  3. Run the following command to export the environment variable.

     sudo export PATH=$PATH:/HOME/MYCDT-2.19.3-Darwin-x86_64/bin
  4. Run the following command to verify the installation.

     $ my++ --version

    If the following message appears, the installation is successful.

     my++ version 2.19.3

Additionally, if you use a C++ Integrated Development Environment (IDE) such as VsCode or CLion to write contracts and want to enable features such as syntax suggestions, add the include directory from the mychain.mycdt installation to the header file directory configuration in your IDE. For example, on macOS, the MYCDT header file directory is $HOME/MYCDT-2.19.3-Darwin-x86_64/wasm-sysroot/include.