Skip to main content

Get Transaction

Retrieves detailed information about a blockchain transaction using its transaction hash.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Client ID - The client ID from the Create Client node.
  • Hash - The transaction hash to query (must start with "0x").

Output

  • Transaction - An object containing complete transaction details including from, to, value, gas, nonce, and input data.

How It Works

The Get Transaction node queries the blockchain for transaction information. When executed, the node:

  1. Validates the Client ID and transaction hash format
  2. Queries the blockchain using the transaction hash
  3. Retrieves the full transaction object
  4. Returns all transaction details

Requirements

  • A valid Client ID from the Create Client node
  • A valid transaction hash (66 characters starting with "0x")
  • The transaction must exist on the blockchain

Error Handling

The node will return errors for:

  • Empty or invalid Client ID
  • Client not found
  • Invalid hash format (must start with "0x")
  • Transaction not found
  • Network connection issues

Transaction Object Structure

The output contains:

{
"hash": "0x...", // Transaction hash
"nonce": 123, // Sender's transaction count
"blockHash": "0x...", // Block containing the transaction
"blockNumber": 15000000, // Block number
"transactionIndex": 45, // Position in block
"from": "0x...", // Sender address
"to": "0x...", // Recipient address
"value": "1000000...", // Amount in WEI
"gas": 21000, // Gas limit
"gasPrice": "50000000000", // Gas price in WEI
"input": "0x...", // Transaction data
"v": "0x...", // Signature v
"r": "0x...", // Signature r
"s": "0x..." // Signature s
}

Usage Notes

  • This node retrieves transaction details, not the receipt
  • Use Transaction Receipt node to get execution results
  • Pending transactions may not have blockHash or blockNumber
  • The input field contains encoded function calls for contract interactions
  • Value is in WEI and may need conversion for display

Example

Looking up a transaction:

Inputs:

  • Client ID: 7e8f9a0b-1c2d-3e4f-5a6b-7c8d9e0f1a2b
  • Hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef

Output:

{
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"nonce": 42,
"blockHash": "0xabcd...",
"blockNumber": 15123456,
"from": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"value": "0",
"gas": 65000,
"gasPrice": "50000000000",
"input": "0xa9059cbb..."
}

Common Use Cases

Transaction Verification: Verify transaction parameters before processing.

Audit Trail: Record transaction details for compliance.

Transaction Analysis: Analyze transaction patterns and behavior.

Pending Transaction Monitoring: Check status of submitted transactions.

Replay Prevention: Verify transaction nonces and prevent duplicates.

Gas Analysis: Study gas usage patterns for optimization.

Extracting Specific Fields

Get sender address:

senderAddress = transaction.from

Get transaction value:

valueInWEI = transaction.value
// Convert to ETH
valueInETH = valueInWEI / 10^18

Check if confirmed:

isConfirmed = transaction.blockNumber !== null

Get gas cost:

gasCost = transaction.gas * transaction.gasPrice

Transaction States

Confirmed:

  • Has blockHash and blockNumber
  • Included in a block
  • May still revert (check receipt)

Pending:

  • blockHash is null
  • blockNumber is null
  • Waiting for confirmation

Not Found:

  • Node returns error
  • Transaction doesn't exist
  • May have been replaced

Integration Example

Complete transaction tracking:

  1. Send Transaction - Get transaction hash
  2. Get Transaction - Verify it was broadcast
  3. Wait - Delay for confirmation
  4. Get Transaction - Check if confirmed (has blockNumber)
  5. Transaction Receipt - Get execution result
  6. Process - Handle success or failure

Comparison with Transaction Receipt

Get Transaction:

  • Transaction parameters
  • Who sent it, where it went
  • How much gas was allocated
  • What data was sent

Transaction Receipt:

  • Execution result (success/failure)
  • Actual gas used
  • Logs and events emitted
  • Contract address (if deployment)

Monitoring Example

Check transaction status:

// Get transaction
let tx = getTransaction(hash)

if (tx.blockNumber === null) {
// Still pending
waitAndRetry()
} else {
// Confirmed, get receipt
let receipt = getTransactionReceipt(hash)
if (receipt.status === 1) {
// Success
} else {
// Failed
}
}
tip

Use Get Transaction to verify a transaction exists and check its parameters. Use Transaction Receipt to confirm it executed successfully.

info

Transaction details are permanent and immutable once confirmed. The same hash will always return the same transaction data.

Decoding Transaction Input

For contract interactions, the input field contains encoded function calls:

Steps to decode:

  1. Get the transaction
  2. Extract the input field
  3. Use Decode node with the contract ABI
  4. Parse the function name and arguments

Example input:

0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f0beb0000000000000000000000000000000000000000000000000000000005f5e100

First 4 bytes (0xa9059cbb) = function selector Remaining bytes = encoded arguments

warning

Not all transactions will be found immediately after sending. Allow a few seconds for the transaction to propagate through the network before querying.