CreateFabricChaincode
更新時(shí)間:
調(diào)用CreateFabricChaincode創(chuàng)建鏈碼。
調(diào)試
您可以在OpenAPI Explorer中直接運(yùn)行該接口,免去您計(jì)算簽名的困擾。運(yùn)行成功后,OpenAPI Explorer可以自動(dòng)生成SDK代碼示例。
請(qǐng)求參數(shù)
名稱(chēng) |
類(lèi)型 |
是否必選 |
示例值 |
描述 |
Action | String | 是 | CreateFabricChaincode | 系統(tǒng)規(guī)定參數(shù)。取值:CreateFabricChaincode。 |
OrganizationId | String | 是 | peers-aaaaaa1-1oxw31d046jtl | 組織ID |
ChannelId | String | 是 | chan-first-channel-1w55v3u39x2xz | 通道ID |
ConsortiumId | String | 是 | consortium-aaaaaa-akpcsjjac2jd | 聯(lián)盟ID |
OssBucket | String | 是 | https://chaincode.oss-cn-beijing.aliyuncs.com | OSS桶地址 |
OssUrl | String | 是 | aaaaaa1/a0cf8729-7d47-44c9-9ed5-6d2fdfc8dc2c/sacc.cc | OSS對(duì)象地址 |
EndorsePolicy | String | 否 | OR ('aaaaaa1MSP.peer') | 背書(shū)策略:
|
Location | String | 否 | cn-hangzhou | 位置信息 |
返回?cái)?shù)據(jù)
名稱(chēng) |
類(lèi)型 |
示例值 |
描述 |
RequestId | String | CD264CC8-B892-4CDC-BD31-7D179EE6E396 | 請(qǐng)求ID |
Success | Boolean | true | 是否成功 |
ErrorCode | Integer | 200 | 錯(cuò)誤碼 |
Result | Object | 創(chuàng)建結(jié)果 |
|
Type | Integer | 1 | 類(lèi)型:
|
EndorsePolicy | String | OR ('aaaaaa1MSP.peer') | 背書(shū)策略 |
State | String | Instantiatable | 狀態(tài) |
CreateTime | String | 1544766801000 | 創(chuàng)建時(shí)間 |
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 | 部署時(shí)間 |
ChaincodeVersion | String | 1.0 | 鏈碼版本 |
ConsortiumId | String | consortium-aaaaaa-akpcsjjac2jd | 聯(lián)盟ID |
ChannelName | String | first-channel | 通道名 |
Path | String | go-sdk-demo/chaincode/src | 路徑 |
示例
請(qǐng)求示例
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
&公共請(qǐng)求參數(shù)
正常返回示例
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"
}
}
錯(cuò)誤碼
HttpCode |
錯(cuò)誤碼 |
錯(cuò)誤信息 |
描述 |
400 | ChaincodeDuplicated | The chaincode [%s] of version [%s] already exists, please change the name or the version of the chaincode. | 已經(jīng)存在鏈碼[%s]版本是[%s],請(qǐng)修改鏈碼名稱(chēng)或者版本 |
400 | ChaincodeInvalid | The format of the chaincode package is invalid. | 鏈碼格式錯(cuò)誤 |
訪問(wèn)錯(cuò)誤中心查看更多錯(cuò)誤碼。
文檔內(nèi)容是否對(duì)您有幫助?