Deploy and Test Bond Marketplace Chaincode
Prerequisites
You must complete the following steps before you work with the bond marketplace chaincode.- 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.
- 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 asadmin
,restproxy user
,ca user
, and so on. For more information, see Set Up Users and Application Roles. - 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.
- Extract the
BondMarketplace.zip
archive file. - Import the
BondMarketplace
chaincode to the Blockchain App Builder extension in Visual Studio Code. - Edit the
.ochain.json
file to update the value of theconfigFileLocation
key to the path of theBondMarketplace.yml
specification file. - Open a terminal window and navigate to the chaincode folder, and then run the following command.
npm install
Bond Marketplace Sample Process Flow
A typical process flow using the bond marketplace methods follows these basic steps.- Admins use the
createUserAccount
andcreateTokenAccount
methods to create individual NFT accounts for all users. - Admins use the
addRole
method to assign the minter role to the officers of participating financial institutions (for example,FI-1 Bond Issuer
). - Financial institution officers (bond issuers) use the
createBondToken
method to issue bonds as fractional NFTs. - Financial institution officers use the
getTokenById
method to review and confirm the details of issued bonds. - Bond purchasers (for example,
FI User
) use thepurchaseToken
method to buy the fractional NFT bond and to make a payment using the wholesale CBDC chaincode. - Purchasers use the
balanceOfBatch
method to verify the receipt of the bond in their wallet. - Purchasers use the
getAccountBalance
method (wholesale CBDC chaincode) to confirm the transfer in their wholesale CBDC wallet. - Bond issuers use the
payInterest
method to pay periodic interest to bondholders using the wholesale CBDC chaincode. - Purchasers use the
requestTokenRedemption
method to submit a request to redeem their bond after it has matured. - Financial institution officers use the
approveTokenRedemption
method to approve the redemption request and to transfer wholesale CBDC funds to the bond holder. - The bond holder uses the
balanceOfBatch
method (bond marketplace chaincode) andgetAccountBalance
method (wholesale CBDC chaincode) to verify that the bond was redeemed and that they received funds in their wholesale CBDC wallet.