Introduction to Chaintool - A Hyperledger Fabric Chaincode Compiler¶
chaintool is a utility to assist in various phases of Hyperledger Fabric chaincode development, such as compilation, test, packaging, and deployment. A chaincode app developer may express the interface to their application in a highlevel interface definition language, and chaintool will generate (1) chaincode stubs and (2) package the chaincode for convenient deployment.
This provides the following benefits to chaincode development:
- a language neutral description of the application interface
- a language neutral packaging of chaincode for deployment
- on the wire endian neutrality
- built-in field validation
- forwards/backwards compatiblity management
- stub function dispatch
- build/package management
- a unified query, signing, hashing, and introspection interface
Working with chaintool generally involves structuring your chaincode project root a specific way and then running various subcommands. Some commands, such as build, clean, and package, are used to manage general development activities. These commands expect to be executed from within your project root by default, but may also be executed from anywhere using the “-p” switch.
Other commands such as buildcar, unpack, and ls are designed to operate against a Chaincode Archive (CAR) from a previous package operation. These commands expect a path to a CAR file.
In all cases, you may obtain subcommand specific help by invoking “chaintool $subcommand -h”. For example:
$ chaintool package -h chaintool version: v0.10.1 Description: chaintool package - Package the chaincode into a CAR file for deployment Usage: chaintool package [options] Command Options: -o, --output NAME path to the output destination -c, --compress NAME gzip compression algorithm to use -p, --path PATH ./ path to chaincode project -h, --help
This work is licensed under a Creative Commons Attribution 4.0 International License. s