trace_block
Returns traces for all transactions in a block on Base.
Archive Node Required
This method requires an archive node. It is not available on full nodes.
Use Cases#
- Block analysis - Inspect all internal transactions in a block
- MEV research - Analyze transaction ordering and internal calls
- Indexing - Build comprehensive transaction indexes for consumer dApps, SocialFi, NFT marketplaces, and merchant payment integrations
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
blockNumber | QUANTITY|TAG | Yes | Block number in hex or tag (latest, earliest, pending) |
Request#
{
"jsonrpc": "2.0",
"method": "trace_block",
"params": ["latest"],
"id": 1
}
Code Examples#
- cURL
- JavaScript
- Python
curl -X POST https://api-base-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "trace_block",
"params": ["latest"],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-base-mainnet-archive.n.dwellir.com/YOUR_API_KEY');
const traces = await provider.send('trace_block', ['latest']);
console.log('Traces in block:', traces.length);
for (const trace of traces.slice(0, 5)) {
console.log(` ${trace.action.from} -> ${trace.action.to} (${trace.type})`);
}
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-base-mainnet-archive.n.dwellir.com/YOUR_API_KEY'))
traces = w3.provider.make_request('trace_block', ['latest'])
for trace in traces['result'][:5]:
action = trace['action']
print(f'{action["from"]} -> {action.get("to", "CREATE")} ({trace["type"]})')
Related Methods#
trace_filter- Filter traces by address or block rangetrace_transaction- Trace a specific transactiontrace_get- Get a specific trace by index