The fallback function may receive additional data (exposed in msg.data). How can I send a transaction with additional data in Remix?


I do not believe you can send data using Remix at this time. What you can do is use Metamask to perform the same action.

If you are calling the fallback function, then you can simply open Metamask, send a transaction to the contract, and include the data in the Hex Data field of the transaction form.

You can use other clients like MyCrypto as well, but I do not believe you can perform this action in Remix.



The accepted answer from above from shane is right that you cannot send data along directly in Remix even though you can do it with most wallets.

However, what you can do as a work-around is the following: create a very small contract in Remix, with a function that accepts an address, an amount and some data, like so:

pragma solidity >=0.5.0 <0.7.0;

contract sendData {

    function transferToWithData(address payable dest, uint amount, bytes memory data) public payable {


Once you have deployed this, you can call this function from within Remix with a recipient address, an amount and the data you would like to transfer. The contract will then send the amount including the data to the recipient address.

Test that it works

To test that this works, make a receiving contract like so:

pragma solidity >=0.5.0 <0.7.0;

contract receiveData {

    bytes public data;

    function () external payable {
        data = msg.data;

Then invoke the transferToWithData function with the 3 arguments, for example like so:

"0x72db24a976ebbf64cd2d3c14f30e6db4ea812440", 1000, "0x00112244"

where the address, of course, must be that of the receiveData contract.

Then invoke in Remix the automatically created getter data, which will give you 0: bytes: 0x00112244, meaning that the recipient got the data.

In most user wallets the recipient will be able to view it, otherwise the transaction itself on the blockchain should be consulted.

Warning about using call with value

Note that when sending value this way, the receiving account could call back on this function in ways you would not expect. It is not recommended to send value this way as described here.

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.