Following answer (https://ethereum.stackexchange.com/a/9437/4575) [ 1 ] guide us to call debug_trace
through using geth
:
As documented in debug.traceTransaction(...), you can only access this API call using the geth JavaScript console or the JSON-RPC API. There is no web3 API that I know of. There are some unofficial extension web3 APIs, but I don't know if debug.traceTransaction is supported by these. Looks like you have to use JSON-RPC to access this data.
but I was wondering is it possible to call debug_Transaction
inside nodejs
?
I tried the steps on https://ethereum.stackexchange.com/a/9462/4575 [ 2 ] but it seems does not work for me and this answer seems contradict with the previous answer I have lined on [ 1 ].
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
web3.currentProvider.sendAsync({
method: "debug_traceTransaction",
params: ['<transaction_id>', {}],
jsonrpc: "2.0",
id: "2"
}, function (err, result) {
console.log( result );
});
Output result:
{ jsonrpc: '2.0',
id: '2',
error:
{ code: -32601,
message: 'The method debug_traceTransaction does not exist/is not available' } }
Thank you for your valuable time and help.