> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# arbtrace_get | Arbitrum

> Arbitrum API method that returns the traces of a transaction based on its traces position. arbtrace_get on Arbitrum via Chainstack.

Arbitrum API method that returns the traces of a transaction based on its traces position. The index positions of the traces within a transaction refer to the individual steps or actions that occurred during the execution of that transaction. Each trace represents a specific operation or event within the transaction, such as a contract function call or a state change.

<Note>
  Learn how to [deploy a node](/docs/debug-and-trace-apis#ethereum) with the debug and trace API methods enabled.
</Note>

<Warning>
  Blocks older than 22,207,815 were added to the chain before the Nitro migration and cannot be queried with Geth `debug_*` methods. Starting from block 22,207,815, Arbitrum migrated to Nitro which made Geth `debug_*` methods available for newer blocks.

  Use the `arbtrace_get` method for calling blocks prior to 22,207,815.
</Warning>

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

* `hash` — the transaction hash for which you want to retrieve the trace. It is a unique identifier for the transaction.
* `array` — an array of index positions representing the traces within the transaction that you want to retrieve. The index positions indicate the specific steps or actions within the transaction.

## Response

* `result` — an object containing the traces of all of the transaction:
  * `action` — an object that describes the action taken by the transaction:
    * `calltype` — the type of call, `call` or `delegatecall`, two ways to invoke a function in a smart contract. `call` creates a new environment for the function to work in, so changes made in that function won't affect the environment where the function was called. `delegatecall` doesn't create a new environment. Instead, it runs the function within the environment of the caller, so changes made in that function will affect the caller's environment.
    * `from` — the address that initiated the action.
    * `gas` — the amount of gas allocated for the action.
    * `input` — the input data provided for the action.
    * `to` — the address of the contract or account receiving the action.
    * `value` — the value in Wei sent along with the action.
  * `blockhash` — the hash of the block where the action was included.
  * `blocknumber` — the number of the block where the action was included.
  * `result` — an object that contains additional data about the execution of the transaction:
    * `gasused` — the amount of gas used during the action.
    * `output` — the output data returned by the action.
  * `subtraces` — the number of sub-traces created during execution. When a transaction is executed on the EVM, it may trigger additional sub-executions, such as when a smart contract calls another smart contract or when an external account is accessed.
  * `traceaddress` — an array representing the path to the current action within the trace.
  * `transactionhash` — the hash of the transaction associated with the trace.
  * `transactionposition` — the position of the transaction within the block.
  * `type` — the type of action taken by the transaction, `call` or `create`. `call` is the most common type of trace and occurs when a smart contract invokes another contract's function. `create` represents the creation of a new smart contract. This type of trace occurs when a smart contract is deployed to the blockchain.

## `arbtrace_get` code examples

<CodeGroup>
  ```javascript web3.js theme={"system"}
  const Web3 = require("web3");
  const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
  const web3 = new Web3(NODE_URL);

  // Define the arbtrace_get custom method
  web3.extend({
    property: 'arbtrace',
    methods: [{
      name: 'get',
      call: 'arbtrace_get',
      params: 2,
    }],
  });

  async function arbtraceGet() {
    const transactionHash = "0xe8648e3ad982a3d67ef0880d6631343cffff364786994b34e5fa292cfef0e680";
    const traceOptions = ["0x0"];

    try {
      const result = await web3.arbtrace.get(traceHash, traceOptions);
      console.log(result);
    } catch (error) {
      console.error("Error:", error);
    }
  }

  arbtraceGet();
  ```

  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const arbtraceGet = async () => {
      const transactionHash = "0xe8648e3ad982a3d67ef0880d6631343cffff364786994b34e5fa292cfef0e680";
      const traceOptions = ["0x0"];

      const traces = await provider.send("arbtrace_get", [transactionHash, traceOptions]);
      console.log(traces);
  };

  arbtraceGet();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3  
  node_url = "YOUR_CHAINSTACK_ENDPOINT" 
  web3 = Web3.HTTPProvider(node_url)

  transactionHash = "0xe8648e3ad982a3d67ef0880d6631343cffff364786994b34e5fa292cfef0e680";
  traceOptions = ["0x0"];

  response = web3.provider.make_request('arbtrace_get', [transactionHash, traceOptions])
  print(response)
  ```
</CodeGroup>

## Use case

The `arbtrace_get` method is valuable for transaction analysis and debugging on the Arbitrum blockchain. By retrieving a detailed trace of a specific transaction, you can gain insights into the sequence of actions and their outcomes. Practical use cases include:

* Debugging smart contract transactions — analyzing the trace helps identify issues and unexpected behavior by examining the specific function calls, parameters, and values involved.
* Identifying execution errors — the trace provides information on where errors occurred within the transaction, helping pinpoint the cause of failures or issues. Gas consumption and output data can also be examined for error messages.
* Gas usage optimization — by analyzing the `gasUsed` field in the trace's result, you can identify gas-intensive operations and optimize gas usage in your smart contract code.
* Auditing and security analysis — the `arbtrace_get` method enables thorough audits of smart contract transactions. Analyzing the trace ensures that the transaction aligns with expected behavior, state changes, and security requirements.


## OpenAPI

````yaml /openapi/arbitrum_node_api/debug_and_trace/arbtrace_get.json POST /66f812de2a6724a75a51f60dd6f2a154
openapi: 3.0.0
info:
  title: Chainstack Node API
  version: 1.0.5
  description: >-
    This is an API for interacting with a Chainstack node using the arbtrace_get
    method.
servers:
  - url: https://nd-954-882-037.p2pify.com
security: []
paths:
  /66f812de2a6724a75a51f60dd6f2a154:
    post:
      tags:
        - upload
      summary: arbtrace_get
      operationId: arbtraceGet
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: arbtrace_get
                params:
                  type: array
                  items:
                    anyOf:
                      - type: string
                        title: Transaction Hash
                      - type: array
                        items:
                          type: string
                        title: Index
                  default:
                    - >-
                      0xe8648e3ad982a3d67ef0880d6631343cffff364786994b34e5fa292cfef0e680
                    - - '0x0'
      responses:
        '200':
          description: The transaction's trace.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: object

````