# trace_block - Tempo RPC Method

Returns traces for all transactions in a block on Tempo.

This method requires an archive node. It is not available on full nodes.

## When to Use This Method

- **Trace all transactions in a block by block number** - Get the full trace of every transaction in a block on Tempo
- **Block-level execution analysis** - Inspect all internal calls, transfers, and contract interactions within a block for merchant settlement, treasury operations, payout automation, and stablecoin-native financial applications
- **MEV research** - Analyze transaction ordering, sandwich patterns, and arbitrage across a full block
- **Historical block replay** - Replay and trace blocks at any point in Tempo chain history

## Best Practices

- Similar to trace\_replayBlockTransactions but without explicit replay configuration
- Use block hash variant (`debug_traceBlockByHash`) for reorg-safe queries
- Traces from dense blocks can be very large; process results in batches
- Requires archive node access; not available on standard full nodes

## Request Parameters

- `blockNumber` (`QUANTITY|TAG, required`): Block number in hex or tag (latest, earliest, pending)

## Request Example

```json
{
  "jsonrpc": "2.0",
  "method": "trace_block",
  "params": ["latest"],
  "id": 1
}
```

## Response Fields

This method returns no documented fields.

## Successful Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {}
}
```

## Code Examples

cURL
JavaScript
Python

```bash
curl -X POST https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "trace_block",
    "params": ["latest"],
    "id": 1
  }'
```

```javascript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('https://api-tempo-mainnet.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})`);
}
```

```python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-tempo-mainnet.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`](https://www.dwellir.com/docs/tempo/trace_filter) - Filter traces by address or block range
- [`trace_transaction`](https://www.dwellir.com/docs/tempo/trace_transaction) - Trace a specific transaction
- [`trace_get`](https://www.dwellir.com/docs/tempo/trace_get) - Get a specific trace by index
