I am trying to call debug_traceTransaction
in go
by doing:
cl, err := ethclient.Dial("http://localhost:8545")
if err != nil {
panic("Failed starting")
}
txnHash := common.HexToHash("0x60eb378a5ceeb61a72e06363e6f69f03a04b5dd0a76be51872f3f2563d5124e2")
encodedTxHash := hexutil.Encode(txnHash.Bytes())
var result interface{}
err = cl.CallContext(context.Background(), &result, "debug_traceTransaction", encodedTxHash, nil)
if err != nil {
panic(err)
}
I am getting this error:
panic: invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Hash
goroutine 1 [running]:
main.main()
/root/atlas-erigon/atlas/main.go:432 +0x26c
exit status 2
How should I encode the transaction hash?