Approve a Chaincode Definition in a Channel
post
/console/admin/api/v2/channels/{channelName}/chaincodeDefinitions/approve
Approve 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: string
ID of the channel
Details of the chaincode definition to be approved
Root Schema : ApproveCCReq
Type:
Show Source
object
-
chaincodeInitRequired:
boolean
-
chaincodeName:
string
-
chaincodePackageID:
string
-
chaincodeSequence(optional):
string
-
chaincodeVersion:
string
-
dataCollectionConfig(optional):
array dataCollectionConfig
-
endorsementPolicy(optional):
object endorsementPolicy
-
upgrade(optional):
boolean
Example:
{
"chaincodeName":"myCC1",
"chaincodeVersion":"v1",
"chaincodePackageID":"mycc:dd46d5a2e5cad160d625dba27c85b7aaa534dd3a78c4fce9c514e0ac6b6cc755",
"chaincodeInitRequired":false,
"upgrade":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:
string
-
type:
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