debug_traceTransaction - Base
Example code for the debug_traceTransaction JSON-RPC method. Complete guide on how to use debug_traceTransaction JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Trace Options
Field
Type
Description
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "debug_traceTransaction",
"params": [
"0x633982a26e0cfba940613c52b31c664fe977e05171e35f62da2426596007e249",
{"tracer": "callTracer"}
],
"id": "getblock.io"
}'const axios = require('axios');
const txHash = '0x633982a26e0cfba940613c52b31c664fe977e05171e35f62da2426596007e249';
const response = await axios.post('https://go.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'debug_traceTransaction',
params: [txHash, { tracer: 'callTracer' }],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
const trace = response.data.result;
console.log('Type:', trace.type);
console.log('From:', trace.from);
console.log('To:', trace.to);
console.log('Gas Used:', trace.gasUsed);Response
Response Parameters
Parameter
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Web3 Integration
Last updated
Was this helpful?