ERC-7803 EIP-712 Account Abstraction Extension (EIP-712 Extensions for Account Abstraction)
Draft · Signatures & auth · created 2024-10-08
Lets a smart contract account use a signing domain when using EIP-712 signatures, preventing signature replay attacks and letting dApps and wallets coordinate signature authentication methods in advance.
Why it is needed
A smart contract account can have a single cryptographic key controlling multiple accounts. This can create a replay attack where a signature made for one account is reused on another account controlled by the same key, requiring a mechanism to bind a signature to a specific account. Reusing EIP-712's existing verifying domain mechanism for account binding greatly increases complexity and attack surface (ERC-7739), and it also fails to solve the problem of nested structures where one smart contract account controls another smart contract account. In addition, support for the contract signature standard ERC-1271 is inconsistent across protocols, with some contracts trying ECRECOVER first and others calling isValidSignature first, meaning that after EIP-7702 the same signature could be processed with an entirely different meaning. There is also no standard way for a dApp to tell a wallet which authentication method a protocol contract uses.
In depth
How the signing request is extended
Adds the optional properties signingDomains and authMethods to a typed data signing request made via eth_signTypedData in JSON-RPC or through a client library. Both properties are used alongside the existing properties types, primaryType, domain, and message. The signature returned in response to the request MAY be of any size, and since the signature's type cannot be known without authMethods, the signature MUST be treated as an opaque value.
Structure of signingDomains
signingDomains is an array of smart contract account domains. Each element is an object with two keys. types follows the same format as EIP-712's types and must include at least the EIP712Domain key, and domain is an object valid for the EIP712Domain type described in types. The array lists, from right to left, the chain of accounts through which the signer ultimately controls the outermost (first-listed) signing domain. Each time an intermediate account forwards the signing request, it prepends its own domain to the front of the array.
Encoding of the data to be signed
When signingDomains is present, the account encodes the message to be signed using the recursive procedure encodeForSigningDomains(signingDomainSeparators, verifyingDomainSeparator, message). If signingDomainSeparators is [first, ...others], it returns "\x19\x02" ‖ first ‖ encodeForSigningDomains(others, verifyingDomainSeparator, message); if it is an empty array, it returns encode(domainSeparator, message) as defined by EIP-712. signingDomainSeparators is the array of hashes of the domains included in signingDomains, in the same order, computed according to EIP-712's hashStruct.
Structure of authMethods
authMethods is an array of supported signature authentication methods, listed in the order the verifying domain attempts them. Each element is an object with an id and optional parameters. id is a string identifying the method, either ECDSA (an externally owned account's ECDSA signature) or ERC-{n} (a standard signature type specified by a particular ERC), where n must not be zero-padded. parameters is an array of method-specific parameters. This lets a dapp convey to the wallet what kinds of signatures a protocol contract authenticates and in what order.
Relationship to existing standards
ERC-1271 and ERC-6492 let applications authenticate a smart contract account's signature without knowing the account's internal rules. However, ERC-1271 requires the contract code to already be deployed at the time of authentication, and ERC-6492 extends this to support pre-deployment situations. Other approaches may emerge in the future. Meanwhile, the approach of reusing EIP-712's verifying domain for account binding (ERC-7739) carries high complexity and attack surface and does not solve the problem of accounts controlling accounts, which is why this ERC introduces signing domains separate from the verifying domain.
A Proposal in Draft Stage
This ERC is in Draft status. The original text's Rationale and Backwards Compatibility sections are still empty, and the Security Considerations section only notes that discussion is needed, so the content may change or be expanded in the future.