Skip to main content
1 of 3

Decode transaction inputs with go-ethereum

When making a contract transaction using go-ethereum (golang) how can I decode the transaction inputs.

Specifically Given a tx.Data []byte , the contract's contractABI abi.ABI and the method that is being called its methodID string how can I decode tx.Data from hexadecimal to go types ?

I've tried doing abi.Methods[methodID].Inputs.Arguments.UnpackValues(tx.Data) but this always results in an empty slice of values.