调用CreateFabricChaincode创建链码。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 |
类型 |
是否必选 |
示例值 |
描述 |
Action | String | 是 | CreateFabricChaincode | 系统规定参数。取值:CreateFabricChaincode。 |
OrganizationId | String | 是 | peers-aaaaaa1-1oxw31d046jtl | 组织ID |
ChannelId | String | 是 | chan-first-channel-1w55v3u39x2xz | 通道ID |
ConsortiumId | String | 是 | consortium-aaaaaa-akpcsjjac2jd | 联盟ID |
OssBucket | String | 是 | https://chaincode.oss-cn-beijing.aliyuncs.com | OSS桶地址 |
OssUrl | String | 是 | aaaaaa1/a0cf8729-7d47-44c9-9ed5-6d2fdfc8dc2c/sacc.cc | OSS对象地址 |
EndorsePolicy | String | 否 | OR ('aaaaaa1MSP.peer') | 背书策略:
|
Location | String | 否 | cn-hangzhou | 位置信息 |
返回数据
名称 |
类型 |
示例值 |
描述 |
RequestId | String | CD264CC8-B892-4CDC-BD31-7D179EE6E396 | 请求ID |
Success | Boolean | true | 是否成功 |
ErrorCode | Integer | 200 | 错误码 |
Result | Object | 创建结果 |
|
Type | Integer | 1 | 类型:
|
EndorsePolicy | String | OR ('aaaaaa1MSP.peer') | 背书策略 |
State | String | Instantiatable | 状态 |
CreateTime | String | 1544766801000 | 创建时间 |
ChaincodeId | String | code-sacc-1pr09q7jmo0np | 链码ID |
ProviderName | String | peers-aaaaaa1-1oxw31d046jtl | 上传者名字 |
Message | String | string | 消息 |
ChaincodeName | String | mychaincode | 链码名 |
Input | String | string | 输入 |
Install | Boolean | true | 是否安装 |
ProviderId | String | peers-aaaaaa1-1oxw31d046jtl | 上传ID |
DeployTime | String | 1544766801000 | 部署时间 |
ChaincodeVersion | String | 1.0 | 链码版本 |
ConsortiumId | String | consortium-aaaaaa-akpcsjjac2jd | 联盟ID |
ChannelName | String | first-channel | 通道名 |
Path | String | go-sdk-demo/chaincode/src | 路径 |
示例
请求示例
http(s)://[Endpoint]/?Action=CreateFabricChaincode
&OrganizationId=peers-aaaaaa1-1oxw31d046jtl
&ChannelId=chan-first-channel-1w55v3u39x2xz
&ConsortiumId=consortium-aaaaaa-akpcsjjac2jd
&OssBucket=https://chaincode.oss-cn-beijing.aliyuncs.com
&OssUrl=aaaaaa1/a0cf8729-7d47-44c9-9ed5-6d2fdfc8dc2c/sacc.cc
&EndorsePolicy=OR ('aaaaaa1MSP.peer')
&Location=cn-hangzhou
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateFabricChaincodeResponse>
<RequestId>CD264CC8-B892-4CDC-BD31-7D179EE6E396</RequestId>
<Success>true</Success>
<ErrorCode>200</ErrorCode>
<Result>
<Type>1</Type>
<EndorsePolicy>OR ('aaaaaa1MSP.peer')</EndorsePolicy>
<State>Instantiatable</State>
<CreateTime>1544766801000</CreateTime>
<ChaincodeId>code-sacc-1pr09q7jmo0np</ChaincodeId>
<ProviderName>peers-aaaaaa1-1oxw31d046jtl</ProviderName>
<Message>string</Message>
<ChaincodeName>mychaincode</ChaincodeName>
<Input>string</Input>
<Install>true</Install>
<ProviderId>peers-aaaaaa1-1oxw31d046jtl</ProviderId>
<DeployTime>1544766801000</DeployTime>
<ChaincodeVersion>1.0</ChaincodeVersion>
<ConsortiumId>consortium-aaaaaa-akpcsjjac2jd</ConsortiumId>
<ChannelName>first-channel</ChannelName>
<Path>go-sdk-demo/chaincode/src</Path>
</Result>
</CreateFabricChaincodeResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "CD264CC8-B892-4CDC-BD31-7D179EE6E396",
"Success" : true,
"ErrorCode" : 200,
"Result" : {
"Type" : 1,
"EndorsePolicy" : "OR ('aaaaaa1MSP.peer')",
"State" : "Instantiatable",
"CreateTime" : "1544766801000",
"ChaincodeId" : "code-sacc-1pr09q7jmo0np",
"ProviderName" : "peers-aaaaaa1-1oxw31d046jtl",
"Message" : "string",
"ChaincodeName" : "mychaincode",
"Input" : "string",
"Install" : true,
"ProviderId" : "peers-aaaaaa1-1oxw31d046jtl",
"DeployTime" : "1544766801000",
"ChaincodeVersion" : "1.0",
"ConsortiumId" : "consortium-aaaaaa-akpcsjjac2jd",
"ChannelName" : "first-channel",
"Path" : "go-sdk-demo/chaincode/src"
}
}
错误码
HttpCode |
错误码 |
错误信息 |
描述 |
400 | ChaincodeDuplicated | The chaincode [%s] of version [%s] already exists, please change the name or the version of the chaincode. | 已经存在链码[%s]版本是[%s],请修改链码名称或者版本 |
400 | ChaincodeInvalid | The format of the chaincode package is invalid. | 链码格式错误 |
访问错误中心查看更多错误码。
文档内容是否对您有帮助?