Hedera
Search…
Create a token
Check out "Getting Started with the Hedera Token Service" video tutorial in JavaScript here.
Create a new fungible or non-fungible token (NFT) on the Hedera network. After you submit the transaction to the Hedera network, you can obtain the new token ID by requesting the receipt. Smart contracts cannot access or transfer HTS tokens at this time.
NFTs
For non-fungible tokens, the token ID represents a NFT class. Once the token is created, you will have to mint each NFT using the token mint operation.
Note: It is required to set the initial supply for an NFT to 0.
Token Properties
Property
Description
Name
Set the publicly visible name of the token. The token name is specified as a string of UTF-8 characters. The token name is not unique. Maximum of 100 characters.
Token Type
The type of token to create. Either fungible or non-fungible.
Symbol
The publicly visible token symbol. It is UTF-8 capitalized alphabetical string identifying the token. The token symbol is not unique. Maximum of 100 characters.
Decimal
The number of decimal places a token is divisible by. This field can never be changed.
Initial Supply
Specifies the initial supply of fungible tokens to be put in circulation. The initial supply is sent to the Treasury Account. The maximum supply of tokens is 9,223,372,036,854,775,807(2^63-1) tokens and is in the lowest denomination possible. For creating an NFT, you must set the initial supply to 0.
Treasury Account
The account which will act as a treasury for the token. This account will receive the specified initial supply and any additional tokens that are minted. If tokens are burned, the supply will decreased from the treasury account.
Admin Key
The key which can perform token update and token delete operations on the token.The admin key has the authority to change the freeze key, wipe key, and KYC key. It can also update the treasury account of the token. If empty, the token can be perceived as immutable (not being able to be updated/deleted).
KYC Key
The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, and KYC grant or revoke operations are not possible.
Freeze Key
The key which can sign to freeze or unfreeze an account for token transactions. If empty, freezing is not possible.
Wipe Key
The key which can wipe the token balance of an account. If empty, wipe is not possible.
Supply Key
The key which can change the total supply of a token. This key is used to authorize token mint and burn transactions. If this is left empty, minting/burning tokens is not possible.
Fee Schedule Key
The key that can change the token's custom fee schedule. A custom fee schedule token without a fee schedule key is immutable.
Fee Schedule Key
The key which can change the token's custom fee schedule; must sign a TokenFeeScheduleUpdate transaction.
Pause Key
The key that has the authority to pause or unpause a token. Pausing a token prevents the token from participating in all transactions.
Custom Fees
Custom fees to charge during a token transfer transaction that transfers units of this token. Custom fees can either be fixed, fractional, or royalty fees. You can set up to a maximum of 10 custom fees.
Note: The 0.17 Hedera Services release allows for 1 royalty fee to be charged for a non-funigble token. This limitation will be removed in the 0.18 release.
Max Supply
For tokens of type FUNGIBLE_COMMON - the maximum number of tokens that can be in circulation. For tokens of type NON_FUNGIBLE_UNIQUE - the maximum number of NFTs (serial numbers) that can be minted. This field can never be changed.
Supply Type
Specifies the token supply type. Defaults to INFINITE.
Freeze Default
The default Freeze status (frozen or unfrozen) of Hedera accounts relative to this token. If true, an account must be unfrozen before it can receive the token.
Expiration Time
The epoch second at which the token should expire; if an auto-renew account and period are specified, this is coerced to the current epoch second plus the autoRenewPeriod. The default expiration time is 90 days.
Auto Renew Account
An account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval. This key is required to sign the transaction if present. This is not currently enabled.
Auto Renew Period
The interval at which the auto-renew account will be charged to extend the token's expiry. The default auto-renew period is 131,500 minutes. This is not currently enabled.
Memo
A short publicly visible memo about the token.
Transaction Signing Requirements:
    Treasury key is required to sign
    Admin key, if specified
    Transaction fee payer key
Constructor
Description
new TokenCreateTransaction()
Initializes the TokenCreateTransaction object
1
new TokenCreateTransaction()
Copied!

Methods

V2
V1
Method
Type
Requirement
setTokenName(<name>)
String
Required
setTokenType(<tokenType>)
TokenType
Optional
setTokenSymbol(<symbol>)
String
Required
setDecimals(<decimal>)
int
Optional
setInitialSupply(<initialSupply>)
int
Optional
setTreasuryAccountId(<treasury>)
AccountId
Required
setAdminKey(<key>)
Key
Optional
setKycKey(<key>)
Key
Optional
setFreezeKey(<key>)
Key
Optional
setWipeKey(<key>)
Key
Optional
setSupplyKey(<key>)
Key
Optional
setFreezeDefault(<freeze>)
boolean
Optional
setExpirationTime(<expirationTime>)
Instant
Optional
setFeeScheduleKey(<key>)
Key
Optional
setCustomFees(<customFees>)
List<CustomFee>
Optional
setSupplyType(<supplyType>)
TokenSupplyType
Optional
setMaxSupply(<maxSupply>)
long
Optional
setTokenMemo(<memo>)
String
Optional
setAutoRenewAccountId(<account>)
AccountId
Disabled
setAutoRenewPeriod(<period>)
Duration
Disabled
Java
1
//Create the transaction
2
TokenCreateTransaction transaction = new TokenCreateTransaction()
3
.setTokenName("Your Token Name")
4
.setTokenSymbol("F")
5
.setTreasuryAccountId(treasuryAccountId)
6
.setInitialSupply(5000)
7
.setAdminKey(adminKey.getPublicKey())
8
.setMaxTransactionFee(new Hbar(30)); //Change the default max transaction fee
9
10
//Build the unsigned transaction, sign with admin private key of the token, sign with the token treasury private key, submit the transaction to a Hedera network
11
TransactionResponse txResponse = transaction.freezeWith(client).sign(adminKey).sign(treasuryKey).execute(client);
12
13
//Request the receipt of the transaction
14
TransactionReceipt receipt = txResponse.getReceipt(client);
15
16
//Get the token ID from the receipt
17
TokenId tokenId = receipt.tokenId;
18
19
System.out.println("The new token ID is " + tokenId);
20
21
//v2.0.1
Copied!
JavaScript
1
//Create the transaction and freeze for manual signing
2
const transaction = await new TokenCreateTransaction()
3
.setTokenName("Your Token Name")
4
.setTokenSymbol("F")
5
.setTreasuryAccountId(treasuryAccountId)
6
.setInitialSupply(5000)
7
.setAdminKey(adminPublicKey)
8
.setMaxTransactionFee(new Hbar(30)) //Change the default max transaction fee
9
.freezeWith(client);
10
11
//Sign the transaction with the token adminKey and the token treasury account private key
12
const signTx = await (await transaction.sign(adminKey)).sign(treasuryKey);
13
14
//Sign the transaction with the client operator private key and submit to a Hedera network
15
const txResponse = await signTx.execute(client);
16
17
//Get the receipt of the transaction
18
const receipt = await txResponse.getReceipt(client);
19
20
//Get the token ID from the receipt
21
const tokenId = receipt.tokenId;
22
23
console.log("The new token ID is " + tokenId);
24
25
//v2.0.5
Copied!
Go
1
//Create the transaction and freeze the unsigned transaction
2
tokenCreateTransaction, err := hedera.NewTokenCreateTransaction().
3
SetTokenName("Your Token Name").
4
SetTokenSymbol("F").
5
SetTreasuryAccountID(treasuryAccountId).
6
SetInitialSupply(1000).
7
SetAdminKey(adminKey).
8
SetMaxTransactionFee(hedera.NewHbar(30)). //Change the default max transaction fee
9
FreezeWith(client)
10
11
if err != nil {
12
panic(err)
13
}
14
15
//Sign with the admin private key of the token, sign with the token treasury private key, sign with the client operator private key and submit the transaction to a Hedera network
16
txResponse, err := tokenCreateTransaction.Sign(adminKey).Sign(treasuryKey).Execute(client)
17
18
if err != nil {
19
panic(err)
20
}
21
22
//Request the receipt of the transaction
23
receipt, err := txResponse.GetReceipt(client)
24
if err != nil {
25
panic(err)
26
}
27
28
//Get the token ID from the receipt
29
tokenId := *receipt.TokenID
30
31
fmt.Printf("The new token ID is %v\n", tokenId)
32
33
//v2.1.0
Copied!
Method
Type
Requirement
setName(<name>)
String
Required
setTokenType(<tokenType>)
TokenType
Optional
setSymbol(<symbol>)
String
Required
setDecimals(<decimal>)
int
Optional
setInitialSupply(<initialSupply>)
int
Optional
setTreasury(<treasury>)
AccountId
Required
setAdminKey(<key>)
PublicKey
Required
setKycKey(<key>)
PublicKey
Optional
setFreezeKey(<key>)
PublicKey
Optional
setWipeKey(<key>)
PublicKey
Optional
setSupplyKey(<key>)
PublicKey
Optional
setCustomFees(<customFee>)
List<CustomFee>
Optional
setFeeScheduleKey(<key>)
PublicKey
Optional
setMaxSupply(<maxSupply>)
long
Optional
setFreezeDefault(<freeze>)
boolean
Optional
setExpirationTime(<expirationTime>)
Instant
Required
setAutoRenewAccount(<account>)
AccountId
Optional
setAutoRenewPeriod(<period>)
Duration
Optional
Java
1
//Create a token
2
TokenCreateTransaction transaction = new TokenCreateTransaction()
3
.setName("Your Token Name")
4
.setSymbol("F")
5
.setTreasury(treasuryAccountId)
6
.setInitialSupply(5000)
7
.setAdminKey(adminKey.publicKey);
8
9
//Build the unsigned transaction, sign with admin private key of the token, sign with the token treasury private key, submit the transaction to a Hedera network
10
TransactionId transactionId = transaction.build(client).sign(adminKey).sign(treasuryKey).execute(client);
11
12
//Request the receipt of the transaction
13
TransactionReceipt getReceipt = transactionId.getReceipt(client);
14
15
//Get the token ID from the receipt
16
TokenId tokenId = getReceipt.getTokenId();
17
18
System.out.println("The new token ID is " +tokenId);
19
20
//Version: 1.2.2
Copied!
JavaScript
1
//Create a token
2
const transaction = new TokenCreateTransaction()
3
.setName("Your Token Name")
4
.setSymbol("F")
5
.setTreasury(treasuryAccountId)
6
.setInitialSupply(5000)
7
.setAdminKey(adminKey.publicKey);
8
9
//Build the unsigned transaction, sign with the admin private key of the token, sign with the token treasury private key, submit the transaction to a Hedera network
10
const transactionId = await transaction.build(client).sign(adminKey).sign(treasuryKey).execute(client);
11
12
//Request the receipt of the transaction
13
const getReceipt = await transactionId.getReceipt(client);
14
15
//Get the token ID from the receipt
16
const tokenId = getReceipt.getTokenId();
17
18
console.log("The new token ID is " +tokenId);
19
20
//Version: 1.4.2
Copied!
Last modified 3d ago
Copy link
Contents
Methods