Posted By : Yogesh
This article explores a step-by-step guide on fungible token development on the Hedera Hashgraph network using JavaScript and the Hedera Hashgraph SDK.
Hedera Hashgraph is a distributed ledger technology and blockchain alternative that employs a unique consensus algorithm called Hashgraph. Designed for efficiency, security, and scalability, Hedera offers fast and fair transactions and utilizes a decentralized governance model. Its native cryptocurrency, HBAR, facilitates network operations and incentivizes users. Hedera's consensus mechanism achieves consensus asynchronously and avoids the energy-intensive proof-of-work approach.
With features like smart contracts and file storage, Hedera aims to provide a robust platform for decentralized applications while prioritizing stability and sustainability in the evolving landscape of blockchain technology.
Check It Out | Hedera Hashgraph | Moving Beyond Blockchain
Before diving into the code, ensure you have the following:
Hedera Testnet Account:
npm i dotenv @hashgraph/sdk
const {
ContractCreateFlow,
AccountId,
Client,
PrivateKey,
AccountBalanceQuery,
// ... other imports ...
} = require("@hashgraph/sdk");
require("dotenv").config();
const operatorKey = PrivateKey.fromString(process.env.OPERATOR_PVKEY);
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const client = Client.forTestnet().setOperator(operatorId, operatorKey);
async function main() {
// ... code for client initialization ...
let tokenCreateTx = await new TokenCreateTransaction()
.setTokenName("HTSB")
.setTokenSymbol("HTSB")
.setTokenType(TokenType.FungibleCommon)
.setDecimals(3)
.setInitialSupply(100000000000000)
.setTreasuryAccountId(operatorId)
.freezeWith(client)
.sign(operatorKey);
let tokenCreateSubmit = await tokenCreateTx.execute(client);
let tokenCreateRx = await tokenCreateSubmit.getReceipt(client);
let tokenId = tokenCreateRx.tokenId;
console.log(` - Created fungible token with ID: ${tokenId}`);
}
Also, Discover | Deploying a Smart Contract on Hedera Hashgraph Network with Java
Creating fungible tokens on Hedera Hashgraph is a straightforward process, thanks to the Hedera SDK. This functionality opens up opportunities for various use cases, including creating digital currencies, loyalty points, and much more.
If you are interested in fungible token development, then connect with our blockchain developers.
September 8, 2024 at 02:38 am
Your comment is awaiting moderation.