debug_traceBlockByNumber

Similar to debug_traceBlock, traceBlockByNumber accepts a block number and will replay the block that is already present in the database. For the second parameter see TraceConfig reference.

Parameters

  • QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
  • OBJECT- The tracer object with the following fields:
    • tracer: STRING - The type of tracer. It could be callTracer or prestateTracer
      • callTracer - The calltracer keeps track of all call frames, including depth 0 calls, that are made during a transaction
      • prestateTracer - The prestateTracer replays the transaction and tracks every part of state that occured during the transaction
    • tracerConfig: OBJECT - The object to specify the configurations of the tracer
      • onlyTopCall: BOOLEAN - When set to true, this will only trace the primary (top-level) call and not any sub-calls. It eliminates the additional processing for each call frame
curl https://polygon-mainnet-archive.allthatnode.com:8545/8U3JLUhzIDg3GShvy9hkCCSYkLGc11kj \
--request POST \
--header "Content-Type: application/json" \
--data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "debug_traceBlockByNumber",
  "params": [
    "latest",
    {
      "tracer": "callTracer",
      "tracderConfig": {
        "onlyTopCall": true
      }
    }
  ]
}'

Returns

An ARRAY ofOBJECT with the following fields:

  • txHash: STRING - transaction hash
  • result: OBJECT
    • from - The address the transaction is sent from
    • gas - The integer of the gas provided for the transaction execution
    • gasUsed - The integer of the gas used
    • to - The address the transaction is directed to
    • input - The data given at the time of input
    • output - The data which is returned as an output
    • calls: ARRAY - A array of sub-call objects
    • value - The hex encoded integer of the value sent with this transaction
    • type - The type of the call
	{
  "jsonrpc": "2.0",
  "id": "1",
  "result": [
    {
      "txHash": "0x637eabe31da13cbc095b62668fcfabdf10277bde60ce879e0e3bd06c4db120cc",
      "result": {
        "from": "0x4e14529d962cba526a70435132cee96599675d45",
        "gas": "0xbf4a",
        "gasUsed": "0xbded",
        "to": "0x6a9014fb802dcc5efe3b97fd40aaa632585636d0",
        "input": "0x095ea7b3000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae31000000000000000000000000000000000000000000000046681f67c89dd49af3",
        "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
        "calls": [
          {
            "from": "0x6a9014fb802dcc5efe3b97fd40aaa632585636d0",
            "gas": "0x5ed3",
            "gasUsed": "0x5ed3",
            "to": "0xc629a01ec23ab04e1050500a3717a2a5c0701497",
            "input": "0x095ea7b3000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae31000000000000000000000000000000000000000000000046681f67c89dd49af3",
            "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
            "value": "0x0",
            "type": "DELEGATECALL"
          }
        ],
        "value": "0x0",
        "type": "CALL"
      }
    },
    // another objects
  ]
}

Try Yourself

Language
Click Try It! to start a request and see the response here!