Skip to main content

Compile Contract

To compile contract you will need inery cdt installed on ubuntu local machine inery-cpp compiler will compile your contract written in C++ and create 2 files, wasm and abi. Wasm is Web Assembly

Setup compilation

Create C++ file named as your contract class, that is "inrcrud" in this example

 nano inrcrud.cpp

Paste code inside it and save (Crtl+S)

Create directory named as your C++ contract file and put inrcrud.cpp inside it

 mkdir inrcrud
mv inrcrud.cpp inrcrud
cd inrcrud

Compile it

Inside inrcrud directory now there is C++ code file inrcrud.cpp Execute this command to compile it to wasm and abi :

 inery-cpp inrcrud.cpp -o inrcrud.wasm

output :

action <create>
action <read>
action <update>
action <destroy>

Contract is sucessfully compiled and in inrcrud directory now there should be wasm and abi files

 ls
inrcrud.abi inrcrud.cpp inrcrud.wasm