Skip to main content

29 docs tagged with "Wire CDT"

View all tags

CDT (Contract Development Toolkit)

Contract Development Toolkit (CDT) is a C/C++ toolchain targeting WebAssembly (WASM) and a set of tools to facilitate development of smart contracts written in C/C++ that are meant to be deployed to a Wire blockchain.

cdt-abidiff

The cdt-abidiff tool is used to check differences between two ABI files.

cdt-cc

To manually compile the source code, use cdt-cc and cdt-ld as if it were clang and lld. All the includes and options specific to Wire Sysio and CDT are baked in.

cdt-cpp

To manually compile the source code, use cdt-cpp and cdt-ld as if it were clang and lld. All the includes and options specific to Wire Sysio and CDT are baked in.

cdt-init

This tool is used to generate a skeleton smart contract and directory structure.

cdt-ld

The cdt-ld tool is a the custom web assembly linker for Wire Sysio framework smart contracts.

Contract Development Toolkit (CDT)

CDT is a toolchain for WebAssembly (Wasm) and a set of tools to facilitate contract writing for the Wire framework. In addition to being a general-purpose WebAssembly toolchain, Wire-specific optimizations are available to support building Wire smart contracts. This new toolchain is built around Clang 7, which means that CDT has most of the current optimizations and analyses from LLVM.

Data design and migration

Modifying a deployed multi-index table structure may be done by selecting one of the different strategies outlined below:

debugging-a-smart-contract

In order to be able to debug your smart contract, you will need to setup a local nodeop node. This local nodeop node can be run as separate private testnet or as an extension of a public testnet. This local node also needs to be run with the contracts-console option on, either --contracts-console via the command line or contracts-console = true via the config.ini file and/or by setting up logging on your running node and checking the output logs.

Error handling

Contracts can use uint64t error codes as an alternative (and shorter) means of signaling error conditions, as opposed to string error messages. However, Wire Sysio and CDT reserve certain ranges of the uint64t value space for their own purposes. Contract developers must be aware of the following ranges and restrictions:

Getting Started

The diagram below serves as a comprehensive roadmap, detailing the sequential steps required to effectively utilize the documentation provided. For optimal understanding and efficiency, it’s important to follow the order of the steps, beggining with this article, contunuing with setting up your local environment and progressing through the smart development contracts section.

index

- Understanding ABI Files

Installation

For installation instructions, please see Wire CDT README.md .

manually_write_an_ABI_file_explained

- Advanced features of the newest version of the ABI will require manual construction of the ABI, and odd and advanced C++ patterns could capsize the generator's type deductions. So having a good knowledge of how to write an ABI should be an essential piece of knowledge of a smart contract writer.

Naming Conventions

When implementing Wire smart contracts and when storing data in a Wire blockchain, it is important to follow the established conventions for naming accounts, actions, tables, etc.

Native Tester Compilation

As of v1.5.0 native compilation can be performed and a new set of libraries to facilitate native testing and native "scratch pad" compilation. cdt-cc, cdt-cpp and cdt-ld now support building "smart contracts" and unit tests natively for quick tests to help facilitate faster development (note the default implementations of a lot of the Antelope intrinsics (aka host functions) are currently asserts that state they are unavailable, these are user definable.)

troubleshooting

When sending an action to the blockchain you get the error below