# arbtrace_callMany

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

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

Executes multiple calls and returns traces for each. Before executing a transaction, all preceding transactions are first applied and traced. 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-call-many

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Calls | [object, enum[]][] | Yes | An array of call/trace-type pairs. Each element is an array of [transaction call object, trace type array].  |
| Block number | string or enum | Yes | The block number as a hexadecimal string, or a block tag such as "latest", "earliest", or "pending".  |

## Result

**Trace results** (object[]): An array of trace results, one per call.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "arbtrace_callMany",
  "params": [
    [
      [
        {
          "from": "0x1234567890abcdef1234567890abcdef12345678",
          "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
          "value": "0x0",
          "data": "0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd"
        },
        [
          "trace"
        ]
      ],
      [
        {
          "from": "0x1234567890abcdef1234567890abcdef12345678",
          "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
          "value": "0x0",
          "data": "0x18160ddd"
        },
        [
          "trace"
        ]
      ]
    ],
    "0x152DD07"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "stateDiff": null,
      "trace": [
        {
          "action": {
            "callType": "call",
            "from": "0x1234567890abcdef1234567890abcdef12345678",
            "gas": "0x2faf080",
            "input": "0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd",
            "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
            "value": "0x0"
          },
          "result": {
            "gasUsed": "0x565",
            "output": "0x0000000000000000000000000000000000000000000000000000000000000000"
          },
          "subtraces": 0,
          "traceAddress": [],
          "type": "call"
        }
      ],
      "vmTrace": null
    },
    {
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "stateDiff": null,
      "trace": [
        {
          "action": {
            "callType": "call",
            "from": "0x1234567890abcdef1234567890abcdef12345678",
            "gas": "0x2faf080",
            "input": "0x18160ddd",
            "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
            "value": "0x0"
          },
          "result": {
            "gasUsed": "0x4a2",
            "output": "0x0000000000000000000000000000000000000000000000000000000000000000"
          },
          "subtraces": 0,
          "traceAddress": [],
          "type": "call"
        }
      ],
      "vmTrace": null
    }
  ],
  "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_callMany",
  "params": [
    [
      [
        {
          "from": "0x1234567890abcdef1234567890abcdef12345678",
          "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
          "value": "0x0",
          "data": "0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd"
        },
        [
          "trace"
        ]
      ],
      [
        {
          "from": "0x1234567890abcdef1234567890abcdef12345678",
          "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
          "value": "0x0",
          "data": "0x18160ddd"
        },
        [
          "trace"
        ]
      ]
    ],
    "0x152DD07"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'arbtrace_callMany',
    params: [
      [
        [
          {
            from: '0x1234567890abcdef1234567890abcdef12345678',
            to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
            value: '0x0',
            data: '0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd'
          },
          ['trace']
        ],
        [
          {
            from: '0x1234567890abcdef1234567890abcdef12345678',
            to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
            value: '0x0',
            data: '0x18160ddd'
          },
          ['trace']
        ]
      ],
      '0x152DD07'
    ]
  })
};

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_callMany",
    "params": [[[
                {
                    "from": "0x1234567890abcdef1234567890abcdef12345678",
                    "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
                    "value": "0x0",
                    "data": "0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd"
                },
                ["trace"]
            ], [
                {
                    "from": "0x1234567890abcdef1234567890abcdef12345678",
                    "to": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
                    "value": "0x0",
                    "data": "0x18160ddd"
                },
                ["trace"]
            ]], "0x152DD07"]
}
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_callMany\",\n  \"params\": [\n    [\n      [\n        {\n          \"from\": \"0x1234567890abcdef1234567890abcdef12345678\",\n          \"to\": \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\",\n          \"value\": \"0x0\",\n          \"data\": \"0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd\"\n        },\n        [\n          \"trace\"\n        ]\n      ],\n      [\n        {\n          \"from\": \"0x1234567890abcdef1234567890abcdef12345678\",\n          \"to\": \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\",\n          \"value\": \"0x0\",\n          \"data\": \"0x18160ddd\"\n        },\n        [\n          \"trace\"\n        ]\n      ]\n    ],\n    \"0x152DD07\"\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_callMany\",\n  \"params\": [\n    [\n      [\n        {\n          \"from\": \"0x1234567890abcdef1234567890abcdef12345678\",\n          \"to\": \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\",\n          \"value\": \"0x0\",\n          \"data\": \"0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd\"\n        },\n        [\n          \"trace\"\n        ]\n      ],\n      [\n        {\n          \"from\": \"0x1234567890abcdef1234567890abcdef12345678\",\n          \"to\": \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\",\n          \"value\": \"0x0\",\n          \"data\": \"0x18160ddd\"\n        },\n        [\n          \"trace\"\n        ]\n      ]\n    ],\n    \"0x152DD07\"\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_callMany\",\n  \"params\": [\n    [\n      [\n        {\n          \"from\": \"0x1234567890abcdef1234567890abcdef12345678\",\n          \"to\": \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\",\n          \"value\": \"0x0\",\n          \"data\": \"0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd\"\n        },\n        [\n          \"trace\"\n        ]\n      ],\n      [\n        {\n          \"from\": \"0x1234567890abcdef1234567890abcdef12345678\",\n          \"to\": \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\",\n          \"value\": \"0x0\",\n          \"data\": \"0x18160ddd\"\n        },\n        [\n          \"trace\"\n        ]\n      ]\n    ],\n    \"0x152DD07\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: arbtrace_callMany
summary: Executes multiple call traces on the same block.
description: |
  Executes multiple calls and returns traces for each. Before executing a transaction, all preceding transactions are first applied and traced. 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: 80
params:
  - name: Calls
    required: true
    description: |
      An array of call/trace-type pairs. Each element is an array of [transaction call object, trace type array].
    schema:
      type: array
      items:
        type: array
        items:
          - title: Transaction call object
            type: object
            properties:
              from:
                title: From address
                type: string
                pattern: ^0x[0-9a-fA-F]{40}$
                description: The address the transaction is sent from.
              to:
                title: To address
                type: string
                pattern: ^0x[0-9a-fA-F]{40}$
                description: The address the transaction is directed to.
              gas:
                title: Gas
                type: string
                pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                description: Maximum gas allowance for the transaction.
              gasPrice:
                title: Gas price
                type: string
                pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                description: Gas price in wei per gas unit.
              value:
                title: Value
                type: string
                pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                description: Value to transfer in wei.
              data:
                title: Data
                type: string
                description: Hash of the method signature and encoded parameters.
          - title: Trace types
            type: array
            description: Array of trace types to return (e.g., ["trace"]).
            items:
              type: string
              enum:
                - trace
                - vmTrace
                - stateDiff
        additionalItems: false
  - name: Block number
    required: true
    description: |
      The block number as a hexadecimal string, or a block tag such as "latest", "earliest", or "pending".
    schema:
      title: Block number or tag
      oneOf:
        - title: Block number
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        - title: Block tag
          type: string
          enum:
            - earliest
            - finalized
            - safe
            - latest
            - pending
          description: '`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error'
result:
  name: Trace results
  description: An array of trace results, one per call.
  schema:
    type: array
    items:
      title: Trace call result
      type: object
      properties:
        output:
          title: Output
          type: string
          description: The return value of the call, encoded as hexadecimal.
        stateDiff:
          title: State diff
          description: The state differences, if requested. Null if not requested.
          nullable: true
        trace:
          title: Trace array
          type: array
          description: Array of trace objects for the call.
          items:
            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.
              error:
                title: Error
                type: string
                nullable: true
              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:
                type: integer
              traceAddress:
                type: array
                items:
                  type: integer
              type:
                type: string
        vmTrace:
          title: VM trace
          description: The VM trace, if requested. Null if not requested.
          nullable: true
examples:
  - name: arbtrace_callMany example
    params:
      - name: Calls
        value:
          - - from: '0x1234567890abcdef1234567890abcdef12345678'
              to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd'
              value: '0x0'
              data: '0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd'
            - - trace
          - - from: '0x1234567890abcdef1234567890abcdef12345678'
              to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd'
              value: '0x0'
              data: '0x18160ddd'
            - - trace
      - name: Block number
        value: '0x152DD07'
    result:
      name: Trace results
      value:
        - output: '0x0000000000000000000000000000000000000000000000000000000000000000'
          stateDiff: null
          trace:
            - action:
                callType: call
                from: '0x1234567890abcdef1234567890abcdef12345678'
                gas: '0x2faf080'
                input: '0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd'
                to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd'
                value: '0x0'
              result:
                gasUsed: '0x565'
                output: '0x0000000000000000000000000000000000000000000000000000000000000000'
              subtraces: 0
              traceAddress: []
              type: call
          vmTrace: null
        - output: '0x0000000000000000000000000000000000000000000000000000000000000000'
          stateDiff: null
          trace:
            - action:
                callType: call
                from: '0x1234567890abcdef1234567890abcdef12345678'
                gas: '0x2faf080'
                input: '0x18160ddd'
                to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd'
                value: '0x0'
              result:
                gasUsed: '0x4a2'
                output: '0x0000000000000000000000000000000000000000000000000000000000000000'
              subtraces: 0
              traceAddress: []
              type: call
          vmTrace: null
```
