How can I send a message to another Ethereum address? And how would that user receiving know that its a message? Is there an Ethereum wallet that will show that I sent a message to that address? And what is the max size I can send?

So it is only possible to send HEX data in the data field. This will not be a standard transaction but will require you to use geth or MyEtherWallet's offline transaction tab or somewhere that allows you to access and edit the data field.

Google and visit an ascii->hex site and type your message. Then, copy the hexadecimal output, and remove all the spaces in that hexadecimal output. Then paste it into the data field.

On etherscan, you can click the "convert to ascii" at the bottom of any TX that has data. Not all data is ascii data though, so it will be gibberish sometimes.

I sent a demo here. Under "payload", you can see the HEX data on the left and the ASCII on the right.

Additionally, you will need to increase the gas a bit in order to get the transaction to successfully go through. It cost 23,040 gas for the short message of "myetherwallet.com is the best". For reference, 21000 gas is the rate for a standard transaction. A longer message would need more gas.


As euro10 pointed out in the comments (but it's a bit hard to read), you can actually use built-in ascii -> hex if you are using geth:

eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[1],value:web3.toWei(1‌​00,'finney'),data:web3.toHex('John Doe sent you a message')})

  • 4
    you can use the built-in ascii to hex should you use geth : eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[1],value:web3.toWei(100,'finney'),data:web3.toHex('John Doe sent you a message')}) you can see here etherchain.org/tx/… – euri10 Mar 31 '16 at 6:39
  • 1
    It's much easier than this. In the Mist browser, you can just copy and paste your hex string there. It recalculates gas, etc. Rapid Tables is a good site for converting text to hex. This is basically what I did here: medium.com/@tjayrush/… – Thomas Jay Rush Aug 29 '16 at 16:21
  • 2
    Must I use ASCII? UTF-8? – Mergasov Dec 26 '16 at 0:59
  • 2
    How can I receive message? Any sample js code? – Stepan Yakovenko Jul 12 '17 at 15:22
  • @tayvano, Can you please provide sample code to read the message? – Pratik Gaikwad Oct 30 '17 at 2:17

By sending a message, I assume you mean you want to send some form of a text based message to another user...

  • You can send a message as part of the data field in a transaction.
  • For the user to know you actually sent them a message, you could use the web3.js api to listen and extract messages from a transaction. You'd then have to decode it to ascii to make it human readable.
  • I'm not aware of a wallet that will show you sent a specific message to an address, but a wallet such as Mist will show you sent a transaction to a given address
  • I believe there is a max size for transaction (which would include your message). I'm not positive, but I think it's currently around 80kb...?

And alternative to the approach above is to use a contract to post an event to the blockchain. A client can then listen for these specific events again using the web3.js api.

Here's how you would do it with the web3 api.

const Utils = require('web3-utils');
let txTransfer = {};
txTransfer.from = from.address;
txTransfer.to = to.address;
txTransfer.gas = GasLimit;
txTransfer.value = amount;
txTransfer.data = Utils.toHex('free text data');
web3.eth.sendTransaction(txTransfer);

I have a working example on the blockchain at this transaction 0x99f537b788c1e0c9513735c644921ffa423f8bd20ce45165403e8f12942aaca8. The ascii data in the transaction was the same JavaScript used to send the transaction.

web3js v1.x.x { const txParams = { nonce: nonce, gasPrice: gasPrice, gasLimit: gasLimit, to: to, value: value, data : web3.utils.toHex('rockstar blockchain developer'), // EIP 155 chainId - mainnet: 1, ropsten: 3 chainId: 4 }

            const tx = new ethereumTx(txParams);

            tx.sign(privateKey);
            const serializedTx = '0x'+tx.serialize().toString('hex')

            console.log("serializedTx" ,serializedTx );
            web3.eth.sendSignedTransaction(serializedTx);

Tx hash of successful example on rinkeBy test net 0xbc5ef9dc8da24c90d5910d93419f9746f3fe318cb2f2b5e7c873e64264bfcf53

  • Honest question, why use sendSignedTransaction instead of just sendTransaction? What benefits does the signed one have? – adrianmc Jul 27 at 16:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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