get_transaction_logs

Returns logs from a transaction receipt, optionally filtered by emitter or indexed topics. Supply an event signature or JSON ABI to append typed decoded fields.

Table functionLive RPC RPC

Example

Live RPC

-- WETH Transfer events emitted by one transaction
SELECT
  transaction_hash,
  log_index,
  "from" AS sender,
  "to" AS recipient,
  format_units(value, 18) AS weth_amount
FROM get_transaction_logs(
  $client,
  '0x9517e2bc102ae3cde3963c2d2811b64402c3ddaa562206a42a0a1472aadd93a4'::BYTES32,
  'event Transfer(address indexed from, address indexed to, uint256 value)',
  address := '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'::ADDRESS
);

API reference

get_transaction_logs(CLIENT, BYTES32 | VARCHAR, VARCHAR | JSON) # RPC required

Decode one event, from a signature or JSON ABI fragment, and append its parameters as columns; a log of another event or topic shape keeps NULL fields. Topic filters may be a column per row.

Exact signatures (4)
  • get_transaction_logs(CLIENT, BYTES32, VARCHAR)
  • get_transaction_logs(CLIENT, VARCHAR, VARCHAR)
  • get_transaction_logs(CLIENT, BYTES32, JSON)
  • get_transaction_logs(CLIENT, VARCHAR, JSON)

Inputs

NameTypeUse
clientCLIENT

Attached live CLIENT for the chain where the transaction exists.

requiredpositional
tx_hashBYTES32 | VARCHAR

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

requiredpositional
event_signature / event_abiVARCHAR | JSON

Human-readable event signature or JSON event ABI, depending on the selected overload. It filters matching logs and defines the appended decoded columns.

requiredpositional
addressADDRESS or ADDRESS[]

Return only logs emitted by this address, or by any address in the list.

optionalnamed
topic2BYTES32 or list

Exact value or OR-list for the second indexed parameter; a constant or a column read per row.

optionalnamed

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

block_timestampTIMESTAMP

Containing block time in UTC from the receipt's log; NULL when the provider omits it.

transaction_hashBYTES32

Emitting transaction hash.

get_transaction_logs(CLIENT, BYTES32 | VARCHAR) # RPC required

Return receipt log metadata, topics and data without decoded event columns.

Exact signatures (2)
  • get_transaction_logs(CLIENT, BYTES32)
  • get_transaction_logs(CLIENT, VARCHAR)

Inputs

Name Type Use
client CLIENT

Attached live CLIENT for the chain where the transaction exists.

required positional
tx_hash BYTES32 | VARCHAR

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

required positional
address ADDRESS or ADDRESS[]

Return only logs emitted by this address, or by any address in the list.

optional named
topic2 BYTES32 or list

Exact value or OR-list for the second indexed parameter; a constant or a column read per row.

optional named
topic0 BYTES32 or BYTES32[]

Exact value or OR-list; the event selector for non-anonymous events.

optional named
topic3 BYTES32 or list

Exact value or OR-list for the third indexed parameter; a constant or a column read per row.

optional named
topic1 BYTES32 or list

Exact value or OR-list for the first indexed parameter; a constant or a column read per row.

optional named

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

block_timestampTIMESTAMP

Containing block time in UTC from the receipt's log; NULL when the provider omits it.

transaction_hashBYTES32

Emitting transaction hash.

Receipt log columns. Returns raw receipt log metadata, topics, and data without ABI-decoded fields.

Overload examples

Live RPC

-- Every raw log in one transaction receipt
SELECT address, log_index, topics, data
FROM get_transaction_logs(
  $client,
  '0x9517e2bc102ae3cde3963c2d2811b64402c3ddaa562206a42a0a1472aadd93a4'::BYTES32
);

Guidance

Use a matching client

Transaction hashes are chain-scoped. If the client points to another chain, the provider returns no receipt and the function raises; an RPC error raises too, so zero rows means a receipt with no matching logs.

Use the raw overload first when the event definition or emitting contract is not yet known.

Filter and decode receipt logs

The provider returns the full transaction receipt; emitter and topic filters are applied to its logs after that single fetch.

Address filters match the log emitter. Topic filters match encoded indexed values.

Signature and JSON ABI overloads append one typed column per event parameter.

  • For non-anonymous events, topic0 is the event selector.
  • topic1, topic2, and topic3 are the first three indexed parameters.
  • Use BYTES32[] to match any of several values at one topic position.