ERC-2848 Message Of My Own (MOM) (My Own Messages (MOM))
Stagnant · Other · created 2020-08-02
A decentralized bulletin board standard that uses Ethereum as a notarization layer for messages, embedding an operation code and a multihash of the message content in a zero-value transaction sent to oneself, without needing a smart contract.
Why it is needed
When developers or pool owners want to send notices to users, they usually rely on centralized social media such as Twitter or Discord. These channels can have their accounts hacked or suspended, and readers have no way to directly verify that the sender is actually the owner of the smart contract in question. Conversely, when users want to convey feedback to developers or a specific transaction sender, there is no address to send it to or established procedure. Storing messages directly in a smart contract carries large deployment and execution costs, and putting static data on-chain as-is is inefficient. In this situation, it is hard to easily verify the authenticity of a message, and there is no way to notice if content is tampered with or disappears.
In depth
Data structure of a MOM transaction
A valid MOM transaction must have `to` equal to the account that signed the transaction itself, and `value` must be exactly 0 wei. `data` must be at least 2 bytes, with the first byte being the opcode and the remaining bytes being the parameters defined by that opcode. If any of these conditions is violated, the client must not treat that transaction as a MOM transaction.
The principle that invalid transactions do not exist
Clients must not try to track or interpret transactions that do not strictly follow the standard as 'invalid MOM transactions'; they must ignore them completely. All parameters for each opcode are mandatory, and no optional parameters exist, so if even one is missing or breaks the rules, the entire transaction is ignored.
Core operations
ADD (0x00) adds a message to the list using a single multihash. UPDATE (0x01) replaces an existing message with a revised version using two multihashes. REPLY (0x02) adds a reply while preserving the relationship with the original message, using two multihashes. DELETE (0x03) requests that a message be hidden from the list using a single multihash; this does not actually erase the on-chain data but is the author's expression of intent that it is no longer valid. CLOSE ACCOUNT (0xFD) closes an account along with a multihash containing the reason, permanently invalidating all subsequent messages sent from that address. RAW (0xFF) is a message that does not declare a content type; clients should add it to the list but must not decode or display its content unless the user explicitly requests it.
Extended operations
ADD & REFER (0x04) and UPDATE & REFER (0x05) can be used to attach a specific address to a message, notifying that account's owner to read the message. ENDORSE (0x06) and REMOVE ENDORSEMENT (0x07) record or remove an endorsement mark similar to a like, and DISAPPROVE (0x08) and REMOVE DISAPPROVAL (0x09) conversely record or remove a disapproval. ENDORSE & REPLY (0x0A) and DISAPPROVE & REPLY (0x0B) add a reply while simultaneously recording an endorsement or disapproval. Clients must support all core operations, but may optionally support extended operations only to the extent they are interested in.
Content type and integrity verification
The default content type is UTF-8 markdown without a BOM (RFC 7763). Other types may be allowed to be interpreted, but in that case the client must show the user a warning that a non-default content type is being used. Content can be downloaded from a content-addressed network like IPFS or Swarm, or from an HTTP server; when received from an HTTP server, it must be checked against the on-chain multihash to verify content integrity.
Why smart contracts and on-chain storage are not used
Using a smart contract creates problems such as mistaking the contract address or having to redeploy on each network, and execution costs are much higher than a simple transfer. Using a contract merely to store static data is seen as a costly and nearly pointless antipattern. Also, if operations are embedded inside the message body itself, clients would have to download the entire content just to interpret it, wasting bandwidth and time, so the design places operations in the transaction data and references content only via multihash.
Proposal status
This proposal is in Stagnant status, a draft that remains with discussion halted.
Things to watch out for
- Caution about code execution when parsing payloads: When interpreting a user-created payload, clients must strictly follow only the opcodes defined in the standard and must not execute any non-standard commands unless the user explicitly permits it.
- Transactions that do not match the format are completely ignored: Transactions that deviate from the rules in any way must be treated as invalid MOM transactions and must not even be tracked, simply ignored.
- Warning for non-text content: It is recommended to block reading content that is not the default markdown text unless the user explicitly requests it.
- Verifying integrity of content received from a central server: When content is received from a central server rather than IPFS or Swarm, its integrity must be verified against the multihash, and if it cannot be verified, the user must be warned of that fact.