Instantiate a Chaincode

Instantiating a chaincode compiles, builds, and initializes the chaincode on the peers where the chaincode is installed. When instantiation is complete, the peers are able to accept chaincode invocations and can endorse transactions.

Note the following information:
  • You must install the chaincode on the required peers before you can instantiate it.
  • If you're working on a channel that contains multiple members and have instantiated the chaincode on one member, then you don’t have to instantiate the chaincode on the other members where you installed the same chaincode. In such cases, the chaincode is already instantiated and running on all members on the channel.
  • You can instantiate more than one chaincode on a channel.
  • The process to instantiate the sample chaincodes is different than the instantiation process described in this topic. See Explore Oracle Blockchain Platform Using Samples.
  • After you instantiate the chaincode, then you can optionally enable it in the REST proxy.
You must be an administrator to perform this task.
  1. Go to the console and select the Chaincodes tab.
  2. In the Chaincodes tab, click the arrow to expand the chaincode’s version list.
  3. Locate the chaincode version and click its More Actions menu, and select Instantiate.
    The Instantiate Chaincode dialog is displayed.
  4. Enter information about where and how to instantiate the chaincode.
    Field Description
    Channel Select the channel for the chaincode to run on.
    Peers Select the peer or peers you want to use the chaincode. This list shows the peers that you installed the chaincode onto.
    Initial Parameter Enter the input parameters that you want to pass to the chaincode. Go to the chaincode to find the initial parameters values.
    Endorsement Policy In this section, specify the number and role of members required to endorse the chaincode.

    If you don’t specify an endorsement policy, then the default endorsement policy is used. The default endorsement policy gets an endorsement from any peer on the network.

    Transient Map

    The data that is passed into the chaincode is the transaction payload and the transient map. The transaction payload is recorded in the ledger and is visible to anyone who can access the ledger through the query system chaincode. Use a transient map to pass private data such as keys that you don't want stored in the ledger.

    In this section, provide the required keys and values. The information you provide is maintained on the peer node and is sent to the chaincode when a transaction is executed.

    If you're adding private data collections, then specify a transient map to pass the private data from the client to the peers for endorsement.

    (New in v19.1.3) Private Data Collections In this section, add one or more private data collections. Private data collections specify subsets of organizations that endorse, commit, or query private data on the channel you instantiate the chaincode on.
  5. Click Instantiate.
    The chaincode is instantiated.
  6. To confirm that the chaincode was instantiated, go to the Channels tab and click the name of the channel that you instantiated the chaincode on. Go to the Instantiated Chaincodes tab and confirm that the chaincode is listed in the summary table.