If `adminKey` is set, that Key MUST sign the transaction.
On success, the resulting `TransactionReceipt` SHALL contain the newly created `TopicId`. The `autoRenewPeriod` on a topic MUST be set to a value between `autoRenewPeriod.minDuration` and `autoRenewPeriod.maxDuration`. These values are configurable, typically 30 and 92 days.
This also sets the initial expirationTime of the topic. If no `adminKey` is set on a topic -`autoRenewAccount` SHALL NOT be set on the topic. - A `deleteTopic` transaction SHALL fail. - An `updateTopic` transaction that only extends the expirationTime MAY succeed. - Any other `updateTopic` transaction SHALL fail. If the topic expires and is not automatically renewed, the topic SHALL enter the `EXPIRED` state. - All transactions on the topic SHALL fail with TOPIC_EXPIRED - Except an updateTopic() call that only extends the expirationTime. - getTopicInfo() SHALL succeed, and show the topic is expired. The topic SHALL remain in the `EXPIRED` state for a time determined by the `autorenew.gracePeriod` (configurable, originally 7 days).
After the grace period, if the topic's expirationTime is not extended, the topic SHALL be automatically deleted from state entirely, and cannot be recovered or recreated. ### Block Stream Effects None
-
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 TypeMethodDescriptionaddCustomFee(CustomFixedFee customFixedFee) Adds fixed fee to assess when a message is submitted to the new topic.addFeeExemptKey(Key feeExemptKey) Adds a key that will be exempt from paying fees.(package private) ConsensusCreateTopicTransactionBody.Builderbuild()Build the transaction body.Clears fixed fees.Clears all keys that will be exempt from paying fees.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.Returns the fixed fees to assess when a message is submitted to the new topic.Returns the keys that will be exempt from paying fees.Returns the key which allows updates to the new topic’s fees.(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.Extract the submit key.Extract the topic memo.(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 adminKey) Access control for modification of the topic after it is created.setAutoRenewAccountId(AccountId autoRenewAccountId) The ID of the account to be charged renewal fees at the topic's expirationTime to extend the lifetime of the topic.setAutoRenewPeriod(Duration autoRenewPeriod) The initial lifetime, in seconds, for the topic.
This is also the number of seconds for which the topic SHALL be automatically renewed upon expiring, if it has a valid auto-renew account.setCustomFees(List<CustomFixedFee> customFees) Sets the fixed fees to assess when a message is submitted to the new topic.setFeeExemptKeys(List<Key> feeExemptKeys) Sets the keys that will be exempt from paying fees.setFeeScheduleKey(Key feeScheduleKey) Sets the key which allows updates to the new topic’s fees.setSubmitKey(Key submitKey) Access control for message submission to the topic.setTopicMemo(String memo) Set a short publicly visible memo on the new topic.(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
-
TopicCreateTransaction
public TopicCreateTransaction()Constructor. -
TopicCreateTransaction
TopicCreateTransaction(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
-
TopicCreateTransaction
TopicCreateTransaction(TransactionBody txBody) Constructor.- Parameters:
txBody- protobuf TransactionBody
-
-
Method Details
-
getTopicMemo
Extract the topic memo.- Returns:
- the topic memo
-
setTopicMemo
Set a short publicly visible memo on the new topic.- Parameters:
memo- The memo to be set- Returns:
this
-
getAdminKey
Extract the admin key.- Returns:
- the admin key
-
setAdminKey
Access control for modification of the topic after it is created.If this field is set, that key MUST sign this transaction.
If this field is set, that key MUST sign each future transaction to update or delete the topic.
An updateTopic transaction that _only_ extends the topic expirationTime (a "manual renewal" transaction) SHALL NOT require admin key signature.
A topic without an admin key SHALL be immutable, except for expiration and renewal.
If adminKey is not set, then `autoRenewAccount` SHALL NOT be set.- Parameters:
adminKey- The Key to be set- Returns:
this
-
getSubmitKey
Extract the submit key.- Returns:
- the submit key
-
setSubmitKey
Access control for message submission to the topic.If this field is set, that key MUST sign each consensus submit message for this topic.
If this field is not set then any account may submit a message on the topic, without restriction.- Parameters:
submitKey- The Key to be set- Returns:
this
-
getAutoRenewPeriod
Extract the auto renew period.- Returns:
- the auto renew period
-
setAutoRenewPeriod
The initial lifetime, in seconds, for the topic.
This is also the number of seconds for which the topic SHALL be automatically renewed upon expiring, if it has a valid auto-renew account.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.- Parameters:
autoRenewPeriod- The Duration to be set for auto renewal- Returns:
this
-
getAutoRenewAccountId
Extract the auto renew account id.- Returns:
- the auto renew account id
-
setAutoRenewAccountId
The ID of the account to be charged renewal fees at the topic's expirationTime to extend the lifetime of the topic.The topic 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 `adminKey` field MUST also be set (though that key MAY not have any correlation to this account).- Parameters:
autoRenewAccountId- The AccountId to be set for auto renewal- Returns:
this
-
getFeeScheduleKey
Returns the key which allows updates to the new topic’s fees.- Returns:
- the feeScheduleKey
-
setFeeScheduleKey
Sets the key which allows updates to the new topic’s fees.- Parameters:
feeScheduleKey- the feeScheduleKey to be set- Returns:
this
-
getFeeExemptKeys
Returns the keys that will be exempt from paying fees.- Returns:
- the feeExemptKeys
-
setFeeExemptKeys
Sets the keys that will be exempt from paying fees.- Parameters:
feeExemptKeys- the keys to be set- Returns:
this
-
clearFeeExemptKeys
Clears all keys that will be exempt from paying fees.- Returns:
this
-
addFeeExemptKey
Adds a key that will be exempt from paying fees.- Parameters:
feeExemptKey- feeExemptKey- Returns:
this
-
getCustomFees
Returns the fixed fees to assess when a message is submitted to the new topic.- Returns:
- the List
-
setCustomFees
Sets the fixed fees to assess when a message is submitted to the new topic.- Parameters:
customFees- List of CustomFixedFee- Returns:
this
-
clearCustomFees
Clears fixed fees.- Returns:
this
-
addCustomFee
Adds fixed fee to assess when a message is submitted to the new topic.- Parameters:
customFixedFee- CustomFixedFee- Returns:
this
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
build
Build the transaction body.- Returns:
ConsensusCreateTopicTransactionBody
-
validateChecksums
- Specified by:
validateChecksumsin classTransaction<TopicCreateTransaction>- 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<TopicCreateTransaction,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<TopicCreateTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<TopicCreateTransaction>
-
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<TopicCreateTransaction>- Parameters:
client- the configured client- Returns:
this
-