Hedera
Search…
Get a transaction record
You can request a transaction record for up to 3 minutes after a transaction has reached consensus. This query returns a maximum of 180 records per request. The transaction record provides the following information about a transaction:

Transaction Record Contents

Fields
Description
Transaction ID
The ID of the transaction.
Consensus timestamp
The time the transaction reached consensus and was added to the ledger.
Contract Call Result
Record of the value returned by the smart contract function (if it completed and didn't fail) from ContractCallTransaction.
Contract Create Result
Record of the value returned by the smart contract constructor (if it completed and didn't fail) from ContractCreateTransaction.
Receipt
The receipt of the transaction.
Transaction Fee
The transaction fee that was charged.
Transaction Hash
The transaction hash.
Transaction Memo
The transaction memo if there was one added.
Transfers
A list of transfers made in the transaction. The list of transfers includes a payment made to the node, the service fee, and transaction fee.
Token Transfers
A list of the token transfers .
ScheduleRef
The schedule ID of the schedule transaction the record represents.
Assessed Custom Fees
This field applies to tokens that have custom fees and returns the custom fee(s) assessed in a token transfer transaction. This includes the amount, token ID, fee collector account ID (if applicable), and effective payer account ID. The effective payer accounts are accounts that were charged the custom fees.
Automatic Associations
The token(s) that were auto associated to the account in this transaction, if any
Alias
In the record of an internal AccountCreateTransaction triggered by a user transaction with a (previously unused) alias, the new account's alias.
Parent Consensus Timestamp
The parent consensus timestamp is found in the record of a child transaction. The parent consensus timestamp is the consensus timestamp related to the parent transaction to this child transaction.
Ethereum Hash
The keccak256 hash of the ethereumData. This field will only be populated for EthereumTransaction.
Transaction Signing Requirements
  • The client operator account private key is required to sign
Constructor
Description
new TransactionRecordQuery()
Initializes the TransactionRecordQuery Object
  • Transaction ID: The ID of the transaction to return the record for
  • Include Children: Whether or not to include the record for children transactions triggered by a parent transaction
  • Include Duplicates: Whether or not to include the receipts for duplicate transactions
Method
Type
Requirement
setTransactionId(<transactionId>)
TransactionID
Required
setIncludeChildren(<value>)
boolean
Optional
setIncludeDuplicates(<value>)
boolean
Optional
Java
JavaScript
Go
1
new TransactionRecordQuery()
2
.setTransactionId(transactionId)
3
.execute(client)
Copied!
1
new TransactionRecordQuery()
2
.setTransactionId(transactionId)
3
.execute(client)
Copied!
1
hedera.NewTransactionRecordQuery().
2
SetTransactionId(transactionId).
3
Execute(client)
Copied!
​

Methods

V2
V1
Method
Type
Requirement
<TransactionResponse>.getRecord(<client>)
TransactionRecord
Required
<TransactionRecord>.transactionId
TransactionId
Optional
<TransactionRecord>.consensusTimestamp
Instant
Optional
<TransactionRecord>.contractFunctionResult
ContractFunctionResult
Optional
<TransactionRecord>.receipt
TransactionReceipt
Optional
<TransactionRecord>.transactionFee
Hbar
Optional
<TransactionRecord>.transactionHash
ByteString
Optional
<TransactionRecord>.transactionMemo
String
Optional
<TransactionRecord>.transfers
List<Transfer>
Optional
<TransactionRecord>.tokentransfers
Map<TokenId, Map<AccountId, List<Long>>>
Optional
<TransactionRecord>.scheduleRef
ScheduleId
Optional
<TransactionRecord>.assessedCustomFees
List<AssessedCustomFees>
Optional
<TransactionRecord>.automaticTokenAssociations
List<TokenAssociation>
Optional
<TransactionRecord>.ethereumHash
ByteString
Optional
<TransactionRecord>.parentConsensusTimestamp
Instant
Optional
Java
1
//Create a transaction
2
AccountCreateTransaction transaction = new AccountCreateTransaction()
3
.setKey(newKey.getPublicKey())
4
.setInitialBalance(new Hbar(1));
5
​
6
//Sign with the client operator account key and submit to a Hedera network
7
TransactionResponse txResponse = transaction.execute(client);
8
​
9
//Request the record of the transaction
10
TransactionRecord record = txResponse.getRecord(client);
11
​
12
System.out.println("The transaction record is " +record);
13
​
14
//v2.0.0
Copied!
JavaScript
1
//Create a transaction
2
const transaction = new AccountCreateTransaction()
3
.setKey(newKey.getPublicKey())
4
.setInitialBalance(new Hbar(1));
5
​
6
//Sign with the client operator account key and submit to a Hedera network
7
const txResponse = await transaction.execute(client);
8
​
9
//Request the record of the transaction
10
const record = await txResponse.getRecord(client);
11
​
12
console.log("The transaction record is " +record);
13
​
14
//v2.0.0
Copied!
Go
1
//Create a transaction
2
transaction := hedera.NewAccountCreateTransaction().
3
SetKey(privateKey.PublicKey()).
4
SetInitialBalance(hedera.NewHbar(1000))
5
​
6
//Sign with the client operator account key and submit to a Hedera network
7
txResponse, err := transaction.Execute(client)
8
​
9
//Request the record of the transaction
10
record, err := txResponse.GetRecord(client)
11
​
12
fmt.Printf("The transaction record is %v\n", record)
13
​
14
//v2.0.0
Copied!

Sample Output:

1
TransactionRecord{
2
receipt=TransactionReceipt{
3
status=SUCCESS,
4
exchangeRate=ExchangeRate{
5
hbars=30000, cents=116646,
6
expirationTime=2020-09-04T03:00:007
7
},
8
accountId=0.0.97001,
9
fileId=null,
10
contractId=null,
11
topicId=null,
12
topicSequenceNumber=null
13
},
14
transactionHash=e005670a1f49c4fd776b2d432db3e5cb31441 bb5a35bff412ec3b41cb1 3366ce00b5c1b9900aad1467f9709a649ccc20,
15
consensusTimestamp=2020-11-05T08:34:31.107311002Z,
16
[email protected] 8.479476328,
17
transactionMemo=,
18
transactionFee=0.25401241 ℏ,
19
contractFunctionResult=null,
20
transfers=[
21
Transfer{accountId=0.0.5, amount=0.01501152 ℏ}, (node fee)
22
Transfer{accountId=0.0.98, amount=0.23900089 ℏ}, (service fee)
23
Transfer{accountId=0.0.9401, amount=-1.25401241 ℏ}, (transaction fee) initial balance of new account
24
Transfer{accountId=0.0.97001, amount=1 ℏ} (Initial balance of the new account)
25
]
26
tokenTransfers={},
27
scheduleRef=null,
28
assessedCustomFees=[],
29
automaticTokenAssociations=[TokenAssociation{
30
tokenId=0.0.27335, accountId=0.0.27333}]
31
}
Copied!
Method
Type
Requirement
<TransactionId>.getRecord(<client>)
TransactionRecord
Required
<TransactionRecord>.transactionId
TransactionId
Optional
<TransactionRecord>.consensusTimestamp
Instant
Optional
<TransactionRecord>.contractFunctionResult
ContractFunctionResult
Optional
<TransactionRecord>.receipt
TransactionReceipt
Optional
<TransactionRecord>.transactionFee
long
Optional
<TransactionRecord>.transactionHash
byte [ ]
Optional
<TransactionRecord>.transactionMemo
String
Optional
<TransactionRecord>.transfers
List<Transfer>
Optional
<TransactionRecord>.tokentransfers
Map<TokenId, Map<AccountId, List<Long>>>
Optional
<TransactionRecord>.scheduleRef
ScheduleId
Optional
<TransactionRecord>.assessedCustomFees
List<AssessedCustomFees>
Optional
Java
1
//Create a transaction
2
AccountCreateTransaction transaction = new AccountCreateTransaction()
3
.setKey(newKey.getPublicKey())
4
.setInitialBalance(new Hbar(1));
5
​
6
//Sign with the client operator account key and submit to a Hedera network
7
TransactionId txId = transaction.execute(client);
8
​
9
//Request the record of the transaction
10
TransactionRecord record = txId.getRecord(client);
11
​
12
System.out.println("The transaction record is " +record);
13
​
14
//v1.3.2
Copied!
JavaScript
1
//Create a transaction
2
const transaction = new AccountCreateTransaction()
3
.setKey(newKey.getPublicKey())
4
.setInitialBalance(new Hbar(1));
5
​
6
//Sign with the client operator account key and submit to a Hedera network
7
const txId = await transaction.execute(client);
8
​
9
//Request the record of the transaction
10
const record = await txId.getRecord(client);
11
​
12
console.log("The transaction record is " +record);
13
​
14
//v1.4.4
Copied!

​

Copy link
Contents
Methods