In the go-ethereum codebase, there's a type called CallMsg that's used in a number of cases, and the documentation says

// input data, usually an ABI-encoded contract method invocation

and it takes a byte array. As far as I can tell, if you want to interact with contracts programmatically with Go, using this type is usually involved. Given a Solidity contract, how would I use this to invoke a method on that Solidity contract?

  • Well I can't answer my own question yet but I've determined that this field should be compiled bytecode. I haven't figured out how to use it specifically yet though. Nov 14, 2017 at 0:25

1 Answer 1


The way to get the bytecode you need, given a Solidity contract, would be to use solc with the --bin option on your contract. Then it will output the bytecode you need. Additionally, abigen can handle this for you by using the --sol flag to generate Java or Go code that uses this bytecode.

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.