Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RPC Client Querying

The Query type defines what data to fetch from the RPC endpoint.

Query Structure

Rust

#![allow(unused)]
fn main() {
use tiders_rpc_client::{Query, LogRequest, TransactionRequest, TraceRequest};
use tiders_rpc_client::{Fields, BlockFields, TransactionFields, LogFields, TraceFields};

let query = Query {
    from_block: 18_000_000,
    to_block: Some(18_001_000),
    include_all_blocks: false,
    logs: vec![LogRequest { .. }],
    transactions: vec![TransactionRequest { .. }],
    traces: vec![TraceRequest { .. }],
    fields: Fields {
        block: BlockFields { number: true, timestamp: true, ..Default::default() },
        transaction: TransactionFields { hash: true, ..Default::default() },
        log: LogFields { address: true, data: true, ..Default::default() },
        trace: TraceFields::default(),
    },
};
}

Python

from tiders_core import ingest

query = ingest.Query(
    kind=ingest.QueryKind.EVM,
    params=ingest.evm.Query(
        from_block=18_000_000,
        to_block=18_001_000,
        include_all_blocks=False,
        logs=[ingest.evm.LogRequest(...)],
        transactions=[ingest.evm.TransactionRequest(...)],
        traces=[ingest.evm.TraceRequest(...)],
        fields=ingest.evm.Fields(
            block=ingest.evm.BlockFields(number=True, timestamp=True),
            transaction=ingest.evm.TransactionFields(hash=True),
            log=ingest.evm.LogFields(address=True, data=True),
            trace=ingest.evm.TraceFields(),
        ),
    ),
)
OptionTypeDefaultDescription
from_blocku64 / int0First block to fetch (inclusive)
to_blockOption<u64> / Optional[int]NoneLast block to fetch (inclusive). None means stream up to the current head
include_all_blocksboolfalseFetch block headers even if no log/transaction/trace request is present
logsVec<LogRequest> / list[LogRequest][]Log filter requests
transactionsVec<TransactionRequest> / list[TransactionRequest][]Transaction requests
tracesVec<TraceRequest> / list[TraceRequest][]Trace requests
fieldsFieldsall falseControls which columns appear in the output Arrow batches

Log Requests

Filter logs by address and/or topics. Multiple addresses and topics are OR’d together by the provider.

Rust

#![allow(unused)]
fn main() {
LogRequest {
    address: vec![Address::from_str("0xdAC17F958D2ee523a2206206994597C13D831ec7")?],
    topic0: vec![topic0_hash],
    include_blocks: true,
    ..Default::default()
}
}

Python

ingest.evm.LogRequest(
    address=["0xdAC17F958D2ee523a2206206994597C13D831ec7"],
    topic0=[topic0_hash],
    include_blocks=True,
)
OptionTypeDefaultDescription
addressVec<Address> / list[str][]Contract addresses to filter
topic0Vec<Topic> / list[str][]Event signature hashes
topic1Vec<Topic> / list[str][]First indexed parameter
topic2Vec<Topic> / list[str][]Second indexed parameter
topic3Vec<Topic> / list[str][]Third indexed parameter
include_transactionsboolfalseAlso fetch transactions for the same block range
include_transaction_tracesboolfalseAlso fetch traces for the same block range
include_blocksboolfalseAlso fetch block headers for the same block range

Log filters (addresses and topics) cannot be combined with include_* flags on the same LogRequest. When include_* flags activate additional pipelines, those pipelines return unfiltered data for the full block range. To use multi-pipeline coordination remove the log filters and filter post-indexing.

Transaction Requests

Activates the block pipeline to fetch blocks and transactions via eth_getBlockByNumber.

Rust

#![allow(unused)]
fn main() {
TransactionRequest {
    include_logs: true,
    include_blocks: true,
    ..Default::default()
}
}

Python

ingest.evm.TransactionRequest(
    include_logs=True,
    include_blocks=True,
)
OptionTypeDefaultDescription
include_logsboolfalseAlso fetch logs for the same block range
include_tracesboolfalseAlso fetch traces for the same block range
include_blocksboolfalseAlso fetch block headers (always fetched by this pipeline, included for API compatibility)

TransactionRequest also exposes filter fields (from_, to, sighash, status, type_, contract_deployment_address, hash), but these are not supported by the RPC client. eth_getBlockByNumber returns all transactions in a block with no server-side filtering. Setting any of these fields will produce an error. This functionality is only supported on other tiders clients (SQD, HyperSync). Ingest all transactions and filter post-indexing in your tiders (Python) pipeline or database instead.

Trace Requests

Activates the trace pipeline to fetch internal call traces.

Rust

#![allow(unused)]
fn main() {
use tiders_rpc_client::TraceMethod;

TraceRequest {
    trace_method: TraceMethod::TraceBlock,  // or DebugTraceBlockByNumber
    include_blocks: true,
    ..Default::default()
}
}

Python

ingest.evm.TraceRequest(
    include_blocks=True,
)
OptionTypeDefaultDescription
trace_methodTraceMethodTraceBlockTraceBlock (Parity-style) or DebugTraceBlockByNumber (Geth-style)
include_transactionsboolfalseAlso fetch transactions for the same block range
include_transaction_logsboolfalseAlso fetch logs for the same block range
include_blocksboolfalseAlso fetch block headers for the same block range

TraceRequest also exposes filter fields (from_, to, address, call_type, reward_type, type_, sighash, author), but these are not supported by the RPC client. trace_block and debug_traceBlockByNumber return all traces in a block with no server-side filtering. Setting any of these fields will produce an error. This functionality is only supported on other tiders clients (SQD, HyperSync). Ingest all traces and filter post-indexing in your tiders (Python) pipeline or database instead.

Field Selection

Select only the fields you need to minimize data transfer. When all flags are false (the default), the full schema is returned.

Rust

#![allow(unused)]
fn main() {
Fields {
    block: BlockFields { number: true, hash: true, timestamp: true, ..Default::default() },
    transaction: TransactionFields { hash: true, from: true, to: true, value: true, ..Default::default() },
    log: LogFields { address: true, data: true, topic0: true, ..Default::default() },
    trace: TraceFields::default(),
}
}

Python

ingest.evm.Fields(
    block=ingest.evm.BlockFields(number=True, hash=True, timestamp=True),
    transaction=ingest.evm.TransactionFields(hash=True, from_=True, to=True, value=True),
    log=ingest.evm.LogFields(address=True, data=True, topic0=True),
    trace=ingest.evm.TraceFields(),
)

Block Fields

FieldDescription
numberBlock number
hashBlock hash
parent_hashParent block hash
nonceBlock nonce
sha3_unclesSHA3 of uncle blocks
logs_bloomBloom filter for logs
transactions_rootMerkle root of transactions
state_rootMerkle root of state
receipts_rootMerkle root of receipts
minerBlock miner address
difficultyBlock difficulty
total_difficultyTotal chain difficulty
extra_dataExtra data field
sizeBlock size in bytes
gas_limitBlock gas limit
gas_usedTotal gas used in block
timestampBlock timestamp
unclesUncle block hashes
base_fee_per_gasEIP-1559 base fee
blob_gas_usedEIP-4844 blob gas used
excess_blob_gasEIP-4844 excess blob gas
parent_beacon_block_rootParent beacon block root
withdrawals_rootMerkle root of withdrawals
withdrawalsValidator withdrawals
l1_block_numberL1 block number (L2 chains)
send_countSend count (Arbitrum)
send_rootSend root (Arbitrum)
mix_hashMix hash

Transaction Fields

FieldDescription
block_hashBlock hash
block_numberBlock number
from / from_Sender address
gasGas provided
gas_priceGas price
hashTransaction hash
inputInput data (calldata)
nonceSender nonce
toRecipient address
transaction_indexIndex in block
valueValue transferred (wei)
vSignature v
rSignature r
sSignature s
max_priority_fee_per_gasEIP-1559 max priority fee
max_fee_per_gasEIP-1559 max fee
chain_idChain ID
cumulative_gas_usedCumulative gas used (receipt)
effective_gas_priceEffective gas price (receipt)
gas_usedGas used by transaction (receipt)
contract_addressCreated contract address (receipt)
logs_bloomBloom filter for logs (receipt)
type_Transaction type
rootState root (pre-Byzantium receipt)
statusSuccess/failure (receipt)
sighashFunction selector (first 4 bytes of input)
y_parityEIP-2930 y parity
access_listEIP-2930 access list
l1_feeL1 fee (Optimism)
l1_gas_priceL1 gas price (Optimism)
l1_fee_scalarL1 fee scalar (Optimism)
gas_used_for_l1Gas used for L1 (Arbitrum)
max_fee_per_blob_gasEIP-4844 max blob fee
blob_versioned_hashesEIP-4844 blob hashes
deposit_nonceDeposit nonce (Optimism)
blob_gas_priceEIP-4844 blob gas price
deposit_receipt_versionDeposit receipt version (Optimism)
blob_gas_usedEIP-4844 blob gas used
l1_base_fee_scalarL1 base fee scalar (Optimism Ecotone)
l1_blob_base_feeL1 blob base fee (Optimism Ecotone)
l1_blob_base_fee_scalarL1 blob base fee scalar (Optimism Ecotone)
l1_block_numberL1 block number (Optimism)
mintMinted value (Optimism)
source_hashSource hash (Optimism)

Fields marked with (receipt) require eth_getBlockReceipts — the block pipeline fetches receipts automatically when any of these fields are selected.

Log Fields

FieldDescription
removedWhether log was removed due to reorg
log_indexLog index in block
transaction_indexTransaction index in block
transaction_hashTransaction hash
block_hashBlock hash
block_numberBlock number
addressContract address that emitted the event
dataNon-indexed event data
topic0Event signature hash
topic1First indexed parameter
topic2Second indexed parameter
topic3Third indexed parameter

Trace Fields

FieldDescription
from / from_Sender address
toRecipient address
call_typeCall type (call, delegatecall, staticcall)
gasGas provided
inputInput data
initContract creation code
valueValue transferred
authorBlock reward recipient
reward_typeReward type (block, uncle)
block_hashBlock hash
block_numberBlock number
addressCreated contract address
codeCreated contract code
gas_usedGas used
outputOutput data
subtracesNumber of subtraces
trace_addressTrace position in call tree
transaction_hashTransaction hash
transaction_positionTransaction index in block
type_Trace type (call, create, suicide, reward)
errorError message if reverted
sighashFunction selector
action_addressSelf-destruct address
balanceSelf-destruct balance
refund_addressSelf-destruct refund address

Response Format

The stream yields ArrowResponse items containing Arrow RecordBatches:

Rust

#![allow(unused)]
fn main() {
let mut stream = client.stream(query);

while let Some(response) = stream.next().await {
    let response = response?;
    // response.blocks — Arrow RecordBatch
    // response.transactions — Arrow RecordBatch
    // response.logs — Arrow RecordBatch
    // response.traces — Arrow RecordBatch
}
}

Rust API Reference

See the Query rustdoc for all fields.