Topic info returns the the following values for a topic. Queries do not change the state of the topic or require network consensus. The information is returned from a single node processing the query.
Topic Info Response:
Field | Description |
Topic ID | The ID of the topic |
Admin Key | Access control for update/delete of the topic. Null if there is no key. |
Submit Key | Access control for ConsensusService.submitMessage. Null if there is no key. |
Sequence Number | Current sequence number (starting at 1 for the first submitMessage) of messages on the topic. |
Running Hash | SHA-384 running hash |
Expiration Time | Effective consensus timestamp at (and after) which submitMessage calls will no longer succeed on the topic and the topic will expire and be marked as deleted. |
Topic Memo | Short publicly visible memo about the topic. No guarantee of uniqueness. |
Auto Renew Period | The lifetime of the topic and the amount of time to extend the topic's lifetime by |
Auto Renew Account | Null if there is no autoRenewAccount. |
Query Signing Requirements
The client operator private key is required to sign the query request
Constructor | Description |
| Initializes the TopicInfoQuery object |
new TopicInfoQuery()
Method | Type | Description | Requirement |
| TopicId | The ID of the topic to get information for | Required |
Java//Create the account info queryTopicInfoQuery query = new TopicInfoQuery().setTopicId(newTopicId);​//Submit the query to a Hedera networkTopicInfo info = query.execute(client);​//Print the account key to the consoleSystem.out.println(info);​//v2.0.0
JavaScript//Create the account info queryconst query = new TopicInfoQuery().setTopicId(newTopicId);​//Submit the query to a Hedera networkconst info = await query.execute(client);​//Print the account key to the consoleconsole.log(info);​//v2.0.0
Go//Create the account info queryquery, err := hedera.NewTopicInfoQuery().SetTopicID(topicID)​//Submit the query to a Hedera networkinfo, err := query.Execute(client)if err != nil {panic(err)}​//Print the account key to the consoleprintln(info)​//v2.0.0
Sample Output:
TopicInfo{
topicId=0.0.102736,
topicMemo=,
runningHash=[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0. 0, 0,0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0
],
sequenceNumber=0,
expirationTime=2021-02-09T03:17:07.258292001Z,
adminKey=null,
submitKey=null,
autoRenewPeriod=PT2160H,
autoRenewAccountId=null
}
Constructor | Description |
| Initializes the ConsensusTopicInfoQuery object |
new ConsensusTopicInfoQuery()
​
Method | Type | Description | Requirement |
| TopicId | The ID of the topic to get information for | Required |
Java//Create the account info queryTopicInfoQuery query = new ConsensusTopicInfoQuery().setTopicId(newTopicId);​//Submit the query to a Hedera networkTopicInfo info = query.execute(client);​//Print the account key to the consoleSystem.out.println(info);​//v1.3.2
JavaScript//Create the account info queryconst query = new ConsensusTopicInfoQuery().setTopicId(newTopicId);​//Submit the query to a Hedera networkconst info = await query.execute(client);​//Print the account key to the consoleconsole.log(info);​//v1.4.4
​