Abstract
This ERC defines a smart account that authenticates a user operation with a post quantum signature. The account holds a self describing credential of a scheme identifier and a post quantum public key, it reads a signature of a scheme identifier and a post quantum signature from the user operation, and it verifies that signature over the user operation hash by calling the verification precompile for the named scheme. The encoding is crypto agile, so one account standard covers the module lattice and the hash based families and any scheme a later precompile adds, and a wallet reads the credential through a single interface to learn which scheme an account uses.
Motivation
Account abstraction lets an account define its own authentication, and ERC-4337 leaves the meaning of the signature field to the account. The signatures that accounts use today are elliptic curve signatures that a quantum computer breaks. The verification primitives for the post quantum replacements are arriving as precompiles, EIP-8355 for the module lattice scheme ML-DSA and a companion precompile for the hash based scheme SLH-DSA, but a precompile is a raw verifier and not an account.
Without a standard, every wallet that wants a post quantum account invents its own key encoding, its own signature layout and its own choice of scheme, and none of them interoperate. A wallet cannot read a third account to learn whether it is post quantum or which scheme it holds, a registry cannot index it, and a signer cannot be reused across tools. This ERC fixes the account layer so that a post quantum account from one wallet is a post quantum account everywhere, and so that the scheme an account uses is a value a contract can read rather than a private convention.
Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
Scheme registry
A scheme is named by a single byte. The byte selects the verification precompile, the fixed public key size and the fixed signature size. This document registers the following schemes, and a later EIP that adds a verification precompile MAY register a further byte.
| Scheme byte | Scheme | Precompile | Public key | Signature |
|---|---|---|---|---|
0x01 | ML-DSA-44 | EIP-8355 | 1312 | 2420 |
0x02 | ML-DSA-65 | EIP-8355 | 1952 | 3309 |
0x03 | ML-DSA-87 | EIP-8355 | 2592 | 4627 |
0x11 | SLH-DSA-SHA2-128s | the SLH-DSA precompile | 32 | 7856 |
0x12 | SLH-DSA-SHA2-192s | the SLH-DSA precompile | 48 | 16224 |
0x13 | SLH-DSA-SHA2-256s | the SLH-DSA precompile | 64 | 29792 |
Credential
The account holds a credential, which is the byte string scheme ++ publicKey. The scheme is a registered scheme byte and the public key is exactly the fixed public key size for that scheme. The credential is set when the account is created and MAY be replaced only through the account owner authorising the replacement with the current credential.
Signature
The signature field of the user operation is the byte string scheme ++ signature. The scheme MUST equal the scheme of the account credential. The signature is exactly the fixed signature size for that scheme. An account MUST reject a signature whose scheme does not match the credential or whose length is not the fixed size.
Interface
A conforming account implements ERC-4337 IAccount and the following interface, so that a wallet or a registry reads the scheme and the public key of any account.
interface IPostQuantumAccount {
/// @notice The scheme byte and the post quantum public key this account verifies against.
function postQuantumCredential() external view returns (bytes1 scheme, bytes memory publicKey);
}Validation
In validateUserOp the account MUST verify the signature over userOpHash as follows.
- Read
schemeandpublicKeyfrom the credential. - Read
sigSchemeas the first byte andsignatureas the remaining bytes of the user operation signature field. IfsigSchemeis not equal toscheme, or the length ofsignatureis not the fixed signature size forscheme, the account MUST treat the signature as invalid. - Call the precompile registered for
schemewith the inputpublicKey ++ signature ++ userOpHash, whereuserOpHashis the 32 byte hash. - The signature is valid when the precompile returns the 32 byte word one, and invalid otherwise.
On a valid signature the account returns the validationData value zero. On an invalid signature the account returns the validationData value one, which is SIG_VALIDATION_FAILED, and it MUST NOT revert on an invalid signature. An account MAY pack validUntil and validAfter into validationData as ERC-4337 defines.
Delegated accounts
An externally owned account MAY become a post quantum account by delegating its code to a conforming implementation through EIP-7702. The credential of a delegated account is stored by the implementation and the validation above is unchanged.
Rationale
Why a scheme byte
A single scheme byte in front of the key and in front of the signature makes the credential and the signature self describing, so a contract dispatches on a named scheme rather than on the length of a field. This is the crypto agility the migration needs. When a scheme is retired or a new precompile is added, the registry gains or loses a byte and no account format changes. The same self describing shape carried the post quantum signature builtins approved for Cardano, and it is the only way one account standard covers more than one scheme.
Why the account verifies against a precompile
An account cannot verify a post quantum signature in the Ethereum Virtual Machine at an affordable cost, so the verification is a precompile. The account holds the key, lays out the signature and chooses the scheme, and the precompile does the arithmetic. Keeping the account thin over a precompile means the account code is the same whatever the scheme, and the only cost that changes with the scheme is the gas of the precompile call.
Why both families
Registering both the module lattice schemes and the hash based schemes in one standard gives an account a choice between two unrelated hard problems, so an account can hold a hash based credential as a conservative anchor and a lattice credential where signature size matters. A standard that named only one family would force a second standard when the other family is needed.
Why a read interface
A wallet that receives a transfer to an account, a registry that indexes accounts and a tool that imports a signer all need to know whether an account is post quantum and which scheme it uses. A single view function that returns the scheme and the public key makes that a read rather than a guess, and it is the hook a wallet uses to show a user that an account is quantum secure.
Backwards Compatibility
The account is an ERC-4337 account and uses the signature field that ERC-4337 already leaves to the account, so it needs no change to the entry point or to the protocol. An account that does not implement the read interface is simply not a post quantum account under this ERC. The scheme registry depends on the verification precompiles, so a scheme is usable only on a chain where its precompile is present, and an account MUST be deployed with a scheme whose precompile the chain provides.
Reference Implementation
A reference account contract implements IAccount and IPostQuantumAccount, stores the credential, decodes the scheme and the signature, calls the precompile for the scheme and returns the ERC-4337 validation value. The reference contract and the test vectors for each registered scheme are published with this proposal, and the vectors are cross checked against independent implementations of ML-DSA and SLH-DSA.
Security Considerations
The authentication of the account is only as strong as the signature scheme named by its credential, and every registered scheme is a NIST standardised post quantum signature, so an account is secure against a quantum adversary when its credential names a registered scheme and the chain verifies that scheme correctly.
The account MUST verify the signature over the exact userOpHash that ERC-4337 binds to the chain id and the entry point, so that a signature cannot be replayed on another chain or through another entry point. A post quantum signature is large, so a bundler and a paymaster MUST account for the calldata and the precompile gas of a verification, and the account MUST return the failure value rather than revert on a bad signature so that gas estimation completes.
A credential replacement is a change of the key that controls the account, so an implementation that allows replacement MUST require the replacement to be authorised by a valid signature under the current credential, and MUST NOT allow a replacement that is not so authorised.
Copyright
Copyright and related rights waived via CC0.
