Update a topic

A transaction that updates the properties of an existing topic. This includes the topic memo, admin key, submit key, auto-renew account, auto-renew period and fee-related fields.

Topic Properties

Field
Description

Topic ID

Update the topic ID

Admin Key

Set a new admin key that authorizes update topic and delete topic transactions.

Submit Key

Set a new submit key for a topic that authorizes sending messages to this topic.

Topic Memo

Set a new short publicly visible memo on the new topic and is stored with the topic. (100 bytes)

Auto Renew Account

Set a new auto-renew account ID for this topic. Currently, rent is not enforced for topics so auto-renew payments will not be made.

Auto Renew Period

Set a new auto-renew period for this topic. Currently, rent is not enforced for topics so auto-renew payments will not be made. NOTE: The minimum period of time is approximately 30 days (2592000 seconds) and the maximum period of time is approximately 92 days (8000001 seconds). Any other value outside of this range will return the following error: AUTORENEW_DURATION_NOT_IN_RANGE.

Fee Schedule Key

(Optional) A key that controls updates and deletions of topic fees. Must be set at creation; cannot be added later via updateTopic.

Fee Exempt Keys

(Optional) A list of keys that, if used to sign a message submission, allow the sender to bypass fees. Can be updated later via updateTopic.

Custom Fees

(Optional) A fee structure applied to message submissions for revenue generation. Can be updated later via updateTopic, but must be signed by the Fee Schedule Key. Defines a fixed fee required for each message submission to the topic. This fee can be set in HBAR or HTS fungible tokens and applies when messages are submitted.

Transaction Signing Requirements

  • If an admin key is updated, the transaction must be signed by the pre-update admin key and post-update admin key.

  • If the admin key was set during the creation of the topic, the admin key must sign the transaction to update any of the topic's properties.

  • If no adminKey was defined during the creation of the topic, you can only extend the expirationTime.

  • If a TopicUpdateTransaction updates the fee schedule, the Fee Schedule Key must sign the transaction. If the Fee Schedule Key is being updated, both the existing (old) and the new Fee Schedule Key must sign the transaction.

Transaction Fees

  • Each transaction incurs a standard Hedera network fee based on network resource usage.

  • If a custom fee is set for a topic, users submitting messages must pay this fee in HBAR or HTS tokens.

  • The Fee Schedule Key allows authorized users to update fee structures. If set, it must sign transactions modifying fees.

  • Fee exemptions can be granted using the Fee Exempt Key List.

  • Use the Hedera Fee Estimator to estimate standard network fees.

Methods

Method
Type
Requirements

setTopicId(<topicId>)

TopicId

Required

setAdminKey(<adminKey>)

Key

Optional

setSubmitKey(<submitKey>)

Key

Optional

setExpirationTime(<expirationTime>)

Instant

Optional

setTopicMemo(<memo>)

String

Optional

setAutoRenewAccountId(<accountId>)

AccountId

Optional

setAutoRenewPeriod(<autoRenewPeriod>)

Duration

Optional

setFeeScheduleKey()

Key

Optional

setFeeExemptKeys()

List

Optional

setCustomFees()

List

Optional

clearAdminKey()

Optional

clearSubmitKey()

Optional

clearTopicMemo()

Optional

clearAutoRenewAccountId()

Optional

// Update a topic to set new custom fees
TopicUpdateTransaction transaction = new TopicUpdateTransaction()
    .setTopicId(topicId)              // Set the topic ID to update
    .setCustomFees(newCustomFees)      // Set the new list of custom fees
    .freezeWith(client)                // Freeze the transaction

    // Sign with the Fee Schedule Key to authorize fee changes
    .sign(feeScheduleKey);

// Submit the transaction to the Hedera network
TransactionResponse txResponse = transaction.execute(client);

// Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);

// Get the transaction consensus status
Status transactionStatus = receipt.status;

System.out.println("The transaction consensus status is " + transactionStatus);

// v2.0.0

Get transaction values

Method
Type
Requirements

getTopicId()

TopicId

Required

getAdminKey()

Key

Optional

getSubmitKey()

Key

Optional

getTopicMemo()

String

Optional

getAutoRenewAccountId()

AccountId

Required

getAutoRenewPeriod()

Duration

Required

getFeeScheduleKey()

Key

Optional

getFeeExemptKeys()

List

Optional

getCustomFees()

List

Optional

 //Create a transaction to add a submit key
TopicUpdateTransaction transaction = new TopicUpdateTransaction()
    .setSubmitKey(submitKey);

//Get submit key
transaction.getSubmitKey()

//v2.0.0

Last updated

Was this helpful?