Commit a Chaincode Definition in a Channel
post
/console/admin/api/v2/channels/{channelName}/chaincodeDefinitions/commit
Commit a chaincode definition in a channel. The new chaincode lifecycle in Hyperledger Fabric 2.x involves approving and committing the chaincode during the deployment. The chaincode definition needs to be approved by a sufficient number of organizations to satisfy the channel's LifecycleEndorsement policy before the chaincode can be committed on the channel.
Request
Supported Media Types
- application/json
Path Parameters
-
channelName(required): string
ID of the channel
Details about the chaincode definition to be committed
Root Schema : CommitCCReq
Type:
Show Source
object
-
chaincodeInitRequired(required):
boolean
-
chaincodeName(required):
string
-
chaincodeVersion(required):
string
-
dataCollectionConfig:
array dataCollectionConfig
-
endorsementPolicy:
object endorsementPolicy
Example:
{
"chaincodeName":"myCC1",
"chaincodeVersion":"v1",
"chaincodeInitRequired":false,
"endorsementPolicy":{
"type":"signature-policy",
"policy":"OR('org1.member')"
},
"dataCollectionConfig":[
{
"name":"test",
"policy":"OR('org1.member')",
"requiredPeerCount":"1",
"maxPeerCount":"2",
"blockToLive":"10",
"memberOnlyRead":true,
"memberOnlyWrite":true,
"endorsementPolicy":{
"signaturePolicy":"OutOf(1,'org1.member')"
}
}
]
}
Nested Schema : endorsementPolicy
Type:
Show Source
object
-
policy(required):
string
-
type(required):
string
Allowed Values:
[ "signature-policy", "channel-config-policy" ]
Response
Supported Media Types
- application/json
200 Response
Success
400 Response
Invalid arguments
401 Response
Unauthorized
403 Response
Forbidden
500 Response
Internal server error
Default Response
Unexpected error