Command Reference

chaintool build

Builds your chaincode project into a executable. When used locally, chaintool build allows a developer to verify that their project compiles without errors or warnings before deployment. Validating peers also each use chaintool build to prepare a chaincode archive for execution on the actual blockchain. Developers achieve fidelity in chaincode development workflows because they have access to the same build environment that will eventually be used when their application is deployed.

Various artifacts are emitted to ./build, depending on the platform. For org.hyperledger.chaincode.golang:

  • ./build/src: stub, protobufs, etc
  • ./build/deps: direct and transitive dependencies of your chaincode, as retrieved by “go get”. NOTE: this option is likely to default to disabled in the future, since it is not a good idea for a validating peer to be pulling dependencies down. Rather, there should be some fixed number of dependencies that are implicitly included with the platform. For now, we pull things in dynamically.
  • ./build/bin: the default location for the binary generated (override with -o)

chaintool clean

Cleans a chaincode project. This typically translates to removing the ./build directory, but platforms are free to define this as they see fit and may perform additional or alternative operations.

chaintool package

Packages the sourcecode, interfaces, chaincode.yaml, and other project data into a .car file suitable for deployment. Note that any artifacts generated by commands such as build and buildcar are not included but rather will be rebuilt locally by each validating peer in the network.

chaintool ls

Displays the contents of an existing .car file.

$ chaintool ls ./build/org.hyperledger.chaincode.example02-0.1-SNAPSHOT.car
|------+------------------------------------------+--------------------------------------------------------|
| Size |                   SHA1                   |                          Path                          |
|------+------------------------------------------+--------------------------------------------------------|
| 438  | d28b22c7c30506af926dcb5bc8b946ac35ddac7f | chaincode.yaml                                         |
| 3856 | 542d088197e1a46bc21326e67e5d84d2d2807283 | src/chaincode/chaincode_example02.go                   |
| 143  | 7305f65e18e4aab860b201d40916bb7adf97544f | src/interfaces/appinit.cci                             |
| 375  | 9492a1e96f380a97bba1f16f085fc70140154c65 | src/interfaces/org.hyperledger.chaincode.example02.cci |
|------+------------------------------------------+--------------------------------------------------------|
Platform:            org.hyperledger.chaincode.golang version 1
Digital Signature:   none
Raw Data Size:       4812 bytes
Archive Size:        2371 bytes
Compression Alg:     gzip
Chaincode SHA3:      f7026e0675b22a9d78b9f7f0cb97c93165bdefedc86de97f00e76b506c707b4ddbdfe97ad702ad600eae518891b9f0f1c8cb9a8b29b83908c2f6d46a6bcf4ecd

chaintool unpack

Unpacks a .car archive into the filesystem as a chaincode project.

chaintool buildcar

Combines unpack with build by utilizing a temporary directory. This allows a project to be built from a .car file without explicitly unpacking it first, as a convenience.

chaintool proto

Compiles a .cci file into a .proto file, suitable for developing clients using standard protobuf-based tooling.

chaintool inspect

Retrieves metadata from a running instance, optionally saving the interface definitions to a local directory.

$ chaintool inspect -n mycc
Connecting to http://localhost:3000/chaincode
|---------------------+--------------------------------------------|
|         Fact        |                    Value                   |
|---------------------+--------------------------------------------|
| Application Name    | org.hyperledger.chaincode.example02        |
| Application Version | 0.1-SNAPSHOT                               |
| Platform            | org.hyperledger.chaincode.golang version 1 |
| Chaintool Version   | 0.7                                        |
|---------------------+--------------------------------------------|
Exported Interfaces:
    - appinit
    - org.hyperledger.chaincode.example02

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. s