[Ethereum] do contract transactions with metamask

metamasktransactions

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?

Best Answer

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.

Related Topic