Transaction ID

A transaction ID is composed of the payer account ID and the timestamp in seconds.nanoseconds format (0.0.9401@1602138343.335616988). 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 (0.0.9401@1602138343.335616988?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 (0.0.2252@1640075693.891386528/1). The parent transaction ID for the child transaction would be 0.0.2252@1640075693.891386528.

Generate a transaction ID

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
TransactionId txId = TransactionId.generate(new AccountId(5));
System.out.println(txId);
JavaScript
const txId = TransactionId.generate(new AccountId(5));
console.log(txId);

Sample Output:

0.0.5@1604557331.565419523

Last updated