All ETH-transfers, including transactions, CALL
and SELFDESTRUCT
emit a log.
Logs are often used to track when balance changes of assets on Ethereum. Logs work for ERC-20 tokens, but they do not work for ETH. ETH transfers from EOAs can be read from the transaction list in the block, but ETH transfers from smart contract wallets are not automatically logged anywhere. This has already led to problems in the past, eg. early exchanges would often not properly support deposits from smart contract wallets, or only support them with a much longer delay. This EIP proposes that we automatically generate a log every time a value-transferring CALL
or SELFDESTRUCT
happens. We also add a similar log for transfers in transactions, so that all ETH transfers can be tracked using one mechanism.
MAGIC
: TBD
Whenever (i) a nonzero-value CALL
, (ii) a nonzero-value-transferring SELFDESTRUCT
, or (iii) a nonzero-value-transferring transaction takes place, issue a log, identical to a LOG3, with three topics: (i) MAGIC
, (ii) the sender address, (iii) the recipient address. The log data is a big-endian 32-byte encoding of the transfer value.
The LOG
of a value-transferring transaction should be placed before any logs created by EVM execution. The other two LOG
s are placed at the time that the value transfer executes.
This is the simplest possible implementation that ensures that all ETH transfers are implemented in some kind of record that can be easily accessed through making RPC calls into a node, or through asking for a Merkle branch that is hashed into the block root. The log type is compatible with the ERC-20 token standard, but does not introduce any overly-specific ERC-20 features (eg. ABI encodings) into the specification.
No backward compatibility issues found.
TODO
ETH transfers already cost a minimum of 6700 gas, which is much more expensive than the LOG3 opcode (1500 gas). Hence, this EIP does not increase the worst-case number of logs that can be put into a block. It will somewhat increase the average number of logs.
Copyright and related rights waived via CC0.