3

In the metamask plug-in, when I click 'Send' there is a Transaction Data (Optional) blank at the bottom that I'm guessing I can put a hex string in that amounts to the {methodID:0xXXXXXXX, params:[X,A,B]}, but I'm not sure this is the case. enter image description here

If it is the case I don't know how to form the hex number. Is there some kind of converter in web3 that lets you set this up and then generate the hex transaction data?

6

I'm a MetaMask developer, and we've removed the field by default, since most new users were confused by it and would never use it.

It can be re-enabled in Settings for users who find it useful.

That field only accepts raw hexadecimal data, and it will be interpreted by whatever your recipient is.

Usually people form this data in one of two ways:

  • If they're writing a new smart contract, they generate this data using a compiler + an Ethereum client for forming the transaction.
  • If they're just interacting with an existing contract, they use a contract abstraction library (that usually requires the contract address + ABI), like ethjs-contract, truffle-contract, and they submit the transaction using MetaMask's web3 api that is injected in every page.

For more information on using the web3 API with MetaMask, check out the MetaMask Developer's FAQ.

  • Would this be the same format of 4bytes for the function name and then 32byte hex strings for each variable? Similar to what gets passed to CALL in contracts? – Austin Fatheree Jun 7 '17 at 19:28
  • @DanF, thanks for answer. I wonder why not let that transactional data be an optional field (only expand if people click on something like "advance") and then people can use it as a "note to a transaction" for most direct transfer, and for advanced developer who just want to perform some hex-data encoding, they can do it themselves easily as well? – Zainan Victor Zhou Nov 19 '18 at 1:39
  • The transaction data field is indeed optional. It is simply off by default. I've updated the comment to reflect this. – DanF Nov 20 '18 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.