trace_block - Optimism

trace_block. Retrieves detailed transaction traces for all transactions within a specified block

trace_block - optimism [Value: 90CU]
Retrieves detailed execution traces of all transactions included in a specific block
Use cases

Use cases

  • Analyze internal transactions for the latest block
  • Trace smart contract executions in the newest block
  • Investigate transaction behavior within the most recent block
Constraints

Constraints

  • Requires access to the latest block data
  • Node must support the trace_block method
  • AHigh computational cost for tracing recent blocks
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl --request POST \
     --url https://optimism.drpc.org \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "trace_block",
  "params": [
    "latest"
  ]
}
'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "result": [
    {
      "action": {
        "callType": "call",
        "from": "0xaa7b131dc60b80d3cf5e59b5a21a666aa039c951",
        "gas": "0x0",
        "input": "0x",
        "to": "0xd40aba8166a212d6892125f079c33e6f5ca19814",
        "value": "0x4768d7effc3fbe"
      },
      "blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add",
      "blockNumber": 3068185,
      "result": {
        "gasUsed": "0x0",
        "output": "0x"
      },
      "subtraces": 0,
      "traceAddress": [],
      "transactionHash": "0x07da28d752aba3b9dd7060005e554719c6205c8a3aea358599fc9b245c52f1f6",
      "transactionPosition": 0,
      "type": "call"
    },
    {
      "action": {
        "callType": "call",
        "from": "0x4f11ba23bb526c0486d83c6a8f18f632f3fc172a",
        "gas": "0x0",
        "input": "0x",
        "to": "0x7ed1e469fcb3ee19c0366d829e291451be638e59",
        "value": "0x446cde325fbfbe"
      },
      "blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add",
      "blockNumber": 3068185,
      "result": {
        "gasUsed": "0x0",
        "output": "0x"
      },
      "subtraces": 0,
      "traceAddress": [],
      "transactionHash": "0x056f11efb5da4ff7cf8523cfcef08393e5dd2ff3ab3223e4324426d285d7ae92",
      "transactionPosition": 1,
      "type": "call"
    },
    {
      "...": null
    }
  ],
  "id": 0
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray of strings
array of strings
blockNumberstring
(optional) Block number as an integer, or string
  • latest [default] - The most recent block in the blockchain (default).
  • earliest - The first block, also known as the genesis block.
  • pending - Transactions that have been broadcast but not yet included in a block.

Response

200
An array containing trace objects for each transaction in the block.

Response params

object
idinteger
jsonrpcstring
resultobject
object
actionobject
Contains details about the trace action.
object
callTypestring
The type of call.
fromstring
The sender's address.
tostring
The receiver's address.
valuestring
The value transferred in wei.
gasstring
The gas provided for the call.
inputstring
The data sent with the call.
blockHashstring
The hash of the block where the trace occurred.
blockNumberstring
The number of the block where the trace occurred.
resultstring
object
gasUsedstring
Gas used by the trace.
outputstring
Call output.
subtracesinteger
Number of subtraces created by this trace..
traceAddressarray_of_strings
Position of this trace in the call stack.
transactionHashstring
Hash of the transaction containing this trace.
transactionPositionstring
Transaction's position in the block.
typestring
The type of trace.