I'm using myContractInstance.myMethod.getData() to be able to serialize a transaction:

// Get the call data, so you can call the contract through some other means
var myCallData = myContractInstance.myMethod.getData(param1 [, param2, ...]);
// myCallData = '0x45ff3ff6000000000004545345345345..'

The transaction is later excuted later (by another person):

web3.eth.sendTransaction({"data": myCallData});

However, I want the other person, who will execute the transaction, to be able to decode myCallData, so they know that they're not transfering a huge amount. I can't find a way to do that in the documentation, however.

Is there a friendly way to decode myCallData, and make it readable again for the user (other than breaking up the data ABI pieces myself)?


  • Have you looked to see if RLP might offer something?
    – o0ragman0o
    Sep 1, 2016 at 13:09
  • RLP seems a bit over the top. I would follow the first example in the Contract ABI documentation, which describes how the data is encoded. Sep 9, 2016 at 8:29

1 Answer 1


The Ether value of the transaction is not part of this .getData(), it has to be set separately: web3.eth.sendTransaction({"data": myCallData, "value": 123});

On a different note, the user will need to trust the decoding tool. So why not offer a way for the user to replay this .getData() and confirm the byte-wise equality?

  • Hi @Xavier, with 'amount' I meant a custom value from my contract, not Ethers. It seems there's no other option than decoding the data myself, but I appreciate your note on trust, and your suggestion to let the user replay getDate() and compare the output. Sep 9, 2016 at 8:21

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.