0

I often hear the following statement:

Contract Accounts cannot send Messages to EOAs. They can only:
  1. send Messages to other Contract Accounts
  2. send Ether to EOAs

... see, e.g., here: Are contracts able to send messages to EOA's?

This statement does not really make sense to me. According to the Ethereum Docs (see http://www.ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.html#what-is-a-message) a message contains: 1. the sender of the message (implicit) 2. the recipient of the message 3. VALUE field - The amount of wei to transfer 4. an optional data field 5. STARTGAS value

So when a Contract Account sends Ether to an EOA, it does so by sending a Message with an empty data field and containing the amount of Ether/Wei to be transferred in the VALUE field, right?

That is, Contract Accounts do send Messages to EOAs but the data field of these messages is empty, correct?

1

The true is that both statements are correct somehow.

A contract can attach a message when making a transfer to an external owned account. But the message is not easily accessible for an external account to read it.

pragma solidity ^0.4.19;

contract A {
    // Make a transfer to who and attach message m
    function bar(address who, bytes m) public payable returns (bytes32) {
        address a = who;
        uint l = m.length;
        uint v = msg.value;
        assembly {
            if iszero(call(gas, a, v, add(m, 0x20), l, 0, 0)) {
                revert(0, 0)
            }
        }
        return 0;
    }
}

An external account can detect if its balance has changed and from what transaction made the change. But to read the message it will have to execute the transaction.

  • "A contract can attach a message when making a transfer" ... I thought that Smart Contracts send "Messages" and EOAs send "Transactions" ... what is a "transfer"? I can't find anything about that in the Docs. Are you saying that there are 3 types of communication in the ethereal network: 1.Transactions 2. "Messages" 3. Transfers ? – steady_progress Apr 14 '18 at 16:08
  • In this context a transfer is a message where a value in ether is passed along with the message. You can think a transaction as a message from an EOA to another EOA or a contract. – Ismael Apr 14 '18 at 18:04
  • I know the following: 1. EOAs send "Transactions" (either to EOA or to Smart Contract) 2. Smart Contracts send "Messages" 3. Both Messages and Transactions can transfer Ethers ................ I do not know the following: Can Smart Contracts send "Messages" only to other Smart Contracts or also to EOAs? That is my question. – steady_progress Apr 14 '18 at 22:33
  • As stated in the answer: Yes, a contract can send a message to EOA, but it is very inconvenient for the EOA to read it or get a notification about it. I think no wallet has support for such type of messages. – Ismael Apr 15 '18 at 4:07

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.