Hedera
Search…
Get topic info
Topic info returns 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.
Ledger ID
The ID of the network the response came from. See HIP-198.
Query Signing Requirements
  • The client operator private key is required to sign the query request
V2
V1
Constructor
Description
new TopicInfoQuery()
Initializes the TopicInfoQuery object
​
1
new TopicInfoQuery()
Copied!
​
Method
Type
Requirement
setTopicId(<topicId>)
TopicId
Required
<TopicInfo>.adminKey
​Key​
Optional
<TopicInfo>.submitKey
​Key​
Optional
<TopicInfo>.topicId
​TopicId​
Optional
<TopicInfo>.sequenceNumber
long
Optional
<TopicInfo>.runningHash
ByteString
Optional
<TopicInfo>.memo
String
Optional
<TopicInfo>.ledgerId
LedgerId
Optional
<TopicInfo>.expirationTime
Instant
Optional
<TopicInfo>.autoRenewAccount
​AccountId​
Optional
<TopicInfo>.autoRenewPeriod
Instant
Optional
Java
1
//Create the account info query
2
TopicInfoQuery query = new TopicInfoQuery()
3
.setTopicId(newTopicId);
4
​
5
//Submit the query to a Hedera network
6
TopicInfo info = query.execute(client);
7
​
8
//Print the account key to the console
9
System.out.println(info);
10
​
11
//v2.0.0
Copied!
JavaScript
1
//Create the account info query
2
const query = new TopicInfoQuery()
3
.setTopicId(newTopicId);
4
​
5
//Submit the query to a Hedera network
6
const info = await query.execute(client);
7
​
8
//Print the account key to the console
9
console.log(info);
10
​
11
//v2.0.0
Copied!
Go
1
//Create the account info query
2
query, err := hedera.NewTopicInfoQuery().
3
SetTopicID(topicID)
4
​
5
//Submit the query to a Hedera network
6
info, err := query.Execute(client)
7
if err != nil {
8
panic(err)
9
}
10
​
11
//Print the account key to the console
12
println(info)
13
​
14
//v2.0.0
Copied!
Sample Output:
1
TopicInfo{
2
topicId=0.0.102736,
3
topicMemo=,
4
runningHash=[
5
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
6
],
7
sequenceNumber=0,
8
expirationTime=2021-02-09T03:17:07.258292001Z,
9
adminKey=null,
10
submitKey=null,
11
autoRenewPeriod=PT2160H,
12
autoRenewAccountId=null
13
}
Copied!
Constructor
Description
new ConsensusTopicInfoQuery()
Initializes the ConsensusTopicInfoQuery object
1
new ConsensusTopicInfoQuery()
Copied!
​
Method
Type
Description
Requirement
setTopicId(<topicId>)
TopicId
The ID of the topic to get information for
Required
Java
1
//Create the account info query
2
TopicInfoQuery query = new ConsensusTopicInfoQuery()
3
.setTopicId(newTopicId);
4
​
5
//Submit the query to a Hedera network
6
TopicInfo info = query.execute(client);
7
​
8
//Print the account key to the console
9
System.out.println(info);
10
​
11
//v1.3.2
Copied!
JavaScript
1
//Create the account info query
2
const query = new ConsensusTopicInfoQuery()
3
.setTopicId(newTopicId);
4
​
5
//Submit the query to a Hedera network
6
const info = await query.execute(client);
7
​
8
//Print the account key to the console
9
console.log(info);
10
​
11
//v1.4.4
Copied!
​
Last modified 4d ago
Copy link