3

I need to call the RPC method debug_traceTransaction but it's not present within the Go client. I'd add a method that performs the call to the RPC endpoint but I'm wondering if there's a reason behind..? Too much to transform? The Management API Wiki specifies that you can use debug.TraceTransaction(txHash common.Hash, logger *vm.LogConfig) (*ExecutionResurt, error) but that's not in the client's code.

Update: I put here the basic code I'm using to make the call in case someone wants to do the same thing

func DebugTransaction(hash string) (string, error) {
    json := `{"id": 1, "method": "debug_traceTransaction", "params": ["` + hash + `", {"disableStack": true, "disableMemory": true, "disableStorage": true}]}`
    log.Println("Request with:", json)
    jsonByte := []byte(json)
    req, _ := http.NewRequest("POST", ethereumNodeAddress, bytes.NewBuffer(jsonByte))
    req.Header.Set("Content-Type", "application/json")
    resp, err := client.Do(req)
    if err != nil {
        log.Println(err)
    }
    body, err := ioutil.ReadAll(resp.Body)
    log.Println("Request info: " + resp.Status + " " + string(body))
    return string(body), err
}
2

Transaction tracing is not exposed via ethclient. You must connect over the regular rpc and invoke it as a regular call.

The reasoning for that is given here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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