The admin key may also delete the token entirely. - `fee_schedule` may authorize updating the token custom fees. If this key is not present, the custom fees for the token are fixed and immutable. - `freeze` may authorize a token freeze or unfreeze transaction. If this key is not present, accounts holding this token cannot have their tokens frozen or unfrozen. - `kyc` may authorize a token grant KYC or revoke KYC transaction. If this key is not present, accounts holding this token cannot have KYC status granted or revoked. - `metadata` may authorize token update nfts transactions. If this key is not present, the token metadata values for that non-fungible/unique token _type_ will be immutable. - `pause` may authorize a token pause or token unpause transaction. If this key is not present, the token cannot be paused (preventing any account from transacting in that token) or resumed. - `supply` may authorize a token mint or burn transaction. If this key is not present, the token cannot mint additional supply and existing tokens cannot be "burned" from the treasury (but _might_ still be "burned" from individual accounts, c.f. `wipeKey` and `tokenWipe`). - `wipe` may authorize a token wipe account transaction. If this key is not present, accounts holding this token cannot have their balance or NFTs wiped (effectively burned). #### Requirements If `tokenType` is fungible/common, the `initialSupply` MUST be strictly greater than zero(`0`).
If `tokenType` is non-fungible/unique, the `initialSupply` MUST be zero(`0`).
If `tokenSupplyType` is "infinite", the `maxSupply` MUST be zero(`0`).
If `tokenSupplyType` is "finite", the `maxSupply` MUST be strictly greater than zero(`0`).
### Block Stream Effects If the token is created, the Token Identifier SHALL be in the receipt.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Transaction
Transaction.SignableNodeTransactionBodyBytesNested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Executable
Executable.GrpcRequest -
Field Summary
Fields inherited from class com.hedera.hashgraph.sdk.Transaction
customFeeLimits, DEFAULT_AUTO_RENEW_PERIOD, defaultMaxTransactionFee, DUMMY_ACCOUNT_ID, DUMMY_TRANSACTION_ID, frozenBodyBuilder, innerSignedTransactions, outerTransactions, publicKeys, regenerateTransactionId, signers, sigPairLists, sourceTransactionBody, transactionIdsFields inherited from class com.hedera.hashgraph.sdk.Executable
attemptedAllNodes, blockingUnaryCall, grpcDeadline, logger, maxAttempts, maxBackoff, minBackoff, nodeAccountIds, nodes, random, RST_STREAM -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) TokenCreateTransactionBody.Builderbuild()Build the transaction body.freezeWith(Client client) Freeze this transaction from further modification to prepare for signing or serialization.Extract the admin key.Extract the auto renew account id.Extract the auto renew period.Extract the custom fees.intExtract the decimals.Extract the expiration time.Extract the fee schedule key.booleanExtract the freeze default.Extract the freeze key.longExtract the initial supply of tokens.Extract the know your customer key.longExtract the max supply of tokens.Extract the metadata key.(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.Extract the pause key.Extract the supply key.Extract the supply type.Extract the token's memo 100 bytes max.byte[]Extract the token metadata.Extract the token name.Extract the token symbol.Extract the token type.Extract the treasury account id.Extract the wipe key.(package private) voidInitialize from the transaction body.(package private) voidonFreeze(TransactionBody.Builder bodyBuilder) Called inTransaction.freezeWith(Client)just before the transaction body is built.(package private) voidonScheduled(SchedulableTransactionBody.Builder scheduled) Called inTransaction.schedule()when converting transaction into a scheduled version.setAdminKey(Key key) An Hedera key for token administration.setAutoRenewAccountId(AccountId accountId) An identifier for the account to be charged renewal fees at the token's expiry to extend the lifetime of the token.setAutoRenewPeriod(Duration period) A duration between token automatic renewals.
All entities in state may be charged "rent" occasionally (typically every 90 days) to prevent unnecessary growth of the ledger.setCustomFees(List<CustomFee> customFees) A list of custom fees representing a fee schedule.setDecimals(int decimals) A decimal precision of the token's smallest denomination.
Most values are described in terms of this smallest denomination, so the token initial supply, for instance, must be divided by 10decimals to get whole tokens.setExpirationTime(Duration expirationTime) setExpirationTime(Instant expirationTime) An expiration timestamp.setFeeScheduleKey(Key key) An Hedera key for managing the token custom fee schedule.setFreezeDefault(boolean freezeDefault) An initial Freeze status for accounts associated to this token.setFreezeKey(Key key) An Hedera key for managing asset "freeze".setInitialSupply(long initialSupply) An initial supply, in the smallest denomination for the token.An Hedera key for managing account KYC.setMaxSupply(long maxSupply) A maximum supply for this token.setMetadataKey(Key key) An Hedera key for managing the token `metadata`.setPauseKey(Key key) An Hedera key for managing token "pause".setSupplyKey(Key key) An Hedera key for "minting" and "burning" tokens.setSupplyType(TokenSupplyType supplyType) A supply type for this token, according to IWA classification.setTokenMemo(String memo) A short description for this token.setTokenMetadata(byte[] tokenMetadata) Token "Metadata".setTokenName(String name) A name for the token.
This is generally the "full name" displayed in wallet software.setTokenSymbol(String symbol) A symbol to use for the token.setTokenType(TokenType tokenType) A type for this token, according to IWA classification.setTreasuryAccountId(AccountId accountId) A treasury account identifier.setWipeKey(Key key) An Hedera key for wiping tokens from accounts.(package private) voidvalidateChecksums(Client client) Methods inherited from class com.hedera.hashgraph.sdk.Transaction
addSignature, addSignature, batchify, buildAllTransactions, buildTransaction, doSchedule, estimateFee, freeze, fromBytes, fromScheduledTransaction, generateTransactionIds, getBatchKey, getDefaultMaxTransactionFee, getExecutionState, getHighVolume, getMaxTransactionFee, getRegenerateTransactionId, getRequiredChunks, getSignableNodeBodyBytesList, getSignatures, getSignaturesAtOffset, getTransactionBodySize, getTransactionHash, getTransactionHashPerNode, getTransactionId, getTransactionIdInternal, getTransactionMemo, getTransactionSize, getTransactionValidDuration, hash, isBatchedAndNotBatchTransaction, isFrozen, keyAlreadySigned, makeRequest, mapResponse, mapResponseStatus, onExecute, onExecuteAsync, regenerateTransactionId, requireNotFrozen, requireOneNodeAccountId, schedule, setBatchKey, setHighVolume, setMaxTransactionFee, setNodeAccountIds, setRegenerateTransactionId, setTransactionId, setTransactionMemo, setTransactionValidDuration, sign, signTransaction, signWith, signWithOperator, spawnBodyBuilder, toBytes, toString, wipeTransactionListsMethods inherited from class com.hedera.hashgraph.sdk.Executable
advanceRequest, checkNodeAccountIds, execute, execute, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, getGrpcRequest, getMaxAttempts, getMaxBackoff, getMaxRetry, getMinBackoff, getNodeAccountIds, getNodeForExecute, grpcDeadline, logTransaction, mergeFromClient, setGrpcDeadline, setLogger, setMaxAttempts, setMaxBackoff, setMaxRetry, setMinBackoff, setNodesFromNodeAccountIds, setRequestListener, setResponseListener, shouldRetryExceptionally
-
Constructor Details
-
TokenCreateTransaction
public TokenCreateTransaction()Constructor. -
TokenCreateTransaction
TokenCreateTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, throws com.google.protobuf.InvalidProtocolBufferExceptionTransaction>> txs) Constructor.- Parameters:
txs- Compound list of transaction id's list of (AccountId, Transaction) records- Throws:
com.google.protobuf.InvalidProtocolBufferException- when there is an issue with the protobuf
-
TokenCreateTransaction
TokenCreateTransaction(TransactionBody txBody) Constructor.- Parameters:
txBody- protobuf TransactionBody
-
-
Method Details
-
getTokenName
Extract the token name.- Returns:
- the token name
-
setTokenName
A name for the token.
This is generally the "full name" displayed in wallet software.This field is REQUIRED.
This value MUST NOT exceed 100 bytes when encoded as UTF-8.
This value MUST NOT contain the Unicode NUL codepoint.- Parameters:
name- the token name- Returns:
this
-
getTokenSymbol
Extract the token symbol.- Returns:
- the token symbol
-
setTokenSymbol
A symbol to use for the token.This field is REQUIRED.
This value MUST NOT exceed 100 bytes when encoded as UTF-8.
This value MUST NOT contain the Unicode NUL codepoint.- Parameters:
symbol- the token symbol- Returns:
this
-
getDecimals
public int getDecimals()Extract the decimals.- Returns:
- the decimals
-
setDecimals
A decimal precision of the token's smallest denomination.
Most values are described in terms of this smallest denomination, so the token initial supply, for instance, must be divided by 10decimals to get whole tokens.This MUST be zero(`0`) for non-fungible/unique tokens.
- Parameters:
decimals- the number of decimals- Returns:
this
-
getInitialSupply
public long getInitialSupply()Extract the initial supply of tokens.- Returns:
- the initial supply of tokens
-
setInitialSupply
An initial supply, in the smallest denomination for the token.This amount SHALL be transferred to the treasury account as part of this transaction.
This amount MUST be specified in the smallest denomination for the token (i.e. 10-decimals whole tokens).
This MUST be zero(`0`) for a non-fungible/unique token.- Parameters:
initialSupply- the initial supply of tokens- Returns:
this
-
getTreasuryAccountId
Extract the treasury account id.- Returns:
- the treasury account id
-
setTreasuryAccountId
A treasury account identifier.This field is REQUIRED.
The identified account SHALL be designated the "treasury" for the new token, and all tokens "minted" SHALL be delivered to that account, including the initial supply, if any.
The identified account MUST exist, MUST NOT be expired, and SHOULD have a non-zero HBAR balance.
The identified account SHALL be associated to the new token.- Parameters:
accountId- the treasury account id- Returns:
this
-
getAdminKey
Extract the admin key.- Returns:
- the admin key
-
setAdminKey
An Hedera key for token administration.This key, if set, SHALL have administrative authority for this token and MAY authorize token update and/or token delete transactions.
If this key is not set, or is an empty `KeyList`, this token SHALL be immutable, except for expiration and renewal.- Parameters:
key- the admin key- Returns:
this
-
getKycKey
Extract the know your customer key.- Returns:
- the know your customer key
-
setKycKey
An Hedera key for managing account KYC.This key, if set, SHALL have KYC authority for this token and MAY authorize transactions to grant or revoke KYC for accounts.
If this key is not set, or is an empty `KeyList`, KYC status for this token SHALL NOT be granted or revoked for any account.
If this key is removed after granting KYC, those grants SHALL remain and cannot be revoked.- Parameters:
key- the know your customer key- Returns:
this
-
getFreezeKey
Extract the freeze key.- Returns:
- the freeze key
-
setFreezeKey
An Hedera key for managing asset "freeze".This key, if set, SHALL have "freeze" authority for this token and MAY authorize transactions to freeze or unfreeze accounts with respect to this token.
If this key is not set, or is an empty `KeyList`, this token SHALL NOT be frozen or unfrozen for any account.
If this key is removed after freezing accounts, those accounts SHALL remain frozen and cannot be unfrozen.- Parameters:
key- the freeze key- Returns:
this
-
getWipeKey
Extract the wipe key.- Returns:
- the wipe key
-
setWipeKey
An Hedera key for wiping tokens from accounts.This key, if set, SHALL have "wipe" authority for this token and MAY authorize transactions to "wipe" any amount of this token from any account, effectively burning the tokens "wiped".
If this key is not set, or is an empty `KeyList`, it SHALL NOT be possible to "wipe" this token from an account.- Parameters:
key- the wipe key- Returns:
this
-
getSupplyKey
Extract the supply key.- Returns:
- the supply key
-
setSupplyKey
An Hedera key for "minting" and "burning" tokens.This key, if set, MAY authorize transactions to "mint" new tokens to be delivered to the token treasury or "burn" tokens held by the token treasury.
If this key is not set, or is an empty `KeyList`, it SHALL NOT be possible to change the supply of tokens and neither "mint" nor "burn" transactions SHALL be permitted.- Parameters:
key- the supply key- Returns:
this
-
getFeeScheduleKey
Extract the fee schedule key.- Returns:
- the fee schedule key
-
setFeeScheduleKey
An Hedera key for managing the token custom fee schedule.This key, if set, MAY authorize transactions to modify the `custom_fees` for this token.
If this key is not set, or is an empty `KeyList`, the `custom_fees` for this token SHALL NOT be modified.- Parameters:
key- the fee schedule key- Returns:
this
-
getPauseKey
Extract the pause key.- Returns:
- the pause key
-
setPauseKey
An Hedera key for managing token "pause".This key, if set, SHALL have "pause" authority for this token and MAY authorize transactions to pause or unpause this token.
If this key is not set, or is an empty `KeyList`, this token SHALL NOT be paused or unpaused.
If this key is removed while the token is paused, the token cannot be unpaused and SHALL remain paused.- Parameters:
key- the pause key- Returns:
this
-
getMetadataKey
Extract the metadata key.- Returns:
- the metadata key
-
setMetadataKey
An Hedera key for managing the token `metadata`.This key, if set, MAY authorize transactions to modify the `metadata` for this token.
If this key is not set, or is an empty `KeyList`, the `metadata` for this token SHALL NOT be modified.- Parameters:
key- the metadata key- Returns:
this
-
getFreezeDefault
public boolean getFreezeDefault()Extract the freeze default.- Returns:
- the freeze default
-
setFreezeDefault
An initial Freeze status for accounts associated to this token.If this value is set, an account MUST be the subject of a `tokenUnfreeze` transaction after associating to the token before that account can send or receive this token.
If this value is set, the `freezeKey` SHOULD be set.
If the `freezeKey` is not set, any account associated to this token while this value is set SHALL be permanently frozen.REVIEW NOTE
Should we prevent setting this value true for tokens with no freeze key?
Should we set this value to false if a freeze key is removed?- Parameters:
freezeDefault- the freeze default- Returns:
this
-
getExpirationTime
Extract the expiration time.- Returns:
- the expiration time
-
setExpirationTime
An expiration timestamp.If the `autoRenewAccount` and `autoRenewPeriod` fields are set, this value SHALL be replaced with the current consensus time extended by the `autoRenewPeriod` duration.
If this value is set and token expiration is enabled in network configuration, this token SHALL expire when consensus time exceeds this value, and MAY be subsequently removed from the network state.
If this value is not set, and the automatic renewal account is also not set, then this value SHALL default to the current consensus time extended by the "default" expiration period from network configuration. Setting this value will clear the autoRenewPeriod as the autoRenewPeriod period has default value of 7890000 seconds and leaving it set will override the expiration time- Parameters:
expirationTime- the expiration time- Returns:
this
-
setExpirationTime
-
getAutoRenewAccountId
Extract the auto renew account id.- Returns:
- the auto renew account id
-
setAutoRenewAccountId
An identifier for the account to be charged renewal fees at the token's expiry to extend the lifetime of the token.If this value is set, the token lifetime SHALL be extended by the _smallest_ of the following:
- The current `autoRenewPeriod` duration.
- The maximum duration that this account has funds to purchase.
- The configured MAX_AUTORENEW_PERIOD at the time of automatic renewal.
If this value is set, the referenced account MUST sign this transaction.- Parameters:
accountId- the auto renew account id- Returns:
this
-
getAutoRenewPeriod
Extract the auto renew period.- Returns:
- the auto renew period
-
setAutoRenewPeriod
A duration between token automatic renewals.
All entities in state may be charged "rent" occasionally (typically every 90 days) to prevent unnecessary growth of the ledger. This value sets the interval between such events for this token.This value MUST be set.
This value MUST be greater than the configured MIN_AUTORENEW_PERIOD.
This value MUST be less than the configured MAX_AUTORENEW_PERIOD. If expirationTime is set - autoRenewPeriod will be effectively ignored, and it's effect will be replaced by expirationTime- Parameters:
period- the auto renew period- Returns:
this
-
getTokenMemo
Extract the token's memo 100 bytes max.- Returns:
- the token's memo 100 bytes max
-
setTokenMemo
A short description for this token.This value, if set, MUST NOT exceed `transaction.maxMemoUtf8Bytes` (default 100) bytes when encoded as UTF-8.
- Parameters:
memo- the token's memo 100 bytes max- Returns:
this
-
getCustomFees
Extract the custom fees.- Returns:
- the custom fees
-
setCustomFees
A list of custom fees representing a fee schedule.This list MAY be empty, which SHALL mean that there are no custom fees for this token.
If this token is a non-fungible/unique type, the entries in this list MUST NOT declare a `fractional_fee`.
If this token is a fungible/common type, the entries in this list MUST NOT declare a `royalty_fee`.
Any token type MAY include entries that declare a `fixed_fee`.- Parameters:
customFees- the custom fees- Returns:
this
-
getTokenType
Extract the token type.- Returns:
- the token type
-
setTokenType
A type for this token, according to IWA classification.If this value is not set, the token SHALL have the default type of fungible/common.
This field SHALL be immutable.- Parameters:
tokenType- the token type- Returns:
this
-
getSupplyType
Extract the supply type.- Returns:
- the supply type
-
setSupplyType
A supply type for this token, according to IWA classification.If this value is not set, the token SHALL have the default supply type of "infinite" (which is, as a practical matter, (263-1)/10decimals).
This field SHALL be immutable.- Parameters:
supplyType- the supply type- Returns:
this
-
getMaxSupply
public long getMaxSupply()Extract the max supply of tokens.- Returns:
- the max supply of tokens
-
setMaxSupply
A maximum supply for this token.This SHALL be interpreted in terms of the smallest fractional unit for this token.
If `supplyType` is "infinite", this MUST be `0`.
This field SHALL be immutable.- Parameters:
maxSupply- the max supply of tokens- Returns:
this
-
getTokenMetadata
public byte[] getTokenMetadata()Extract the token metadata.- Returns:
- the token metadata
-
setTokenMetadata
Token "Metadata".The value, if set, MUST NOT exceed 100 bytes.
- Examples
- hcs://1/0.0.4896575
- ipfs://bafkreifd7tcjjuwxxf4qkaibkj62pj4mhfuud7plwrc3pfoygt55al6syi
- Parameters:
tokenMetadata- the token metadata- Returns:
this
-
freezeWith
Description copied from class:TransactionFreeze this transaction from further modification to prepare for signing or serialization.Will use the `Client`, if available, to generate a default Transaction ID and select 1/3 nodes to prepare this transaction for.
- Overrides:
freezeWithin classTransaction<TokenCreateTransaction>- Parameters:
client- the configured client- Returns:
this
-
build
Build the transaction body.- Returns:
TokenCreateTransactionBody
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
validateChecksums
- Specified by:
validateChecksumsin classTransaction<TokenCreateTransaction>- Throws:
BadEntityIdException
-
getMethodDescriptor
io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()Description copied from class:ExecutableCalled to direct the invocation of the query to the appropriate gRPC service.- Specified by:
getMethodDescriptorin classExecutable<TokenCreateTransaction,Transaction, TransactionResponse, TransactionResponse>
-
onFreeze
Description copied from class:TransactionCalled inTransaction.freezeWith(Client)just before the transaction body is built. The intent is for the derived class to assign their data variant to the transaction body.- Specified by:
onFreezein classTransaction<TokenCreateTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<TokenCreateTransaction>
-