I'm trying to call a contract's deposit method using geth's eth_call. This function takes in value data in bytes:

  "from": "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3",
  "to":   "0xebe8efa441b9302a0d7eaecc277c09d20d684540",
  "gas":  "0x1bd7c",
  "data": "0xd459fc46000000000000000000000000000000000000000000000000000000000046c650dbb5e8cb2bac4d2ed0b1e6475d37361157738801c494ca482f96527eb48f9eec488c2eba92d31baeccfb6968fad5c21a3df93181b43b4cf253b4d572b64172ef000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000002b85c0c828d7a98633b4e1b65eac0c017502da909420aeade9a280675013df36bdc71cffdf420cef3d24ba4b3f9b980bfbb26bd5e2dcf7795b3519a3fd22ffbb2000000000000000000000000000000000000000000000000000000000000000238fb6606dc2b5e42d00c653372c153da8560de77bd9afaba94b4ab6e4aa11d565d858c761320dbf23a94018d843772349bd9d92301b0ca9ca983a22d86a70628",

In solidity, I would pass in abi.encodePacked(arc20Address, assetID, assetAmount, abi.encodeWithSignature("deposit()")) and it will convert those parameters into bytedata for me.

But since I'm using geth, I was wondering if there's a tool I can use that will do this for me?

1 Answer 1


If you have the contract's ABI you can use encodeABI.

If you don't have the contract's ABI then you can use web3.eth.abi.encodeFunctionCall, or combine some of the other functions from web3.eth.abi.*.

If you don't want to use web3js there is ethereumjs-abi that implements similar functionality.

But since you are using geth then you have to look at web3 v0.20 documentation, in particular getData. Also some of the answers here: Encoding/Decoding contract ABI data my help with web3 v0.20.

  • I was hoping i didnt have to use web3. But judging from the last link, it seems like i can use abi.hashex.org?
    – doctopus
    Commented May 18, 2021 at 14:19
  • @doctopus I've used abi.hashex.org in the past, it worked pretty well.
    – Ismael
    Commented May 18, 2021 at 18:57

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.