Chaincode v2 API Spec
1. Upload
POST api/v1/chaincodeRepo
The front end will allow uploading a chaincode package, which is a .tar.gz format file.
Body Parameters | Type | Note |
---|---|---|
chaincode_package | string | The base64-encoded contexts of the chaincode package, including the json metadata file: { |
description | string (optional) |
2. Perform chaincode operations → Install
POST api/v1/chaincode/installation
Body Parameters | Type | Note |
---|---|---|
peer_uuid | string | Peer UUID |
chaincode_package_uuid | string | chaincode package file id in the backend uploaded data store. |
3. Perform chaincode operations → Approve (may by several orgs), Commit
POST api/v1/chaincodeDefinitions/?operations=<approve/commit>
Query Parameters | Type | Note |
---|---|---|
operations | string | HLF lifecycle command that deploys, approves, and commits a chaincode with several organizations |
Body Parameters | Type | Note |
---|---|---|
name | ||
channel_id | string(optional) | The channel on which this command should be executed. |
version | string (optional) | the version of the chaincode definition to be approved |
signature_policy | string (optional) | Use a policy inside the channel configuration as the chaincode endorsement policy. |
peers | string array (optional) | The array of the uuid of the peer nodes. For commit only |
init_required | bool flag | a boolean flag to request the execution of the Init function to initialize the chaincode. |
4. List chaincodes (Yuanmao Zhu will revise)
GET api/v1/chaincodes
Get a list of uploaded chaincodes
Response Body | Type | Note |
---|---|---|
path | string | from metadata.json |
type | string | from metadata.json |
label | string | The label that will be used to identify the installed chaincode package.from metadata.json |
package_id | string | the package id of installed package. Calculated by label:SHA256(package), e.g., "testcc_1.0:1f060a1d05b057d98ed98ca8fd57e3a6542d8dfe383aeff64e289718ab851e2b" |
description | string | a description of chaincode |
5. Get a chaincode's information (Yuanmao Zhu will revise)
GET api/v1/chaincodes/<chaincode_name>
Get the full information of the chaincode
Response Body | Type | Note |
---|---|---|
name | string | The name of the chaincode. |
chaincode_label | string | The label that will be used to identify the installed chaincode package |
version | string | the version of the chaincode definition to be approved |
package_id | string | the package id of installed package |
approve_status | string | the approval status |
organizations | string array | A list of orgs that installed the chaincode. |
channels | string array | The committed channel names for the chaincode |
6. Query an organization's approved chaincode definition on a channel
GET api/v1/approvedChaincodeDefinitions/<channel_name>/<org_name>
Response Body | Type | Note |
---|---|---|
org_name | string | The name of the orgs |
chaincode_names | string arrary | The name of the approved chaincode by the org |
Note: for FE to get the org approval status for a given chaincode, may have performance issues with lots of orgs.
What is the channel for? @Yuanmao ZhuÂ