Channel code
1. Package
POST api/v1/chaincodes/package
The chain code needs to be packaged before being installed on the peer node
Body Parameters | Type | Note |
---|---|---|
name | string | |
version | string | |
language | string | |
md5 | string | |
file | File |
Example Request
Example Response
{     "data": null,     "msg": "package chaincode failed.",     "status": "fail" }
2. Install
POST api/v1/chaincodes/install
Install chaincode to the peer nodes.
Body Parameters | Type | Note |
---|---|---|
id | UUID |
Example Request Body:
Example Response Body:
{ Â Â Â Â "data":Â "success", Â Â Â Â "msg":Â null, Â Â Â "status":Â "successful" }
3. Query Installed chaincodes
GET api/v1/chaincodes/query_installed
Query installed chaincodes in the peer nodes.
Example Response Body:
{ Â Â Â Â "data":Â { Â Â Â Â Â Â Â Â "installed_chaincodes":Â [ Â Â Â Â Â Â Â Â Â Â Â Â { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "package_id":Â "mycc_v1:93ac5ffaf361bafb9b7738d6094edb7e0e6f64b1a4414bd5d84436686422c0ac", Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "label":Â "mycc_v1" Â Â Â Â Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â ] Â Â Â Â }, Â Â Â Â "msg":Â null, Â Â Â Â "status":Â "successful" }
4. Get installed package
GET api/v1/chaincodes/get_installed_package
Get the installed chaincode in peer nodes and store them in dir /opt/node.
Example Response Body
{ Â Â Â Â "data":Â "success", Â Â Â Â "msg":Â null, Â Â Â Â "status":Â "successful" }
5. Approve Chaincode
POST api/v1/chaincodes/approve_for_my_org
Approve chaincode by calling lifecycle_approve_for_my_org interface of peer binary file.
Body Parameters | Type | Note |
---|---|---|
channel_name | string | |
chaincode_name | string | |
chaincode_version | string | |
policy | string | |
orderer_url | string | |
sequeence | int |
Example Response Body
{ Â Â Â Â "data":Â "success", Â Â Â Â "msg":Â null, Â Â Â Â "status":Â "successful" }
6. Query Approved Chaincode
GET api/v1/chaincodes/query_approved
Query approved chaincode information
Body Parameter | Type | Note |
---|---|---|
channel_name | string | |
chaincode_name | string |
Example Response Body:
{ Â Â Â Â "data":Â { Â Â Â Â Â Â Â Â "sequence":Â 1, Â Â Â Â Â Â Â Â "version":Â "v2", Â Â Â Â Â Â Â Â "endorsement_plugin":Â "escc", Â Â Â Â Â Â Â Â "validation_plugin":Â "vscc", Â Â Â Â Â Â Â Â "validation_parameter":Â "ChcSCBIGCAESAggAGgsSCQoHT3JnMU1TUA==", Â Â Â Â Â Â Â Â "collections":Â {}, Â Â Â Â Â Â Â Â "init_required":Â true, Â Â Â Â Â Â Â Â "source":Â { Â Â Â Â Â Â Â Â Â Â Â Â "Type":Â { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "LocalPackage":Â { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "package_id":Â "mycc_v2:93ac5ffaf361bafb9b7738d6094edb7e0e6f64b1a4414bd5d84436686422c0ac" Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â } Â Â Â Â }, Â Â Â Â "msg":Â null, Â Â Â Â "status":Â "successful" }
7. List chaincodes
GET api/v1/chaincodes
List chaincode that user-owned