You can call this operation to create a chaincode.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateFabricChaincode |
The operation that you want to perform. Set the value to CreateFabricChaincode. |
ChannelId | String | Yes | chan-first-channel-1w55v3u39x2xz |
The ID of the channel. |
ConsortiumId | String | Yes | consortium-aaaaaa-akpcsjjac2jd |
The ID of the consortium. |
OrganizationId | String | Yes | peers-aaaaaa1-1oxw31d046jtl |
The ID of the organization. |
OssBucket | String | Yes | https://chaincode.oss-cn-beijing.aliyuncs.com |
The IP address of the OSS bucket. |
OssUrl | String | Yes | aaaaaa1/a0cf8729-7d47-44c9-9ed5-6d2fdfc8dc2c/sacc.cc |
The IP address of the OSS object. |
EndorsePolicy | String | No | OR ('aaaaaa1MSP.peer') |
The endorsement policy. |
Location | String | No | cn-hangzhou |
The location information. |
RegionId | String | No | cn-hangzhou |
The ID of the region. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
ErrorCode | Integer | 200 |
The error code. |
RequestId | String | CD264CC8-B892-4CDC-BD31-7D179EE6E396 |
The ID of the API request. |
Result |
The result. |
||
ChaincodeId | String | code-sacc-1pr09q7jmo0np |
The ID of the chaincode. |
ChaincodeName | String | mychaincode |
The name of the chaincode. |
ChaincodeVersion | String | 1.0 |
The version of the chaincode. |
ChannelName | String | first-channel |
The name of the channel. |
ConsortiumId | String | consortium-aaaaaa-akpcsjjac2jd |
The ID of the consortium. |
CreateTime | String | 1544766801000 |
The time when the chaincode was created. |
DeployTime | String | 1544766801000 |
The time when the chaincode was deployed. |
EndorsePolicy | String | OR ('aaaaaa1MSP.peer') |
The endorsement policy. |
Input | String | string |
The input. |
Install | Boolean | true |
Indicates whether the chaincode is installed. A value of true indicates that the chaincode is installed. A value of false indicates that the chaincode has not been installed. |
Message | String | string |
The message. |
Path | String | go-sdk-demo/chaincode/src |
The path. |
ProviderId | String | peers-aaaaaa1-1oxw31d046jtl |
The ID of the chaincode uploader. |
ProviderName | String | peers-aaaaaa1-1oxw31d046jtl |
The name of the chaincode uploader. |
State | String | Instantiatable |
The status. |
Type | Integer | 1 |
The type of the chaincode. |
Success | Boolean | true |
Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed. |
Examples
Sample requests
http(s)://[Endpoint]/? Action=CreateFabricChaincode
&ChannelId=chan-first-channel-1w55v3u39x2xz
&ConsortiumId=consortium-aaaaaa-akpcsjjac2jd
&OrganizationId=peers-aaaaaa1-1oxw31d046jtl
&OssBucket=https://chaincode.oss-cn-beijing.aliyuncs.com
&OssUrl=aaaaaa1/a0cf8729-7d47-44c9-9ed5-6d2fdfc8dc2c/sacc.cc
&<Common request parameters>
Successful response examples
XML
format
<CreateFabricChaincodeResponse>
<Result>
<ChaincodeName>sacc</ChaincodeName>
<ChannelId>chan-first-channel-1w55v3u39x2xz</ChannelId>
<State>Instantiatable</State>
<ConsortiumId>consortium-aaaaaa-akpcsjjac2jd</ConsortiumId>
<Creator>aaaaaa1</Creator>
<CreateTime>1544766801000</CreateTime>
<Install>true</Install>
<ChannelName>first-channel</ChannelName>
<ChaincodeVersion>1.0</ChaincodeVersion>
<EndorsePolicy>OR (&#39;aaaaaa1MSP.peer&#39;)</EndorsePolicy>
<ChaincodeId>code-sacc-1pr09q7jmo0np</ChaincodeId>
</Result>
<RequestId>50B3ACF3-CE12-433C-A834-9E8C657A4934</RequestId>
<Success>true</Success>
<ErrorCode>200</ErrorCode>
</CreateFabricChaincodeResponse>
JSON
format
{
"Result":[
{
"ChannelId":"chan-first-channel-1w55v3u39x2xz",
"ChaincodeVersion":"1.0",
"Install":"true",
"ConsortiumId":"consortium-aaaaaa-akpcsjjac2jd",
"State":"Instantiatable",
"ChaincodeName":"sacc",
"Creator":"aaaaaa1",
"CreateTime":1544766801000,
"ChannelName":"first-channel",
"EndorsePolicy":"OR ('aaaaaa1MSP.peer')",
"ChaincodeId":"code-sacc-1pr09q7jmo0np"
}
],
"RequestId":"50B3ACF3-CE12-433C-A834-9E8C657A4934",
"ErrorCode":200,
"Success":true
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | ChaincodeDuplicated | The chaincode [%s] of version [%s] already exists. Change the name or the version of the chaincode. | The error message will be returned when the chaincode [%s] of version [%s] already exists. Change the name or the version of the chaincode. |
400 | ChaincodeInvalid | The format of the chaincode package is invalid. | The error message will be returned when the format of the chaincode is invalid. |
For more information about error codes, see Error codes.