Deploy and Test Generic Token Framework Chaincode

Deploying the Fungible Token Framework 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 DepositToken.zip archive file.
  2. Import the DepositToken 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 DepositToken.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.

Sample Process Flow for the DepositTokens Sample

A typical process flow using the fungible token framework methods follows these basic steps.
  1. Admins use the initializeDepositToken method to initialize the deposit token system.
  2. Admins use the createAccount and associateTokenToAccount methods to create accounts and associate the token to accounts for all users.
  3. Admins use the addRole method to assign the minter role to the creator and the notary role to the approver.
  4. The token creator uses the requestMint method to submit a request to mint deposit tokens.
  5. The approver uses the approveMint method to review and approve the request to mint deposit tokens. The deposit tokens are credited to the creator's account.
  6. The issuer uses the getAccountBalance method to verify that the credited amount is accurate.
  7. The creator uses the holdTokens method to request transfer of the tokens to the issuer.
  8. The approver uses the executeHoldTokens method to validate and approve the transfer request. The deposit tokens are transferred to the issuer's account.
  9. The issuer uses the transferTokens method to send tokens to the first user. The deposit tokens are credited to the first user's account.
  10. The first user uses the getAccountBalance method to verify their account balance.
  11. The issuer uses the transferTokens method to send tokens to the first user. The deposit tokens are credited to the second user's account.
  12. The second user uses the getAccountBalance method to verify their account balance.
  13. The second user uses the burnTokens method to redeem their deposit tokens.

Deploying the Non-Fungible Token Framework 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 NFTCollectiblesWithERC721.zip archive file.
  2. Import the NFTCollectiblesWithERC721 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 NFTCollectiblesWithERC721-TypeScript.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.

Sample Process Flow for the NFTCollectiblesWithERC721 Sample

A typical process flow using the non-fungible token framework chaincode follows these basic steps.
  1. Admins use the createAccount method to create accounts for all stakeholders, including museums/curators, buyers, and sellers.
  2. Admins use the addRole method to assign the minter role to the curator, enabling them to mint NFTs.
  3. Curators use the createArtCollectionToken method to mint an art collection NFT.
  4. Curators use the post method to set the price for an NFT and post it for sale in the marketplace.
  5. Buyers use the buy method to buy the NFT by using direct payment via a payment gateway. The purchased NFT is transferred to the buyer's account and is no longer for sale.
  6. Optionally, buyers can use the post method to set a new price for an NFT and post it for resale in the marketplace.
  7. Optionally, buyers can use the burn method to redeem the NFT or permanently remove it from circulation.

Deploying the Combined Token Framework 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 NFTCollectiblesWithERC1155.zip archive file.
  2. Import the NFTCollectiblesWithERC1155 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 NFTCollectiblesWithERC1155-TypeScript.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.

Sample Process Flow for the NFTCollectiblesWithERC1155 Sample

A typical process flow using the non-fungible token framework chaincode follows these basic steps.
  1. Admins use the createAccount method to create fungible and non-fungible token accounts for all stakeholders, including museums/curators, buyers, and sellers.
  2. Admins use the addRole method to assign the minter role to the curator, enabling them to mint NFTs.
  3. Curators use the mintBatch method to mint art collection NFTs.
  4. Curators use the post method to set the price for an NFT and post it for sale in the marketplace.
  5. Buyers and sellers use the createTokenAccount method to create consumer accounts for fungible and non-fungible tokens on the platform.
  6. Buyers use the buyWithEthCoin method to buy the NFT with Ethereum. Buyers receive loyalty tokens from the curator during the transaction. Buyer can also pay directly via a payment gateway. The purchased NFT is transferred to the buyer's account and is no longer for sale.
  7. Optionally, buyers can use the post method to set a new price for an NFT and post it for resale in the marketplace.
  8. Optionally, buyers can use the burnBatch method to redeem the NFT or permanently remove it from circulation.