2

Metamask allows to attach data to any transaction. What happens if I send some data with some ETH to existing non-contract address? Is that data recorded on the blockchain? Can I read it later?

3 Answers 3

1

Yes. Data payload is recorded regardless if the destination address contains code or not.

4
  • If the destination address contains code then that code will get executed, right? And if it fails? May 12, 2018 at 3:20
  • You see the transaction rejected in your node and blockchain exporer. May 12, 2018 at 17:52
  • But is it recorded anyway? May 12, 2018 at 21:40
  • Everything you push out to blockchain network is public and likely to be recorded, even though your own node would not store this persistently. May 14, 2018 at 14:03
2

Whenever you send a transaction it is recorded on the blockchain. So, yes, it can be read from the blockchain.

If the destination is invalid in some sense, the data & Ether get simply lost.

Bear in mind that not only contract addresses are valid - you can also send Ether to wallet addresses.

5
  • The question is about existing non-contract address. Are there situations when such address is invalid? Apr 4, 2018 at 7:04
  • Ah, you failed to mention about 'existing' part. So I assume you mean wallet address? Then it should end up in the wallet if you send it properly (there are two ways to send stuff, unsure how Metamask differentiates between them). Apr 4, 2018 at 7:10
  • Edited the question for existing address. Apr 4, 2018 at 7:19
  • What are these two ways to send stuff? I thought that there is only one way - create transaction and send it. Apr 4, 2018 at 7:20
  • Yes, everything uses transactions, but internally there are different ways - but they are not relevant for you unless you do some programming (Solidity for example). Couldn't find a proper article now, but here's some info: reddit.com/r/ethereum/comments/45xeiw/… Apr 4, 2018 at 7:25
1

Answering my own question. I managed to send transaction to non-contract address with some ETH and single byte of data:

Previously that didn't work, because storing data needs gas, and Metamask did not calculate gas limit automatically. I set gas limit to 42000 - double the size of simple transaction for just moving ETH - and it consumed 21068 gas. So I assume that storing 1 byte is 68 gas on top of standard 21000 sending cost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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