1

What is the best way to tell if the node I am using is exposing the Parity trace methods?

One way I know if is to call a contract on Kovan and look for a revert reason that says to expose the trace methods, but this requires an RPC call and is not explicit (the call may fail for other reasons). Additionally, different clients (geth, party, etc.) return error messages, so this is not reliable. Is there a way to do this explicitly and/or without making an RPC call?

1 Answer 1

2

You can try running a trace cURL in your terminal to the node, like:

curl --data '{"method":"trace_transaction","params":["0x99ac150336f74125702bb87598677c97474c5783a9258049d98377ab0773f73d"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST https://green-autumn-waterfall.quiknode.pro/2ab41411fc6296f2d7f82fa096304f21968913a8/

If it returns a response, then it works. Otherwise it should return an explicit error, letting you know the trace module is not enabled.

Also, check the documentation of your node provider to see if they support the call or not (or ask them directly).

disclosure: work for quiknode.io

4
  • Great response. I tried that call with Quiknode, Infura, and Alchemy. The error message for each was different for every one of them, and the error code was the same for Infura and Alchemy (-32601) but different for Quiknode (-32000). Do you know of a more standardized way of collecting this data without a bunch oof (if...else) statements? Commented Apr 22, 2020 at 18:08
  • 1
    quiknode now returns "code":-32601 as well 👍
    – haxsyn
    Commented Apr 23, 2020 at 3:27
  • Great! Thanks for the update. Finally, I see here that there is not really a specific, defined error code for these kind of things. github.com/ethereum/wiki/wiki/… Why, in this case, would you choose -32601? Is there a canonical list of error codes? Commented Apr 23, 2020 at 3:38
  • 1
    afaik all three providers mentioned here utilize some middle api layer, which allows for custom error messages. if one were to query a node directly, they'd see {"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":1}
    – haxsyn
    Commented Apr 23, 2020 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.