Deploy and Test Bond Marketplace Chaincode

Prerequisites

You must complete the following steps before you work with the bond marketplace chaincode.
  1. Create a confidential client application in Oracle Identity Cloud Service. The bond marketplace wrapper API provides methods to create Identity Cloud Service users that can be used by the clients in their signup flow. This requires a confidential client application that has the privilege to create a new user in Identity Cloud Service. The bond marketplace chaincode requires the client ID and client secret of this application. For more information on adding a confidential application, see Add a Confidential Application.
  2. Create user groups and configure them to the Oracle Blockchain Platform instance. Identity Cloud Service user groups such as ADMIN_GROUP, USER_GROUP, CLIENT_GROUP, and so on must be created and configured to the corresponding Oracle Blockchain Platform instances based on the corresponding access and application roles such as admin, restproxy user, ca user, and so on. For more information, see Set Up Users and Application Roles.
  3. Deploy the wholesale CBDC chaincode. The wholesale CBDC chaincode must be deployed on the same Oracle Blockchain Platform instances where the bond marketplace chaincode is deployed. The corresponding token and token account must be set up in the wholesale CBDC chaincode as the default payment mode for the bond. You can do this manually or by using the Postman collection generated by Blockchain App Builder. The wholesale CBDC chaincode and the bond marketplace can be deployed on the same channel or on different channels.

Deploying the Chaincode

You can deploy the chaincode directly from the Oracle Blockchain Platform console or by using Blockchain App Builder. Before you deploy the chaincode, create enrollment IDs for each token user and then map the token users to their respective enrollment IDs. Specify only one user for each enrollment. For more information about adding enrollments, see Add Enrollments to a REST Proxy.

When you deploy the token chaincode, you must call the init method and pass the organization ID and user ID of the Token Admin user.

For information about deploying from the Oracle Blockchain Platform console, see Use Advanced Deployment.

To deploy using Blockchain App Builder, complete the following steps.
  1. Extract the BondMarketplace.zip archive file.
  2. Import the BondMarketplace chaincode to the Blockchain App Builder extension in Visual Studio Code.
  3. Edit the .ochain.json file to update the value of the configFileLocation key to the path of the BondMarketplace.yml specification file.
  4. Open a terminal window and navigate to the chaincode folder, and then run the following command.
    npm install
For more information about deploying using Blockchain App Builder, see Deploy Your Chaincode Using Visual Studio Code.

Bond Marketplace Sample Process Flow

A typical process flow using the bond marketplace methods follows these basic steps.
  1. Admins use the createUserAccount and createTokenAccount methods to create individual NFT accounts for all users.
  2. Admins use the addRole method to assign the minter role to the officers of participating financial institutions (for example, FI-1 Bond Issuer).
  3. Financial institution officers (bond issuers) use the createBondToken method to issue bonds as fractional NFTs.
  4. Financial institution officers use the getTokenById method to review and confirm the details of issued bonds.
  5. Bond purchasers (for example, FI User) use the purchaseToken method to buy the fractional NFT bond and to make a payment using the wholesale CBDC chaincode.
  6. Purchasers use the balanceOfBatch method to verify the receipt of the bond in their wallet.
  7. Purchasers use the getAccountBalance method (wholesale CBDC chaincode) to confirm the transfer in their wholesale CBDC wallet.
  8. Bond issuers use the payInterest method to pay periodic interest to bondholders using the wholesale CBDC chaincode.
  9. Purchasers use the requestTokenRedemption method to submit a request to redeem their bond after it has matured.
  10. Financial institution officers use the approveTokenRedemption method to approve the redemption request and to transfer wholesale CBDC funds to the bond holder.
  11. The bond holder uses the balanceOfBatch method (bond marketplace chaincode) and getAccountBalance method (wholesale CBDC chaincode) to verify that the bond was redeemed and that they received funds in their wholesale CBDC wallet.