debug_traceCall
JSON-RPC method executes a call and returns detailed trace information without creating a transaction. This method simulates transaction execution and provides comprehensive debugging information including call traces, gas usage, and state changes, making it essential for testing and debugging smart contract interactions before committing transactions to the blockchain.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
- Call object (object, required): Transaction call details
- Block parameter (string, required): Block number, hash, or “latest”/“earliest”/“pending”
- Tracer configuration (object, required): Configuration options for the tracer
Call object structure
from
(string, optional): Address the transaction is sent fromto
(string, required): Address the transaction is directed togas
(string, optional): Gas provided for the transaction executiongasPrice
(string, optional): Gas price for the transactionvalue
(string, optional): Value sent with the transactiondata
(string, optional): Hash of the method signature and encoded parameters
Tracer configuration options
tracer
(string): The type of tracer to use"callTracer"
: Provides detailed call trace information"prestateTracer"
: Shows state before execution"4byteTracer"
: Tracks function selector usage
Response
The method returns detailed trace information for the simulated call, including execution details, gas usage, and state changes.Response structure
Trace data:type
— The type of call (CALL, DELEGATECALL, STATICCALL, CREATE, etc.)from
— The address that initiated the callto
— The address that received the callvalue
— The value transferred in the callgas
— The amount of gas allocated for the callgasUsed
— The amount of gas actually consumedinput
— The input data for the calloutput
— The output data returned by the callcalls
— Array of sub-calls made during execution
Usage example
Basic implementation
Example request
Shell
Use cases
Thedebug_traceCall
method is essential for applications that need to:
- Pre-execution testing: Test transactions before committing them to the blockchain
- Gas estimation: Accurately estimate gas requirements for complex transactions
- Smart contract debugging: Debug contract interactions and identify execution issues
- Transaction simulation: Simulate complex DeFi transactions and multi-step operations
- Error prediction: Predict and prevent transaction failures before execution
- Cost optimization: Optimize transaction parameters for better gas efficiency
- Integration testing: Test smart contract integrations and compatibility
- Security testing: Test for potential vulnerabilities and edge cases
- Development workflows: Integrate simulation into development and testing pipelines
- User experience: Provide users with transaction previews and success predictions
- MEV analysis: Analyze Maximum Extractable Value opportunities safely
- Arbitrage testing: Test arbitrage strategies without risking capital
- Flash loan simulation: Simulate complex flash loan strategies
- Protocol testing: Test new protocol features and upgrades
- Compliance checking: Verify regulatory compliance before transaction execution
- Risk assessment: Assess transaction risks and potential outcomes
Body
application/json