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.
- Extract the
DepositToken.ziparchive file. - Import the
DepositTokenchaincode to the Blockchain App Builder extension in Visual Studio Code. - Edit the
.ochain.jsonfile to update the value of theconfigFileLocationkey to the path of theDepositToken.ymlspecification file. - Open a terminal window and navigate to the chaincode folder, and
then run the following
command.
npm install
Sample Process Flow for the DepositTokens Sample
A typical process flow using the fungible token framework methods follows these basic steps.- Admins use the
initializeDepositTokenmethod to initialize the deposit token system. - Admins use the
createAccountandassociateTokenToAccountmethods to create accounts and associate the token to accounts for all users. - Admins use the
addRolemethod to assign the minter role to the creator and the notary role to the approver. - The token creator uses the
requestMintmethod to submit a request to mint deposit tokens. - The approver uses the
approveMintmethod to review and approve the request to mint deposit tokens. The deposit tokens are credited to the creator's account. - The issuer uses the
getAccountBalancemethod to verify that the credited amount is accurate. - The creator uses the
holdTokensmethod to request transfer of the tokens to the issuer. - The approver uses the
executeHoldTokensmethod to validate and approve the transfer request. The deposit tokens are transferred to the issuer's account. - The issuer uses the
transferTokensmethod to send tokens to the first user. The deposit tokens are credited to the first user's account. - The first user uses the
getAccountBalancemethod to verify their account balance. - The issuer uses the
transferTokensmethod to send tokens to the first user. The deposit tokens are credited to the second user's account. - The second user uses the
getAccountBalancemethod to verify their account balance. - The second user uses the
burnTokensmethod 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.
- Extract the
NFTCollectiblesWithERC721.ziparchive file. - Import the
NFTCollectiblesWithERC721chaincode to the Blockchain App Builder extension in Visual Studio Code. - Edit the
.ochain.jsonfile to update the value of theconfigFileLocationkey to the path of theNFTCollectiblesWithERC721-TypeScript.ymlspecification file. - Open a terminal window and navigate to the chaincode folder, and
then run the following
command.
npm install
Sample Process Flow for the NFTCollectiblesWithERC721 Sample
A typical process flow using the non-fungible token framework chaincode follows these basic steps.- Admins use the
createAccountmethod to create accounts for all stakeholders, including museums/curators, buyers, and sellers. - Admins use the
addRolemethod to assign the minter role to the curator, enabling them to mint NFTs. - Curators use the
createArtCollectionTokenmethod to mint an art collection NFT. - Curators use the
postmethod to set the price for an NFT and post it for sale in the marketplace. - Buyers use the
buymethod 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. - Optionally, buyers can use the
postmethod to set a new price for an NFT and post it for resale in the marketplace. - Optionally, buyers can use the
burnmethod 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.
- Extract the
NFTCollectiblesWithERC1155.ziparchive file. - Import the
NFTCollectiblesWithERC1155chaincode to the Blockchain App Builder extension in Visual Studio Code. - Edit the
.ochain.jsonfile to update the value of theconfigFileLocationkey to the path of theNFTCollectiblesWithERC1155-TypeScript.ymlspecification file. - Open a terminal window and navigate to the chaincode folder, and
then run the following
command.
npm install
Sample Process Flow for the NFTCollectiblesWithERC1155 Sample
A typical process flow using the non-fungible token framework chaincode follows these basic steps.- Admins use the
createAccountmethod to create fungible and non-fungible token accounts for all stakeholders, including museums/curators, buyers, and sellers. - Admins use the
addRolemethod to assign the minter role to the curator, enabling them to mint NFTs. - Curators use the
mintBatchmethod to mint art collection NFTs. - Curators use the
postmethod to set the price for an NFT and post it for sale in the marketplace. - Buyers and sellers use the
createTokenAccountmethod to create consumer accounts for fungible and non-fungible tokens on the platform. - Buyers use the
buyWithEthCoinmethod 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. - Optionally, buyers can use the
postmethod to set a new price for an NFT and post it for resale in the marketplace. - Optionally, buyers can use the
burnBatchmethod to redeem the NFT or permanently remove it from circulation.