# arbtrace_filter

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://arb-mainnet.g.alchemy.com/v2/{apiKey}

Returns all traces matching a specified filter object. Allows filtering by block range, sender addresses, and recipient addresses. This is an Arbitrum-specific tracing method that works for pre-Nitro blocks (before block 22,207,815). For post-Nitro blocks, use Geth debug_* methods.


Reference: https://www.alchemy.com/docs/chains/arbitrum/arbitrum-api-endpoints/arbtrace-filter

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Filter | object | Yes | The filter object specifying the criteria for trace retrieval.  |

## Result

**Filtered traces** (object[]): An array of trace objects matching the filter criteria.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "arbtrace_filter",
  "params": [
    {
      "fromBlock": "0x152DD07",
      "toBlock": "0x152DD07",
      "fromAddress": [
        "0x00000000000000000000000000000000000a4b05"
      ],
      "toAddress": [],
      "after": 0,
      "count": 10
    }
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "action": {
        "callType": "call",
        "from": "0x00000000000000000000000000000000000a4b05",
        "gas": "0x0",
        "input": "0x",
        "to": "0xa4b05fffffffffffffffffffffffffffffffffff",
        "value": "0x0"
      },
      "blockHash": "0x5765e1e12766c561a99f2eca6be6dba225e5e2dbecc1c52c59dfd21f3c39071c",
      "blockNumber": 22207751,
      "result": {
        "gasUsed": "0x0",
        "output": "0x"
      },
      "subtraces": 0,
      "traceAddress": [],
      "transactionHash": "0xd2ea43b18e2f0acb66b36e773f20a4e9a1ee2df00a9794f63c2f4d0519cbe12a",
      "transactionPosition": 0,
      "type": "call"
    }
  ],
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://arb-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "arbtrace_filter",
  "params": [
    {
      "fromBlock": "0x152DD07",
      "toBlock": "0x152DD07",
      "fromAddress": [
        "0x00000000000000000000000000000000000a4b05"
      ],
      "toAddress": [],
      "after": 0,
      "count": 10
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'arbtrace_filter',
    params: [
      {
        fromBlock: '0x152DD07',
        toBlock: '0x152DD07',
        fromAddress: ['0x00000000000000000000000000000000000a4b05'],
        toAddress: [],
        after: 0,
        count: 10
      }
    ]
  })
};

fetch('https://arb-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://arb-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "arbtrace_filter",
    "params": [
        {
            "fromBlock": "0x152DD07",
            "toBlock": "0x152DD07",
            "fromAddress": ["0x00000000000000000000000000000000000a4b05"],
            "toAddress": [],
            "after": 0,
            "count": 10
        }
    ]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://arb-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"arbtrace_filter\",\n  \"params\": [\n    {\n      \"fromBlock\": \"0x152DD07\",\n      \"toBlock\": \"0x152DD07\",\n      \"fromAddress\": [\n        \"0x00000000000000000000000000000000000a4b05\"\n      ],\n      \"toAddress\": [],\n      \"after\": 0,\n      \"count\": 10\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://arb-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"arbtrace_filter\",\n  \"params\": [\n    {\n      \"fromBlock\": \"0x152DD07\",\n      \"toBlock\": \"0x152DD07\",\n      \"fromAddress\": [\n        \"0x00000000000000000000000000000000000a4b05\"\n      ],\n      \"toAddress\": [],\n      \"after\": 0,\n      \"count\": 10\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://arb-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"arbtrace_filter\",\n  \"params\": [\n    {\n      \"fromBlock\": \"0x152DD07\",\n      \"toBlock\": \"0x152DD07\",\n      \"fromAddress\": [\n        \"0x00000000000000000000000000000000000a4b05\"\n      ],\n      \"toAddress\": [],\n      \"after\": 0,\n      \"count\": 10\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: arbtrace_filter
summary: Returns traces matching a given filter.
description: |
  Returns all traces matching a specified filter object. Allows filtering by block range, sender addresses, and recipient addresses. This is an Arbitrum-specific tracing method that works for pre-Nitro blocks (before block 22,207,815). For post-Nitro blocks, use Geth debug_* methods.
x-compute-units: 40
params:
  - name: Filter
    required: true
    description: |
      The filter object specifying the criteria for trace retrieval.
    schema:
      title: Trace filter object
      type: object
      properties:
        fromBlock:
          title: From block
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          description: Starting block number, encoded as hexadecimal.
        toBlock:
          title: To block
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          description: Ending block number, encoded as hexadecimal.
        fromAddress:
          title: From addresses
          type: array
          description: Filter traces sent from these addresses.
          items:
            title: hex encoded address
            type: string
            pattern: ^0x[0-9a-fA-F]{40}$
        toAddress:
          title: To addresses
          type: array
          description: Filter traces sent to these addresses.
          items:
            title: hex encoded address
            type: string
            pattern: ^0x[0-9a-fA-F]{40}$
        after:
          title: After
          type: integer
          description: The offset trace number for pagination.
        count:
          title: Count
          type: integer
          description: Number of traces to return.
result:
  name: Filtered traces
  description: An array of trace objects matching the filter criteria.
  schema:
    type: array
    items:
      title: Trace object
      type: object
      properties:
        action:
          title: Trace action
          type: object
          properties:
            callType:
              title: Call type
              type: string
              description: The type of call (e.g., "call", "delegatecall", "staticcall").
            from:
              title: From address
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
              description: The address of the sender.
            gas:
              title: Gas
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
              description: The gas provided for the call, encoded as hexadecimal.
            input:
              title: Input data
              type: string
              description: The input data sent with the call.
            to:
              title: To address
              description: The address of the receiver. Null for contract creation.
              oneOf:
                - title: hex encoded address
                  type: string
                  pattern: ^0x[0-9a-fA-F]{40}$
                - type: 'null'
            value:
              title: Value
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
              description: The value transferred in wei, encoded as hexadecimal.
        blockHash:
          title: Block hash
          type: string
          pattern: ^0x[0-9a-f]{64}$
        blockNumber:
          title: Block number
          type: integer
          description: The block number where this trace occurred.
        error:
          title: Error
          type: string
          description: Error message if the call failed (e.g., "Reverted").
        result:
          title: Trace result
          type: object
          properties:
            gasUsed:
              title: Gas used
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
              description: The amount of gas used by the trace, encoded as hexadecimal.
            output:
              title: Output
              type: string
              description: The return data from the call, encoded as hexadecimal.
        subtraces:
          title: Subtraces
          type: integer
          description: The number of sub-traces created during execution.
        traceAddress:
          title: Trace address
          type: array
          description: The trace position indices in the call tree.
          items:
            type: integer
        transactionHash:
          title: Transaction hash
          type: string
          pattern: ^0x[0-9a-f]{64}$
        transactionPosition:
          title: Transaction position
          type: integer
          description: The position of the transaction in the block.
        type:
          title: Trace type
          type: string
          description: The type of trace (e.g., "call", "create").
examples:
  - name: arbtrace_filter example
    params:
      - name: Filter
        value:
          fromBlock: '0x152DD07'
          toBlock: '0x152DD07'
          fromAddress:
            - '0x00000000000000000000000000000000000a4b05'
          toAddress: []
          after: 0
          count: 10
    result:
      name: Filtered traces
      value:
        - action:
            callType: call
            from: '0x00000000000000000000000000000000000a4b05'
            gas: '0x0'
            input: 0x
            to: '0xa4b05fffffffffffffffffffffffffffffffffff'
            value: '0x0'
          blockHash: '0x5765e1e12766c561a99f2eca6be6dba225e5e2dbecc1c52c59dfd21f3c39071c'
          blockNumber: 22207751
          result:
            gasUsed: '0x0'
            output: 0x
          subtraces: 0
          traceAddress: []
          transactionHash: '0xd2ea43b18e2f0acb66b36e773f20a4e9a1ee2df00a9794f63c2f4d0519cbe12a'
          transactionPosition: 0
          type: call
```
