ERC-4430 Human-readable transaction description (Described Transactions)

Stagnant · Signatures & auth · created 2021-11-07

A technique in which a contract generates, alongside the bytecode that will execute the transaction, a human-readable description string, so that a wallet can show the user its content before signing.

Why it is needed

Today's wallets, except for common cases like ERC20 transfers, cannot show users the meaning of a transaction, so users end up signing binary data they cannot interpret. Data blinded by a hash, like ENS's commit(bytes32), is an even bigger problem, since the final transaction data alone reveals nothing about the original inputs, such as a name, address, or secret value, making a description impossible in principle. Since blinding is also common in L2 compression techniques, such cases will only increase going forward. Existing approaches like NatSpec have a language too complex to run in simple environments like hardware wallets, and format-string approaches lack the expressiveness to properly describe many transactions.

What to implement

In depth

Function signature and return values

The contract provides a function eipXXXDescribe(bytes inputs, bytes32 reserved) view returns (string description, bytes execcode). description is the human-readable string the wallet shows the user, and execcode is the transaction data that will actually be sent to the contract if the user approves. Since both are generated together in a single call, they are guaranteed to correspond to each other.

Executed in a static context

This method must be able to run in a static context, and side effects such as logX or sstore, even via indirect calls, may be ignored. In other words, the process of generating the description itself must not change chain state.

Fixing transaction context values

During evaluation, ADDRESS(to), CALLER(from), VALUE, and GASPRICE must match the values of the actual transaction being signed. This allows the code generating the description to trust and use these values.

Block context values and revert handling

During execution, BLOCKHASH, NUMBER, TIMESTAMP, and DIFFICULTY must be matched as closely as possible to the values of the "latest" block, and COINBASE must be the zero address. If the method reverts, the entire signing procedure must be aborted.

A technique for describing blinded data

ENS's commit(bytes32) records a hash on-chain that blinds a name and an address, and from the hash alone there is no way to know the original NAME and ADDRESS, making a meaningful description impossible. This standard solves this by taking the original pre-hash values (NAME, ADDRESS, SECRET) as inputs, generating a description such as "Committing NAME to ADDRESS (with SECRET)", and computing the corresponding commit(hash(name, owner, secret)) data at the same time. Since blinding is also used in L2 compression techniques, this approach is expected to become more important.

Binding the contract address to the signature

To prevent signed data from being replayed on a different contract, the contract address is implicitly bound to the data via the transaction's to field.

Differences from NatSpec, custom languages, and format strings

NatSpec-style approaches have a language too complex to run in simple environments like hardware wallets and require additional sandboxing. Custom languages carry the burden of having to rebuild expressiveness to handle the complexity of Ethereum transactions. Format-string approaches (e.g. the Trustless Signing UI Protocol) only have the expressiveness of a regular language, which is insufficient to describe many transactions. This standard avoids these limitations by making direct use of the EVM, which already exists.

Proposal status

This proposal is currently Stagnant, a proposal that has stalled without standardization being completed.

Things to watch out for

Original ERC · ← ERCs