CHAINCODE_SOURCE_DIR
: Contains the contents placed insrc
directory. This generally is the source code of the chaincode. In case of chaincode as a service, this will have aconnection.json
file.CHAINCODE_METADATA_DIR
: Contains themetadata.json
file. Add the mandatory parameters to let the peer node better decide if this shall be the right builder to be used.BUILD_OUTPUT_DIR
: The directory where the output of the build step is stored. This will haveconnection.json
file in case of chaincode as a server.RELEASE_OUTPUT_DIR
: The directory from where the peer picks up the artefacts for execution. In case of chaincode as a service, copy theconnection.json
file to the${RELEASE_OUTPUT_DIR}/chaincode/server
directory. The other kind of metadata that gets consumed isMETA-INF
. It shall be placed in${RELEASE_OUTPUT_DIR}/statedb/couchdb/indexes
directory.RUN_METADATA_DIR
: Used inrun
, which is optional. This directory is populated with theconnection.json
file. The file has connection information for a chaincode to connect with the peer node.
The connection.json
file consumed by the chaincode has the following
parameters, these are populated by the peer node. Note that this is different
from the connection.json
that you would compose to run chaincode as a server.
{
"client_key": "The PEM encoded client key generated by the peer that must be used when the chaincode establishes its connection to the peer.",
"client_cert": "The PEM encoded TLS client certificate generated by the peer that must be used when the chaincode establishes its connection to the peer."
"chaincode_id": "The unique ID associated with the chaincode package. Generated by the peer node."
"peer_address": "The address in host:port format of the ChaincodeSupport gRPC server endpoint hosted by the peer."
"root_cert": "The PEM encoded TLS root certificate for the ChaincodeSupport gRPC server endpoint hosted by the peer.",
"mspid": "The local mspid of the peer."
}
Detect if the installed chaincode shall be packaged and run using this
builder definition. All the inputs to the detect
command are read only.
Expectation at this step is that the code returns a success return value.
Command exit status set to 0
. You can consider that the peer would make
a call as following
detect CHAINCODE_SOURCE_DIR CHAINCODE_METADATA_DIR
Build the source directory contents, optionally making use of metadata. Place the generated files to the output directory for later execution.
Expectation at this step is that the chaincode is built and the generated artefacts are placed in the expected output directory. You can consider that the peer would make a call as following
build CHAINCODE_SOURCE_DIR CHAINCODE_METADATA_DIR BUILD_OUTPUT_DIR
Release the artefacts for peer to consume. Copy from the build step, the artefacts that the peer can consume. Generally the peer node consumes indexes metadata and the external chaincode server information.
release BUILD_OUTPUT_DIR RELEASE_OUTPUT_DIR
Run is not required in case of chaincode as a service. However, if you
are using a custom chaincode builder to run the chaincode. Then this step
consumes the connection.json
file generated by the peer node. This file
is available in the RUN_METADATA_DIR
directory.
run BUILD_OUTPUT_DIR RUN_METADATA_DIR