Instantiating a Chaincode
Function
Instantiating a Chaincode
URI
POST /v2/agent/apis/chaincode/instantiate
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
chaincode_name |
Yes |
String |
Chaincode name, which can contain 6 to 25 including lowercase letters and digits, and must start with a letter. Minimum: 6 Maximum: 25 |
chaincode_version |
Yes |
String |
Chaincode version. Only digits, periods (.), and hyphens (-) are allowed. The value must start and end with a digit, and the periods (.) and hyphens (-) cannot be adjacent. |
channel_name |
Yes |
String |
Channel name. |
endorsement_policy |
Yes |
Policy object |
Endorsement policy. |
init_variable |
Yes |
InitArgs object |
Initialization function and parameters. |
private_data |
No |
String |
Privacy protection configuration data, which is a JSON string. For example: [{"name":"kvstore-collection","policy":"OR('9b4ea44913e8eed42cb056177b46191e1d316678MSP.member','9b4ea44913e8eed42cb056177b46191e1d316678MSP.member')","requiredPeerCount":0,"maxPeerCount":2,"blockToLive":0,"memberOnlyRead":true}]. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
operation |
Yes |
String |
Operator. OR: endorsement from any organization. AND: endorsement from all organizations. |
group |
Yes |
Array of OrgPolicy objects |
Endorsing organizations. |
Response Parameters
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_message |
String |
Error description. |
error_msg |
String |
Error description. |
Example Requests
POST https://192.168.0.90:30603/v2/agent/apis/chaincode/instantiate { "chaincode_name" : "gochaincode2", "chaincode_version" : "1.0", "channel_name" : "channel001", "endorsement_policy" : { "operation" : "AND", "group" : [ { "org_id" : "8cc7155fb1f26ebac1743f481386c14223be511f", "category" : "member" } ] }, "init_variable" : { "func_name" : "init", "args" : [ "a", "200", "b", "100" ] }, "private_data" : "[{\"name\": \"kvstore-collection\",\"policy\": \"OR('8cc7155fb1f26ebac1743f481386c14223be511fMSP.member','8cc7155fb1f26ebac1743f481386c14223be511fMSP.member')\",\"requiredPeerCount\": 0,\"maxPeerCount\": 2,\"blockToLive\": 0,\"memberOnlyRead\": true}]" }
Example Responses
Status code: 400
Bad Request
{ "error_code" : "BCS.4000013", "error_message" : "request body is too large" }
Status Codes
Status Code |
Description |
---|---|
200 |
Success |
400 |
Bad Request |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot