Use this file to discover all available pages before exploring further.
Learn how to launch a simple fungible token on Hedera testnet. A fungible token is a divisible digital asset (think loyalty points, stablecoins, or stocks) created by the Hedera Token Service (HTS).
A Hedera testnet operator account ID and DER-encoded private key (from the Quickstart)
A few testnet HBAR (ℏ) to cover the ≈ $1 token-creation fee
We will use the operator account as the token’s treasury (the account that initially holds the supply).
NoteYou can always check the ” ✅ Code Check” section at the bottom of each page to view the entire code if you run into issues. You can also post your issue to the respective SDK channel in our Discord communityhere.
Create a createTokenDemo.js file and add the following imports:
import { Client, PrivateKey, TokenCreateTransaction, TokenSupplyType,} from "@hashgraph/sdk";
Add the Java SDK depenency to your Maven project’s pom.xml and create your source file:Create a new Maven project and name it HederaExamples. Add the following dependencies to your pom.xml file:
Or for Gradle projects using the Groovy DSL, add these dependencies to your build.gradle file and install the dependencies using ./gradlew build
plugins { id 'java' id 'application'}repositories { mavenCentral()}dependencies { implementation 'com.hedera.hashgraph:sdk:2.60.0' implementation 'com.google.code.gson:gson:2.10.1' implementation 'io.grpc:grpc-netty-shaded:1.61.0'}application { mainClass = 'CreateTokenDemo' // or 'com.example.CreateTokenDemo' if it's in a package}
Create a CreateTokenDemo.java class in src/main/java/ with the following imports:
import com.hedera.hashgraph.sdk.*;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.net.URI;import com.google.gson.Gson;import com.google.gson.JsonObject;import com.google.gson.JsonArray;public class CreateTokenDemo { public static void main(String[] args ) throws Exception { // Your token creation code will go here }}/
Create a new file create_token_demo.go and import the following packages to your file:
In your project’s root directory, initialize modules and pull in the Go SDK:
-module
go mod init create_token_demogo get github.com/hiero-ledger/hiero-sdk-go/v2@latestgo mod tidy
Before you start: Ensure you have Python 3.10+ installed on your machine. Run this command to verify.
python --version
If the python --version command is not found or shows a version lower than 3.10, install or upgrade Python from Python Install.Note: On some systems, you may need to use python3 instead of python for initial setup commands. If python --version doesn’t work, try python3 --version and use python3 for the virtual environment creation. After activating the virtual environment, always use python for all commands.Open your terminal and create a working directory for your Hedera project. Then navigate into the new directory:
mkdir hedera-examples && cd hedera-examples
Verify Python and pip: Ensure you have Python 3.10+ and pip installed on your machine. Run these commands to check:
python --version
python -m pip --version
Create a virtual environment to isolate your project dependencies (Python best practice):
python -m venv .venv
Activate the virtual environment to use the isolated Python installation:
Mac/Linux
Windows
source .venv/bin/activate
.venv\Scripts\activate
Upgrade pip to ensure you have the latest package installer (recommended):
Set your operator credentials as environment variables. Your OPERATOR_ID is your testnet account ID. Your OPERATOR_KEY is your testnet account’s corresponding ECDSA private key.
Load your operator credentials from environment variables and initialize your Hedera testnet client. This client will connect to the Hedera test network and use your operator account to sign transactions and pay transaction fees.
// Load your operator credentialsconst operatorId = process.env.OPERATOR_ID;const operatorKey = process.env.OPERATOR_KEY;// Initialize your testnet client and set operatorconst client = Client.forTestnet().setOperator(operatorId, operatorKey);
adminKey lets you update or delete the token; supplyKey authorizes mint and burn operations. We use the same key for both roles to keep this tutorial simple.
// Generate keys that control your tokenconst supplyKey = PrivateKey.generateECDSA(); // can mint/burnconst adminKey = supplyKey; // can update and delete (reuse for simplicity)
‼️ Security reminder: Keep your private keys secure - anyone with access can control your token.
Build a TokenCreateTransaction with your token properties like name, symbol, and initial supply. Sign the transaction with your admin key, submit it to the network, and Hedera returns a unique token ID that identifies your token.
// Build the transactionconst transaction = new TokenCreateTransaction() .setTokenName("Demo Token") // readable name .setTokenSymbol("DEMO") .setDecimals(2) // 100 = 1.00 token .setInitialSupply(100_000) // 1 000.00 DEMO in treasury .setSupplyType(TokenSupplyType.Finite) .setMaxSupply(100_000) // cap equals initial supply .setTreasuryAccountId(operatorId) .setAdminKey(adminKey.publicKey) // optional .setSupplyKey(supplyKey.publicKey) // optional for fungible tokens .setTokenMemo("Created via tutorial") .freezeWith(client);// Sign with the admin key, execute with the operator, and get receiptconst signedTx = await transaction.sign(adminKey);const txResponse = await signedTx.execute(client);const receipt = await txResponse.getReceipt(client);const tokenId = receipt.tokenId;console.log(`\nFungible token created: ${tokenId.toString()}`)
Step 4: Query the Treasury Balance Using Mirror Node API
Use the Mirror Node REST API to check your treasury account’s token balance. Mirror nodes provide free access to network data without transaction fees.API endpoint:
{accountId} - Your treasury account (operator account)
{tokenId} - Token ID from the creation transaction
Why this endpoint?This endpoint queries the account’s token balances, filtered by the specific token ID. It returns detailed information including the balance and token metadata, making it ideal for verifying the treasury account holds the expected initial supply.
🎉 Great work! You’ve successfully created your first fungible token on Hedera and verified its balance using the Mirror Node API. Guard your private keys and happy building!