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?

0

1 Answer 1

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.

4
  • "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 ? Commented Apr 14, 2018 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
    Commented Apr 14, 2018 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. Commented Apr 14, 2018 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
    Commented Apr 15, 2018 at 4:07

Your Answer

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

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