debug_traceTransaction - BSC

Example code for the debug_traceTransaction JSON RPC method. Сomplete guide on how to use debug_traceTransaction JSON RPC in GetBlock Web3 documentation.

The debug_traceTransaction method returns a detailed trace of a transaction's execution on the BNB Smart Chain. This is useful for debugging smart contract interactions and understanding gas consumption.

Parameters

Parameter
Type
Required
Description

transactionHash

string

Yes

Transaction hash to trace

options

object

No

Tracer options

Options Object

Field
Type
Description

tracer

string

Tracer type (callTracer, prestateTracer)

timeout

string

Execution timeout

Request Example

curl
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "debug_traceTransaction",
    "params": [
        "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
        {"tracer": "callTracer"}
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Parameter
Type
Description

type

string

Call type (CALL, DELEGATECALL, etc.)

from

string

Caller address

to

string

Called address

gasUsed

string

Gas consumed

Use Cases

  • Debug failed transactions

  • Analyze internal calls

  • Audit smart contract execution

  • Optimize gas usage

Error Handling

Error Code
Description

-32602

Invalid params

-32000

Transaction not found

-32603

Internal error

SDK Integration

Last updated

Was this helpful?