Debug API

The 4EVERLAND RPC Debug API allows developers to trace and analyze executed transactions and blocks on the blockchain. This comprehensive guide provides detailed instructions on how to utilize the Debug API effectively. Please note that the examples below are based on the BSC mainnet, and the endpoint URL should be replaced with the network's endpoint for other networks.

Endpoints

The Debug API endpoints follow the structure:

  • Endpoint: https://{chain-network}.4everland.org/v1/{apikey}

  • Supported Networks(mainnet): BSC, Ethereum, Polygon.

debug_traceBlockByHash

This method enables the tracing of a specific block by its hash. It returns an array of block traces, including details such as type, sender address, receiver address, value, gas details, input data, output, errors, and sub-calls.

Parameters

  • String: Block hash for the block to be traced

  • tracer Object: Currently only supports callTracer

Returns

The request will return an array of block traces

  • type string : CALL or CREATE

  • from string: 20 Bytes - address of the sender

  • to string: 20 Bytes - address of the receiver. null when its a contract creation transaction

  • value string: amount of value for transfer (in hex)

  • gas string: amount of gas provided for the call (in hex)

  • gasUsed string: amount of gsa used during the call (in hex)

  • input string: call data

  • output string: return data

  • error string: error, if any

  • revertReason string: solidity revert reason, if any

  • calls string: list of sub-calls

Example Request

curl --request POST \
     --url https://bsc-mainnet.4everland.org/v1/{API_KEY} \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "debug_traceBlockByHash",
  "params": [
    "0x8c31aa531b3400119e41456be302558e168b0315e83e987f54f9d496101af6dc",
    {
      "tracer": "callTracer"
    }
  ]
}
'

Result

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "txHash": "0xc93113b979188b9944573078b06d63a30e0e7478ab39f236aa1d93ca2621c493",
      "result": {
        "from": "0x81c21b8de4c66da6d176dceeaf5d6bb1c31db551",
        "gas": "0x3d090",
        "gasUsed": "0x19a8e",
        "to": "0x10ed43c718714eb63d5aa57b78b54704e256024e",
        "input": "0x7ff36ab500000000000000000000000000000000000000000000001932582c40efe4c000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000081c21b8de4c66da6d176dceeaf5d6bb1c31db5510000000000000000000000000000000000000000000000000000000065b7588f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000007e551e31a793e20dc18494ff6b03095a8f8ee36",
        "output": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000010f12721c5cc0000000000000000000000000000000000000000000000000194282bceda3de66f2",
        "calls": [
          {
            "from": "0x10ed43c718714eb63d5aa57b78b54704e256024e",
            "gas": "0x3547a",
            "gasUsed": "0xb4d",
            "to": "0xdd8124318d3dbfb486b4d9fbaba8a97409eebd71",
            "input": "0x0902f1ac",
            "output": "0x0000000000000000000000000000000000000000000156768e76e50a3db9061600000000000000000000000000000000000000000000000e50d9bbc9694280c60000000000000000000000000000000000000000000000000000000065b752c2",
            "type": "STATICCALL"
          },
          {
            "from": "0x10ed43c718714eb63d5aa57b78b54704e256024e",
            "gas": "0x29851",
            "gasUsed": "0xc3be",
            "to": "0xdd8124318d3dbfb486b4d9fbaba8a97409eebd71",
            "input": "0x022c0d9f0000000000000000000000000000000000000000000000194282bceda3de66f2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000081c21b8de4c66da6d176dceeaf5d6bb1c31db55100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
            "calls": [
              {
                "from": "0xdd8124318d3dbfb486b4d9fbaba8a97409eebd71",
                "gas": "0x22326",
                "gasUsed": "0x29c",
                "to": "0x07e551e31a793e20dc18494ff6b03095a8f8ee36",
                "input": "0x70a08231000000000000000000000000dd8124318d3dbfb486b4d9fbaba8a97409eebd71",
                "output": "0x00000000000000000000000000000000000000000001565d4bf4281c99da9f24",
                "type": "STATICCALL"
              }
            ],
            "value": "0x0",
            "type": "CALL"
          }
        ],
        "value": "0x10f12721c5cc000",
        "type": "CALL"
      }
    },
    {
      "txHash": "0xd2e662c5427ec8e7b1758832b124bb45f815954294b95e6881e713839949ee06",
      "result": {
        "from": "0x3c783c21a0383057d128bae431894a5c19f9cf06",
        "gas": "0x32918",
        "gasUsed": "0x5208",
        "to": "0x9dba722143f71f39642e1828336090d3f22207cd",
        "input": "0x",
        "value": "0x1c6b910834b400",
        "type": "CALL"
      }
    },
    .....
    ]
    }

debug_traceBlockByNumber

Similar to the debug_traceBlockByHash method, this method allows tracing based on the block number or tag. It returns an array of block traces with details similar to the previous method.

Parameters

  • String - Either the hex value of a block number OR One of the following block tags:

    1. pending - A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool. Intuitively, you can think of these as blocks that have not been mined yet.

    2. 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.

    3. safe - The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination. Intuitively, this block is “unlikely” to be re-orged. Only available on Ethereum Mainnet and Goerli.

    4. finalized - The most recent crypto-economically secure block, that has been accepted by >2/3 of validators. Cannot be re-orged outside of manual intervention driven by community coordination. Intuitively, this block is very unlikely to be re-orged. Only available on Ethereum Mainnet and Goerli.

    5. earliest - The lowest numbered block the client has available. Intuitively, you can think of this as the first block created.

  • tracer Object - Currently only supports callTracer (see above for definition).

Returns

The request will return an array of block traces

  • type string : CALL or CREATE

  • from string: 20 Bytes - address of the sender

  • to string: 20 Bytes - address of the receiver. null when its a contract creation transaction

  • value string: amount of value for transfer (in hex)

  • gas string: amount of gas provided for the call (in hex)

  • gasUsed string: amount of gas used during the call (in hex)

  • input string: call data

  • output string: return data

  • error string: error, if any

  • revertReason string: solidity revert reason, if any

  • calls string: list of sub-calls

Example Request

curl --request POST \
     --url https://bsc-mainnet.4everland.org/v1/{API_KEY} \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "debug_traceBlockByNumber",
  "params": [
    "finalized",
    {
      "tracer": "callTracer"
    }
  ]
}
'

Result

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "txHash": "0xeb24604de9d157b88ad77e86a2a5522a829c06e7e4ef0c1af632bfaede685417",
      "result": {
        "from": "0x8ac1bfdddc40ef25c48849c25103fed5b4211237",
        "gas": "0x13deb",
        "gasUsed": "0x13c59",
        "to": "0xb07e1afa56e7d43d7ee72813f771f3eda843d3cd",
        "input": "0xdac2218e0000000000000000000000004c1e55a941f15553c4ad6f87679b143061afa49400000000000000000000000000000000000000000000014542ba12a337c00000",
        "calls": [
          {
            "from": "0xb07e1afa56e7d43d7ee72813f771f3eda843d3cd",
            "gas": "0xc6d7",
            "gasUsed": "0xb88",
            "to": "0x2b0340a7c928266f62492707d7492706277b3ea5",
            "input": "0x70a08231000000000000000000000000b07e1afa56e7d43d7ee72813f771f3eda843d3cd",
            "output": "0x00000000000000000000000000000000000000001019dd352571171ecd980000",
            "type": "STATICCALL"
          },
          {
            "from": "0xb07e1afa56e7d43d7ee72813f771f3eda843d3cd",
            "gas": "0xb7cc",
            "gasUsed": "0xb7cc",
            "to": "0x2b0340a7c928266f62492707d7492706277b3ea5",
            "input": "0xa9059cbb0000000000000000000000004c1e55a941f15553c4ad6f87679b143061afa49400000000000000000000000000000000000000000000014542ba12a337c00000",
            "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
            "value": "0x0",
            "type": "CALL"
          }
        ],
        "value": "0x0",
        "type": "CALL"
      }
    },
    {
      "txHash": "0x719b7821b012998b408450fb2200b31921f38eb2e04a1438c883976a4745d07a",
      "result": {
        "from": "0x8292e25381ccd5c8c935763e52165306ba46500e",
        "gas": "0x1312d00",
        "gasUsed": "0xd7a4",
        "to": "0x910eff4bf676fe9fe6da0ddd0ddb823059a571cc",
        "input": "0x4e6ec247000000000000000000000000c6647db142177a0a1bfbe322872899d03fd54ad60000000000000000000000000000000000000000000000009e1dd7e27869c000",
        "calls": [
          {
            "from": "0x910eff4bf676fe9fe6da0ddd0ddb823059a571cc",
            "gas": "0x12bf5b1",
            "gasUsed": "0x630b",
            "to": "0x6b758a2522341df8b5d2556e8aecf37a51e4f799",
            "input": "0x40c10f19000000000000000000000000c6647db142177a0a1bfbe322872899d03fd54ad60000000000000000000000000000000000000000000000009e1dd7e27869c000",
            "value": "0x0",
            "type": "CALL"
          }
        ],
        "value": "0x0",
        "type": "CALL"
      }
    },
    .....
    ]
    }

debug_traceTransaction

This method enables the tracing of a specific transaction by its hash. It returns an array of block traces providing detailed information about the transaction's execution, similar to the block tracing methods.

Parameters

  1. String - Transaction hash

  2. Object - options for call, can be any of the following options: tracer: Object - Currently only supports callTracer (see above for definition).

    timeout: STRING - A duration string of decimal numbers that overrides the default timeout of 5 seconds for JavaScript-based tracing calls. Max timeout is "10s". Valid time units are "ns", "us", "ms", "s" each with optional fractions, such as "300ms" or "2s45ms".

Returns

The request will return an array of block traces

  • type string : CALL or CREATE

  • from string: 20 Bytes - address of the sender

  • to string: 20 Bytes - address of the receiver. null when its a contract creation transaction

  • value string: amount of value for transfer (in hex)

  • gas string: amount of gas provided for the call (in hex)

  • gasUsed string: amount of gas used during the call (in hex)

  • input string: call data

  • output string: return data

  • error string: error, if any

  • revertReason string: solidity revert reason, if any

  • calls string: list of sub-calls

Example Request

curl --request POST \
     --url https://bsc-mainnet.4everland.org/v1/{API_KEY}  \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "debug_traceTransaction",
  "params": [
    "0xe81c1c8a2be55d5df394e6e9502a19aa9d9bc3716f69917be5b83248ea9bf5df",
    {
      "tracer": "callTracer"
    }
  ]
}
'

Result

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "from": "0x2d4c407bbe49438ed859fe965b140dcf1aab71a9",
    "gas": "0x7fffffffffffffff",
    "gasUsed": "0xc740",
    "to": "0x0000000000000000000000000000000000001000",
    "input": "0xf340fa010000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a9",
    "calls": [
      {
        "from": "0x0000000000000000000000000000000000001000",
        "gas": "0x8fc",
        "gasUsed": "0x5ec",
        "to": "0x0000000000000000000000000000000000001002",
        "input": "0x",
        "value": "0xa746a6c240973",
        "type": "CALL"
      },
      {
        "from": "0x0000000000000000000000000000000000001000",
        "gas": "0x8fc",
        "gasUsed": "0x0",
        "to": "0x000000000000000000000000000000000000dead",
        "input": "0x",
        "value": "0x10ba43e039a8b8",
        "type": "CALL"
      }
    ],
    "value": "0xa746a6c2409730",
    "type": "CALL"
  }
}

debug_traceCall

The debug_traceCall method allows tracing specific calls within a transaction, providing detailed information about the call’s execution, similar to the transaction tracing methods.

Parameters

  1. Object - Transaction object

    1. from: string 20 Bytes - The address the transaction is sent from.

    2. to: string (required) 20 Bytes - The address the transaction is directed to

    3. gasprice: string Integer of the gasPrice used for each paid gas.(note:most of our users(95%+) never set the gasPrice on eth_call)

    4. value: string Integer of the value sent with this transaction

    5. data: string Hash of the method signature and encoded parameters

  2. String - Block hash, block number (in hex), or block tag One of the following options: - block hash - block number (in hex) - block tag (one of the following): `pending` - A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool. Intuitively, you can think of these as blocks that have not been mined yet. * `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. * `safe` - The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination.Intuitively, this block is “unlikely” to be re-orged. Only available on Ethereum Mainnet and Goerli. * `finalized` - The most recent crypto-economically secure block, that has been accepted by >2/3 of validators. Cannot be re-orged outside of manual intervention driven by community coordination. Intuitively, this block is very unlikely to be re-orged. Only available on Ethereum Mainnet and Goerli. * `earliest` - The lowest numbered block the client has available. Intuitively, you can think of this as the first block created.

Returns

The request will return an array of block traces

  • type string : CALL or CREATE

  • from string: 20 Bytes - address of the sender

  • to string: 20 Bytes - address of the receiver. null when its a contract creation transaction

  • value string: amount of value for transfer (in hex)

  • gas string: amount of gas provided for the call (in hex)

  • gasUsed string: amount of gas used during the call (in hex)

  • input string: call data

  • output string: return data

  • error string: error, if any

  • revertReason string: solidity revert reason, if any

  • calls string: list of sub-calls

Example Request

curl --request POST \
     --url https://bsc-mainnet.4everland.org/v1/{API_KEY} \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "debug_traceCall",
  "params": [
    {
      "to": "0x55d398326f99059fF775485246999027B3197955"
    },
    "finalized",
    {
      "tracer": "callTracer"
    }
  ]
}
'

Result

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "from": "0x0000000000000000000000000000000000000000",
    "gas": "0x1dcd6500",
    "gasUsed": "0x524e",
    "to": "0x55d398326f99059ff775485246999027b3197955",
    "input": "0x",
    "error": "execution reverted",
    "value": "0x0",
    "type": "CALL"
  }
}

Last updated