Fungible Token
In this tutorial, we'll guide you through the process of working with Hedera Token Service (HTS) for fungible tokens using JavaScript scripts. These scripts cover essential operations such as creating a token, transferring tokens, increasing token supply, querying balance, updating token properties, deleting a token, and burning tokens.
Prerequisites
Before you start, make sure you have the following:
Node.js installed on your machine.
A Hedera Hashgraph account for testing purposes.
Hedera JavaScript SDK installed in your project.
Step 1: Set Up Environment
Create a new directory for your project and navigate into it.
mkdir HederaTokenTutorial
cd HederaTokenTutorialInitialize your Node.js project and install the necessary dependencies.
npm init -y
npm install @hashgraph/sdk dotenvCreate a
.envfile to store your Hedera account details.
MY_ACCOUNT_ID=your_account_id
MY_PRIVATE_KEY=your_private_key
OTHER_ACCOUNT_ID=another_account_id
OTHER_PRIVATE_KEY=another_private_keyStep 2: Write Token Creation Script
Create a file named createToken.js and add the script for token creation.
Step 3: Write Token Transfer Script
Create a file named transferToken.js and add the script for token transfer.
Step 4: Write Token Increase Supply Script
Create a file named increaseSupply.js and add the script for increasing token supply.
Step 5: Write Query Balance Script
Create a file named queryBalance.js and add the script for querying token balance.
Step 6: Write Token Update Script
Create a file named updateToken.js and add the script for updating token properties.
Step 7: Write Token Deletion Script
Create a file named deleteToken.js and add the script for deleting a token.
Step 8: Write Token Burning Script
Create a file named burnToken.js and add the script for burning tokens.
Step 9: Run the Scripts
Execute each script in the order of token creation, transfer, increase supply, query balance, update, delete, and burn. Ensure that you are following the proper sequence.
Conclusion
Congratulations! You have successfully executed scripts for various Hedera Token Service operations for Fungible Tokens. This tutorial covers fundamental steps, and you can further explore advanced features and integrations based on your specific use case.
Last updated
Was this helpful?