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.zip
archive file. - Import the
DepositToken
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 theDepositToken.yml
specification 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
initializeDepositToken
method to initialize the deposit token system. - Admins use the
createAccount
andassociateTokenToAccount
methods to create accounts and associate the token to accounts for all users. - Admins use the
addRole
method to assign the minter role to the creator and the notary role to the approver. - The token creator uses the
requestMint
method to submit a request to mint deposit tokens. - 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. - The issuer uses the
getAccountBalance
method to verify that the credited amount is accurate. - The creator uses the
holdTokens
method to request transfer of the tokens to the issuer. - The approver uses the
executeHoldTokens
method to validate and approve the transfer request. The deposit tokens are transferred to the issuer's account. - The issuer uses the
transferTokens
method to send tokens to the first user. The deposit tokens are credited to the first user's account. - The first user uses the
getAccountBalance
method to verify their account balance. - The issuer uses the
transferTokens
method to send tokens to the first user. The deposit tokens are credited to the second user's account. - The second user uses the
getAccountBalance
method to verify their account balance. - 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.
- Extract the
NFTCollectiblesWithERC721.zip
archive file. - Import the
NFTCollectiblesWithERC721
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 theNFTCollectiblesWithERC721-TypeScript.yml
specification 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
createAccount
method to create accounts for all stakeholders, including museums/curators, buyers, and sellers. - Admins use the
addRole
method to assign the minter role to the curator, enabling them to mint NFTs. - Curators use the
createArtCollectionToken
method to mint an art collection NFT. - Curators use the
post
method to set the price for an NFT and post it for sale in the marketplace. - 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. - Optionally, buyers can use the
post
method to set a new price for an NFT and post it for resale in the marketplace. - 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.
- Extract the
NFTCollectiblesWithERC1155.zip
archive file. - Import the
NFTCollectiblesWithERC1155
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 theNFTCollectiblesWithERC1155-TypeScript.yml
specification 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
createAccount
method to create fungible and non-fungible token accounts for all stakeholders, including museums/curators, buyers, and sellers. - Admins use the
addRole
method to assign the minter role to the curator, enabling them to mint NFTs. - Curators use the
mintBatch
method to mint art collection NFTs. - Curators use the
post
method to set the price for an NFT and post it for sale in the marketplace. - Buyers and sellers use the
createTokenAccount
method to create consumer accounts for fungible and non-fungible tokens on the platform. - 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. - Optionally, buyers can use the
post
method to set a new price for an NFT and post it for resale in the marketplace. - Optionally, buyers can use the
burnBatch
method to redeem the NFT or permanently remove it from circulation.