Hedera
Search…
Transaction ID
A transaction ID is composed of the payer account ID and the timestamp in seconds.nanoseconds format ([email protected]). You are not required to generate a transaction ID for every transaction type as the SDKs generate them when submitting transactions.

Schedule Transaction ID

Scheduled transactions have a schedule flag in the transaction ID ([email protected]?schedule).
Child Transaction ID
Child transactions are transactions that were triggered by a parent transaction. Child transactions have a nonce populated in the transaction ID after the timestamp. The nonce value for the parent transaction ID is 0. The transaction ID (payer and timestamp) is the same as the parent transaction for each child transaction. Each child transaction adds a nonce value to the parent transaction ID. For example, a parent transaction with one child transaction would result in the child transaction having a nonce value of 1 ([email protected]/1). The parent transaction ID for the child transaction would be [email protected].

Generate a transaction ID

​
V2
V1
Constructor
Description
new TransactionId()
Initializes the TransactionId object
​
Method
Type
Description
setNonce(<nonce>)
Integer
Set the nonce for the child transaction ID
setScheduled(<schedule>)
boolean
Set the boolean value for a scheduled transaction ID
TransactionId.generate(<accountId>)
AccountId
Generates a new transaction ID. Pass the payer account ID to generate the transaction ID.
TransactionId.fromBytes(<bytes>)
byte [ ]
Converts to a transaction ID from bytes
TransactionId.fromString(<string>)
String
Converts a string to transaction ID
TransactionId.withValidStart(<accountId>, <validStart>)
AccountId, Instant
Create a transaction ID by passing the payer account and valid start time
Java
1
TransactionId txId = TransactionId.generate(new AccountId(5));
2
System.out.println(txId);
3
​
4
//v2.0.0
Copied!
JavaScript
1
const txId = TransactionId.generate(new AccountId(5));
2
console.log(txId);
3
//v2.0.0
Copied!
Go
1
txId := hedera.TransactionIDGenerate(client.GetOperatorAccountID())
2
fmt.println(txId)
3
​
4
//v2.0.0
Copied!

Sample Output:

​
Method
Type
Description
TransactionId.generate(<accountId>)
AccountId
Generates a new transaction ID. Pass the payer account ID to generate the transaction ID.
TransactionId.fromBytes(<bytes>)
byte [ ]
Converts to a transaction ID from bytes
TransactionId.fromString(<string>)
String
Converts a string to transaction ID
Java
1
TransactionId txId = TransactionId.generate(new AccountId(5));
2
System.out.println(txId);
Copied!
JavaScript
1
const txId = TransactionId.generate(new AccountId(5));
2
console.log(txId);
Copied!

Sample Output:

​

Copy link