debug_traceBlockByNumber

Replays the block that is already present in the database.

Parameters

  1. transactionNumber - This describes the transaction number to fetch the transaction by.
  2. tracer Object - Currently only supports callTracer (see below for definition).

Returns

  • Array - Block traces

Request

curlhttps://eth-mainnet.g.alchemy.com/v2/demo/ \\
 -X POST \\
 -H "Content-Type: application/json" \\
 --data '{"method":"debug_traceBlockByNumber",
       "params":[
           "0xECE410", 
           {"tracer": "callTracer"}
          ],
        "id":1,
        "jsonrpc":"2.0"
       }'

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "type": "CALL",
    "from": "0x0000000000000000000000000000000000000000",
    "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    "value": "0x0",
    "gas": "0x7fffffffffffadf7",
    "gasUsed": "0x0",
    "input": "0x",
    "output": "0x"
  }
}

callTracer

The callTracer tracks all the call frames executed during a transaction, including depth 0. The result will be a nested list of call frames, resembling how EVM works. They form a tree with the top-level call at root and sub-calls as children of the higher levels. Each call frame has the following fields:

field

type

description

type

string

CALL

from

string

address

to

string

address

value

string

hex-encoded amount of value transfer

gas

string

hex-encoded gas provided for call

gasUsed

string

hex-encoded gas used during call

input

string

call data

output

string

return data

error

string

error, if any

revertReason

string

Solidity revert reason, if any

calls

[]callframe

list of sub-calls

Things to note about the call tracer:

  • Calls to precompiles are also included in the result.
  • In the case a frame reverts, the field output will contain the raw return data.
  • In case the top level frame reverts, its revertReason field will contain the parsed reason of revert as returned by the Solidity contract.
Language
Click Try It! to start a request and see the response here!