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?

1

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

  • If the destination address contains code then that code will get executed, right? And if it fails? – Anatoli Babenia May 12 '18 at 3:20
  • You see the transaction rejected in your node and blockchain exporer. – Mikko Ohtamaa May 12 '18 at 17:52
  • But is it recorded anyway? – Anatoli Babenia May 12 '18 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. – Mikko Ohtamaa May 14 '18 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.

  • The question is about existing non-contract address. Are there situations when such address is invalid? – Anatoli Babenia Apr 4 '18 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). – Lauri Peltonen Apr 4 '18 at 7:10
  • Edited the question for existing address. – Anatoli Babenia Apr 4 '18 at 7:19
  • What are these two ways to send stuff? I thought that there is only one way - create transaction and send it. – Anatoli Babenia Apr 4 '18 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/… – Lauri Peltonen Apr 4 '18 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, privacy policy and cookie policy

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