get_transaction

Returns transaction fields and available receipt metadata for a transaction hash. The client must point to the chain where the transaction exists.

Example

Needs RPC · RPC required

1
SELECT block_number, "from" AS sender, "to" AS recipient, receipt_status, gas_used
2
FROM get_transaction(
3
$client,
4
'0x9517e2bc102ae3cde3963c2d2811b64402c3ddaa562206a42a0a1472aadd93a4'::BYTES32
5
);
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

get_transaction(CLIENT, BYTES32) # RPC required

Accepts a transaction hash as an exact BYTES32 value.

Inputs

Name Type Use
client CLIENT

Attached live CLIENT for the chain where the transaction exists.

required positional
tx_hash BYTES32

Chain-scoped transaction hash as BYTES32 or a 0x-prefixed 64-digit hexadecimal VARCHAR.

required positional

Result columns

NameType
hashBYTES32

Transaction hash.

block_hashBYTES32

Containing block hash; NULL when pending.

block_numberBLOCK_NUMBER

Containing block height; NULL when pending.

transaction_indexINTEGER

Position within the block.

fromADDRESS

Sender address.

Showing fewer

Transaction and receipt metadata. Returns transaction fields plus receipt context when available. Transaction hashes are chain-scoped; using the wrong client returns no matching row.

Guidance

Use a chain-matching client

Transaction hashes are chain-scoped. A client for another chain produces no matching row.

Receipt fields are populated when the provider returns a receipt; they can be absent for a pending transaction.

Build reproducible evidence

Pair get_transaction with get_transaction_logs when both transaction metadata and emitted events are required.

Persist the returned block_number and block_hash when later queries must use the same block.

Additional overloads

get_transaction(CLIENT, VARCHAR) # RPC required

Accepts a 0x-prefixed VARCHAR and requires exactly 64 hexadecimal digits.

Inputs

Name Type Use
client CLIENT

Attached live CLIENT for the chain where the transaction exists.

required positional
tx_hash VARCHAR

Chain-scoped transaction hash as BYTES32 or a 0x-prefixed 64-digit hexadecimal VARCHAR.

required positional

Result columns

NameType
hashBYTES32

Transaction hash.

block_hashBYTES32

Containing block hash; NULL when pending.

block_numberBLOCK_NUMBER

Containing block height; NULL when pending.

transaction_indexINTEGER

Position within the block.

fromADDRESS

Sender address.

Showing fewer

Transaction and receipt metadata. Returns transaction fields plus receipt context when available. Transaction hashes are chain-scoped; using the wrong client returns no matching row.

Related functions

Category and tags

Category
Chain reads
Tag
RPC