Add Fabric Organizations to the Network

This topic contains information about joining Hyperledger Fabric organizations to an Oracle Blockchain Platform network.

Typical Workflow to Join a Fabric Organization to an Oracle Blockchain Platform Network

Here are the tasks that a Fabric organization and the Oracle Blockchain Platform founder organization need to perform to join a Fabric organization to the Oracle Blockchain Platform network.

Task Who Does This? Description More Information
Create the certificate file for the Fabric organization Fabric organization Find the Fabric organization’s Admin, CA, and TLS certificate information and use it to compose a JSON certificates file. Create a Fabric Organization's Certificates File
Upload Fabric organization's certificate file to the Oracle Blockchain Platform network Founder organization Use the console to upload and import the Fabric organization's certificate file to add the Fabric organization to the network. Import Certificates to Add Organizations to the Network
Create a channel Founder organization Create a new channel and add the Fabric organization to it. Create a Channel
Export the ordering service settings from founder Founder organization Output the founder’s ordering services settings to a JSON file and send the file to the Fabric organization. Join the Participant or Scaled-Out OSNs to the Founder's Ordering Service
Compose orderer certificate file Fabric organization Create a file named orderer.pem that includes the tlscacert information.

Go to the exported ordering service settings file and copy the tlscacert information. After you paste the tlscacert information into the orderer.pem file, you must replace all instances of \n with the newline character.

The orderer.pem file must have the following format:

-----BEGIN CERTIFICATE-----
... 
...
... 
-----END CERTIFICATE-----
Create a Fabric Organization's Certificates File
Provide ordering service settings Founder organization Open the ordering service settings file and find the ordering service’s address and port and give them to the Fabric organization. For example:
"orderingServiceNodes": [
{
"address": "grpcs://example_address:7777",
...
}]
NA
Add the Fabric organization to the network Fabric organization The Fabric organization copies certificates into its environment, sets environment variables, fetches the genesis block, joins the channel, and installs the chaincode. Prepare the Fabric Environment to Use the Oracle Blockchain Platform Network

Create a Fabric Organization's Certificates File

For a Fabric organization to join an Oracle Blockchain Platform network, it must write a certificates file containing its admincerts, cacerts, and tlscacerts information. The Oracle Blockchain Platform founder organization imports this file to add the Fabric organization to the network.

The Fabric certificates information is stored in PEM files located in the Fabric organization’s MSP folder. For example, network_name_example/crypto-config/peerOrganizations/example_org.com/msp/.

The certificates file must be in written in JSON and must contain the following fields. For all certificates, when you copy the certificate information into the JSON file, you must replace each new line with \n, so that the information is all on one line with no spaces, as shown in the following example.

  • mspid — Specifies the name of the Fabric organization.

  • type — Indicates that the organization is a network participant. This value must be Participant.
  • admincert — Contains the contents of the organization’s Admin certificates file: Admin@example_org.com-cert.pem.

  • cacert — Contains the contents of the organization’s CA certificates file: ca.example_org-cert.pem.

  • tlscacert — Contains the contents of the organization’s TLS certificate file: tlsca.example_org-cert.pem.

  • intermediatecerts— This optional element contains the contents of an intermediate CA certificates file. Do not specify this element unless there is an intermediate CA certificates file.
  • nodeouidentifiercert— This section contains certificates that identify Node OU roles.
  • adminouidentifiercert— Contains the contents of the organization’s certificate file that is used to identify Node OU admin roles. If you do not need the admin role, you can use the cacert file contents, or intermediate certificate file contents, as the adminouidentifier contents.

  • clientouidentifiercert— Contains the contents of the organization’s certificate file that is used to identify Node OU client roles.

  • ordererouidentifiercert— Contains the contents of the organization’s certificate file that is used to identify Node OU orderer roles. If you do not need the orderer role, you can use the cacert file contents, or intermediate certificate file contents, as the ordererouidentifier contents.

  • peerouidentifiercert— Contains the contents of the organization’s certificate file used to identify Node OU peer roles.

Structure the file similar to the following example:
{
  "mspID": "examplemspID",
  "type":  "Participant",
  "certs": { 
   "admincert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n",
   "cacert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n",
   "tlscacert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n"
   "nodeouidentifiercert": {
      "adminouidentifiercert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n",
      "clientouidentifiercert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n",
      "ordererouidentifiercert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n",
      "peerouidentifiercert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n"
    }
  }
} 
    

Prepare the Fabric Environment to Use the Oracle Blockchain Platform Network

You must modify the Fabric organization’s environment before it can use the Oracle Blockchain Platform network.

Confirm that the following prerequisite tasks were completed. For more information, see Typical Workflow to Join a Fabric Organization to an Oracle Blockchain Platform Network.

  • The Fabric organization’s certificate file was created and sent to the Oracle Blockchain Platform network founder.

  • The network founder uploaded the certificates file to add the Fabric organization to the network.

  • The network founder created a new channel and added the Fabric organization to it.

  • The network founder downloaded its ordering service settings and sent them to the Fabric organization.

  • The Fabric organization created the orderer certificate file.

  • The network founder gave the ordering service address and port to the Fabric organization.

You must add the Fabric organization and install and test the chaincode.

  1. Navigate to the Fabric network directory and launch the peer container.

  2. Fetch the channel’s genesis block with this command:

    peer channel fetch 0 mychannel.block -o ${orderer_addr}:${orderer_port} -c mychannel --tls --cafile orderer.pem --logging-level debug  

    Where:

    • {orderer_addr} is the Founder’s orderer address.

    • {orderer_port} is the Founder’s port number.

    • -c mychannel is the name of the channel that the Founder created. This is the channel where the Fabric organization will send and receive transactions on the Oracle Blockchain Platform network.

    • orderer.pem is the Founder’s orderer certificate file.

  3. Join the channel with this command:

    peer channel join -b mychannel.block -o ${orderer_addr}:${orderer_port} --tls --cafile orderer.pem --logging-level debug
  4. Install the chaincode with this command:

    peer chaincode install -n mycc -v 1.0 -l "golang" -p ${CC_SRC_PATH}

    Where CC_SRC_PATH is the folder that contains the chaincode.

  5. Instantiate the chaincode with this command:

    peer chaincode instantiate -o  ${orderer_addr}:${orderer_port} --tls --cafile orderer.pem -C mychannel -n mycc -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P <policy_string> --logging-level debug
  6. Invoke the chaincode with this command:

    peer chaincode invoke -o ${orderer_addr}:${orderer_port}  --tls true --cafile orderer.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}' --logging-level debug
  7. Query the chaincode with this command:

    peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'  --logging-level debug