All Products
Search
Document Center

Blockchain as a Service:InstallFabricChaincode

Last Updated:Aug 15, 2024

You can call this operation to install the chaincode.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

InstallFabricChaincode

The operation that you want to perform. Set the value to InstallFabricChaincode.

ChaincodeId

String

Yes

chan-channelx-1l1hmckuuisxo

The ID of the chaincode.

OrganizationId

String

Yes

peers-aaaaaa2-1eqnj5o5w9dt3

The ID of the organization.

Location

String

No

cn-hangzhou

The location.

Response parameters

Parameter

Type

Example

Description

ErrorCode

Integer

200

The error code.

RequestId

String

1890FA4F-067A-4CE9-AC9B-2BD2E58FB5D3

The ID of the API request.

Result

The result of the operation.

ChaincodeId

String

cc-198jejf8f8chi8

The ID of the chaincode.

ChaincodeName

String

mychannel

The name of the chaincode.

ChaincodeVersion

String

1.0

The version of the chaincode.

ChannelName

String

mychannel

The name of the channel.

ConsortiumId

String

consortium-lianmenyumingyi-hc5d1bwlulg7

The ID of the consortium.

CreateTime

String

1533025590

The time when the organization was created.

DeployTime

String

1533025590

The time when the chaincode was deployed.

EndorsePolicy

String

OR ("perf9141MSP.member")

The endorsement policy.

Input

String

input

The input property of the chaincode.

Install

Boolean

false

Indicates whether the chaincode is installed. A value of true indicates that the chaincode is installed. A value of false indicates that the chaincode is not installed.

Message

String

ok

The message.

Path

String

github.com/hyperledger/fabric-samples/chaincode/sacc

The path of the chaincode.

ProviderId

String

providerid

The ID of the user who uploaded the chaincode.

ProviderName

String

prividername

The user who uploaded the chaincode.

State

String

Pending

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=InstallFabricChaincode
&OrganizationId=peers-aaaaaa2-1eqnj5o5w9dt3
&ChaincodeId=chan-channelx-1l1hmckuuisxo
&Location=cn-hangzhou
&<Common request parameters>

Successful response examples

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<InstallFabricChaincodeResponse>
    <RequestId>1890FA4F-067A-4CE9-AC9B-2BD2E58FB5D3</RequestId>
    <Success>true</Success>
    <ErrorCode>200</ErrorCode>
    <Result>
        <Type>1</Type>
        <EndorsePolicy>OR ("perf9141MSP.member")</EndorsePolicy>
        <State>Pending</State>
        <CreateTime>1533025590</CreateTime>
        <ChaincodeId>cc-198jejf8f8chi8</ChaincodeId>
        <ProviderName>prividername</ProviderName>
        <Message>ok</Message>
        <ChaincodeName>mychannel</ChaincodeName>
        <Input>input</Input>
        <Install>false</Install>
        <ProviderId>providerid</ProviderId>
        <DeployTime>1533025590</DeployTime>
        <ChaincodeVersion>1.0</ChaincodeVersion>
        <ConsortiumId>consortium-lianmenyumingyi-hc5d1bwlulg7</ConsortiumId>
        <ChannelName>mychannel</ChannelName>
        <Path>github.com/hyperledger/fabric-samples/chaincode/sacc</Path>
    </Result>
</InstallFabricChaincodeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "1890FA4F-067A-4CE9-AC9B-2BD2E58FB5D3",
  "Success" : true,
  "ErrorCode" : 200,
  "Result" : {
    "Type" : 1,
    "EndorsePolicy" : "OR (\"perf9141MSP.member\")",
    "State" : "Pending",
    "CreateTime" : "1533025590",
    "ChaincodeId" : "cc-198jejf8f8chi8",
    "ProviderName" : "prividername",
    "Message" : "ok",
    "ChaincodeName" : "mychannel",
    "Input" : "input",
    "Install" : false,
    "ProviderId" : "providerid",
    "DeployTime" : "1533025590",
    "ChaincodeVersion" : "1.0",
    "ConsortiumId" : "consortium-lianmenyumingyi-hc5d1bwlulg7",
    "ChannelName" : "mychannel",
    "Path" : "github.com/hyperledger/fabric-samples/chaincode/sacc"
  }
}

Error codes

For more information about error codes, see Error codes.