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
Code Block |
---|
Example Response
Code Block |
---|
{
"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:
Code Block |
---|
Example Response Body:
Code Block |
---|
{
"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:
Code Block |
---|
{
"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
Code Block |
---|
{
"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
Code Block |
---|
{
"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:
Code Block |
---|
{
"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
GETapi/v1/chaincodes
List chaincode that user-owned