Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1.

...

Upload

POST api/v1/chaincodes/chaincodeRepo

The front end will allow uploading a chaincode package, which is a .tar.gz format file.

Install a chaincode: peer lifecycle install

Chaincode Version?the version

Body Parameters

Type

Note

chaincode_packagestring

The base64-encoded contexts of the chaincode

Peersarrayan array of peer nodes
Chaincode FilestringPackage 
Descriptionstring 

...

package, including the json metadata file:

{
    "Path":"<chaincode package path>",
    "Type":"golang",
    "Label":"testcc_v1.0"
}

description string (optional)

2. Perform chaincode operations → Install

POST api/v1/chaincode/installation 

Body Parameters

Type

Note

peer_uuidstring

Peer UUID

chaincode_package_uuidstringchaincode package file id in the backend uploaded data store.


3. Perform chaincode operations → Approve (may by several orgs), Commit

POST api/v1/chaincodes/<chaincode_name>/channelschaincodeDefinitions/?operations=<approve/commit>

Query Parameters

Type

Note

operationsstringHLF lifecycle command that deploys, approves, and commits a chaincode with several organizations


Body Parameters

Type

Note

Namestring
name

chaincode_labelstring(optional)The label that will be used to identify the installed chaincode package
package_id string(optional)The package id of the chaincode package that will be installed.
channel_idstring(optional)The channel on which this command should be executed.
versionstring (optional)
Channel stringname of the channelChaincode Versionstring
the version of the chaincode
Initialization Functionstring Chaincode function that will be invokedOrganizations array an array of endorsing organization ids

...

definition to be approved
signature_policystring (optional)Use a policy inside the channel configuration as the chaincode endorsement policy.
peersstring array (optional)The array of the uuid of the peer nodes. For commit only
init_requiredbool flaga boolean flag to request the execution of the Init function to initialize the chaincode.


4. List chaincodes (Yuanmao Zhu will revise)

GET api/v1/chaincodes

Get a list of uploaded chaincodes

Response Body  

Type

Note

pathstringfrom metadata.json
typestringfrom metadata.json
labelstringThe label that will be used to identify the installed chaincode package.from metadata.json
package_idstring the package id of installed package. Calculated by label:SHA256(package), e.g., "testcc_1.0:1f060a1d05b057d98ed98ca8fd57e3a6542d8dfe383aeff64e289718ab851e2b"
descriptionstringa description of chaincode

5. Get a chaincode's information (Yuanmao Zhu will revise)

GET PUT api/v1/chaincodes/<chaincode_name>

Update a channel

Get the full information of the chaincode

Response Body 

Body Parameters

Type

Note

Name
namestring
Channel 
The name of the chaincode.
chaincode_labelstring
name of the channelChaincode Version
The label that will be used to identify the installed chaincode package
versionstring the version of the chaincode definition to be approved
package_idstring the package id of installed package
approve_statusstringthe
version of chain codeOrganizations array an array of organization idsLanguagestring?Chaincode Filestring?Description string 
approval status 
organizationsstring array A list of orgs that installed the chaincode.
channelsstring arrayThe committed channel names for the chaincode


6. Query an organization's approved chaincode definition on a channel

GET api/v1/approvedChaincodeDefinitions/<channel_name>/<org_name>

Response Body 

Type

Note

org_namestringThe name of the orgs
chaincode_namesstring arraryThe name of the approved chaincode by the org

Note: for FE to get the org approval status for a given chaincode, may have performance issues with lots of orgs.