trace_call
JSON-RPC method executes a call and returns trace information using OpenEthereum-style tracing. This method simulates a transaction and provides detailed execution traces without committing changes to the blockchain, making it ideal for transaction analysis, debugging, and testing before actual execution.
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
- Trace types (array, required): Array of trace types to include
- Block parameter (string, required): Block number, hash, or “latest”/“earliest”/“pending”
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 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
Trace types
"trace"
: Basic execution trace information"vmTrace"
: Virtual machine execution trace"stateDiff"
: State differences caused by the transaction
Response
The method returns an array of trace objects containing detailed execution information.Response structure
Trace objects:action
— Details about the call action (from, to, value, gas, input, callType)result
— Execution result (gasUsed, output)traceAddress
— Address path within the call hierarchytype
— Type of trace (call, create, suicide, etc.)
Usage example
Basic implementation
Example request
Shell
Use cases
Thetrace_call
method is essential for applications that need to:
- Transaction simulation: Simulate transactions before execution to predict outcomes
- Gas estimation: Get accurate gas estimates for complex contract interactions
- Debugging tools: Debug smart contract execution and identify issues
- Security analysis: Analyze potential security vulnerabilities in contract calls
- DeFi testing: Test complex DeFi operations before execution
- MEV analysis: Analyze Maximum Extractable Value opportunities
- Development workflows: Integrate simulation into development pipelines
- User interfaces: Provide transaction previews in user applications
- Risk assessment: Assess risks before executing high-value transactions
- Compliance checking: Verify regulatory compliance before transaction execution
- Educational tools: Create educational content about transaction execution
- Research platforms: Support blockchain research and analysis
- Performance optimization: Optimize contract interactions for better efficiency
- Integration testing: Test smart contract integrations thoroughly
- Protocol development: Develop and test new blockchain protocols
Body
application/json