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.

Example

Needs RPC · RPC required

1
SELECT
2
transaction_hash,
3
log_index,
4
"from" AS sender,
5
"to" AS recipient,
6
format_units(value, 18) AS weth_amount
7
FROM get_transaction_logs(
8
$client,
9
'0x9517e2bc102ae3cde3963c2d2811b64402c3ddaa562206a42a0a1472aadd93a4'::BYTES32,
10
'event Transfer(address indexed from, address indexed to, uint256 value)',
11
address := '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'::ADDRESS
12
);
Notebook ready in readonly mode.

API reference

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

get_transaction_logs(CLIENT, BYTES32, VARCHAR) # RPC required

Accepts a human-readable event signature and appends its decoded event parameters.

Inputs

NameTypeUse
clientCLIENT

Attached live CLIENT for the chain where the transaction exists.

requiredpositional
tx_hashBYTES32

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

requiredpositional
event_signatureVARCHAR

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

Return only logs emitted by this contract address.

optionalnamed
addressesADDRESS[]

Return logs emitted by any address in this list.

optionalnamed
Showing fewer

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

transaction_hashBYTES32

Emitting transaction hash.

transaction_indexINTEGER

Transaction position in the block.

Showing fewer

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 returns zero rows.

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.

Additional overloads

get_transaction_logs(CLIENT, VARCHAR, VARCHAR) # RPC required

Accepts a human-readable event signature and appends its decoded event parameters.

Inputs

NameTypeUse
clientCLIENT

Attached live CLIENT for the chain where the transaction exists.

requiredpositional
tx_hashVARCHAR

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

requiredpositional
event_signatureVARCHAR

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

Return only logs emitted by this contract address.

optionalnamed
addressesADDRESS[]

Return logs emitted by any address in this list.

optionalnamed
Showing fewer

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

transaction_hashBYTES32

Emitting transaction hash.

transaction_indexINTEGER

Transaction position in the block.

Showing fewer
get_transaction_logs(CLIENT, BYTES32) # RPC required

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

Inputs

NameTypeUse
clientCLIENT

Attached live CLIENT for the chain where the transaction exists.

requiredpositional
tx_hashBYTES32

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

requiredpositional
addressADDRESS

Return only logs emitted by this contract address.

optionalnamed
addressesADDRESS[]

Return logs emitted by any address in this list.

optionalnamed
topic2BYTES32 or BYTES32[]

Exact value or OR-list for the second indexed parameter.

optionalnamed
Showing fewer

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

transaction_hashBYTES32

Emitting transaction hash.

transaction_indexINTEGER

Transaction position in the block.

Showing fewer

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

Overload examples

Named parameters · RPC required

1
SELECT address, log_index, topics, data
2
FROM get_transaction_logs(
3
$client,
4
'0x9517e2bc102ae3cde3963c2d2811b64402c3ddaa562206a42a0a1472aadd93a4'::BYTES32
5
);
get_transaction_logs(CLIENT, VARCHAR) # RPC required

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

Inputs

NameTypeUse
clientCLIENT

Attached live CLIENT for the chain where the transaction exists.

requiredpositional
tx_hashVARCHAR

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

requiredpositional
addressADDRESS

Return only logs emitted by this contract address.

optionalnamed
addressesADDRESS[]

Return logs emitted by any address in this list.

optionalnamed
topic2BYTES32 or BYTES32[]

Exact value or OR-list for the second indexed parameter.

optionalnamed
Showing fewer

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

transaction_hashBYTES32

Emitting transaction hash.

transaction_indexINTEGER

Transaction position in the block.

Showing fewer

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

get_transaction_logs(CLIENT, BYTES32, JSON) # RPC required

Accepts a JSON event ABI fragment and appends its decoded event parameters.

Inputs

NameTypeUse
clientCLIENT

Attached live CLIENT for the chain where the transaction exists.

requiredpositional
tx_hashBYTES32

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

requiredpositional
event_abiJSON

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

Return only logs emitted by this contract address.

optionalnamed
addressesADDRESS[]

Return logs emitted by any address in this list.

optionalnamed
Showing fewer

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

transaction_hashBYTES32

Emitting transaction hash.

transaction_indexINTEGER

Transaction position in the block.

Showing fewer
get_transaction_logs(CLIENT, VARCHAR, JSON) # RPC required

Accepts a JSON event ABI fragment and appends its decoded event parameters.

Inputs

NameTypeUse
clientCLIENT

Attached live CLIENT for the chain where the transaction exists.

requiredpositional
tx_hashVARCHAR

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

requiredpositional
event_abiJSON

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

Return only logs emitted by this contract address.

optionalnamed
addressesADDRESS[]

Return logs emitted by any address in this list.

optionalnamed
Showing fewer

Result columns

NameType
addressADDRESS

Log emitter.

block_hashBYTES32

Containing block hash.

block_numberBLOCK_NUMBER

Containing block height.

transaction_hashBYTES32

Emitting transaction hash.

transaction_indexINTEGER

Transaction position in the block.

Showing fewer

Related functions

Category and tags

Category
Chain reads
Tag
RPC