ERC-7093 Social Recovery Interface

Draft · Accounts & wallets · created 2023-05-29

A standard interface that, when a smart contract account's key is lost, allows the account owner's key to be replaced by collecting signatures from predesignated guardians. People without a blockchain account can also serve as guardians.

Why it is needed

If a cryptocurrency wallet loses its private key, access to its assets is lost. Social recovery, which entrusts account recovery to trusted people, has been proposed to prevent this, but without a common specification each wallet must implement it differently. In particular, when the method of verifying a guardian's identity and the recovery policy are hardcoded into the account contract, the account contract itself must be upgraded every time someone wants to use a new kind of guardian or different recovery rules. This standard proposes separating identity verification and policy verification from the recovery procedure, so that family or friends without a blockchain account, NFTs or SBTs, email signatures, and other diverse means can be used as guardians, and recovery policy can be changed without modifying the account contract.

What to implement

In depth

A design split into four components

This standard splits recovery functionality into Identity, PermissionVerifier, RecoveryPolicyVerifier, and RecoveryAccount (or RecoveryModule). Identity is the on-chain representation of a guardian and can hold anything verifiable on-chain, not just EOAs and smart contract accounts but also Webauthn/Passkey R1 keys, email DKIM signatures, OpenID tokens, zero-knowledge proofs, NFTs, and SBTs. PermissionVerifier defines how a guardian's signature or proof is verified, and RecoveryPolicyVerifier is an optional contract responsible for verifying recovery policy. RecoveryAccount holds the core logic of the recovery procedure, and in a modular design an external RecoveryModule plays the same role but must separate and isolate state per account.

Identity structure and two verification paths

Identity consists of a guardianVerifier address and signer bytes. If signer is empty, it means an EOA/SCA account type, and guardianVerifier becomes the actual signer address. In this case, use of a safe library or built-in function that can verify both ECDSA and ERC-1271 signatures is recommended, to prevent vulnerabilities such as signature malleability attacks. If signer is not empty, it means a non-account type, and the contract at the guardianVerifier address is called through the IPermissionVerifier interface, verified via isValidPermission(hash, signer, signature).

Composing recovery policy from properties and thresholds

GuardianInfo attaches a uint64 property to each guardian, and its meaning (weight, percentage, weighted role, etc.) is defined by the linked RecoveryPolicyVerifier. ThresholdConfig is a pair of a threshold value and its corresponding lock period, lockPeriod (int48). RecoveryConfigArg bundles one recovery configuration consisting of an optional policyVerifier address, a guardian list, and a threshold configuration array, and multiple configurations can be registered via updateGuardians. In the original example, when the sum of properties of the signing guardians is 60, since it exceeds threshold 50 but not 100, a 24-hour lock period applies. If the sum is 100 or more, recovery happens immediately with no lock.

The role of verifyRecoveryPolicy

verifyRecoveryPolicy(permissions, properties) on IRecoveryPolicyVerifier verifies whether the submitted list of Permissions satisfies the recovery property requirements. For each matched guardian, it performs computations such as weight accumulation or role-based tallying according to the corresponding property in the properties list. Verification includes checking that each guardian exists in the guardian list and that there are no duplicates. It returns success status along with a value so the account can determine the lock period. This policy verifier is optional, so designs that do not need policy abstraction can skip it.

EIP-712 signatures and a dedicated recovery nonce

It is recommended that the message a guardian signs use EIP-712 typed signing. Because the signed content is human-readable, the guardian can confirm and sign only after checking that verifyingContract is the user's correct RecoveryAccount address, that the contract name, version, and chainId are correct, and that fields such as newOwners match the values the user communicated. Also, recoveryNonce exists to prevent replay attacks where a guardian's permission is maliciously reused; since recovery is an account-layer function, it is recommended to keep it separate from the nonce used for asset transactions.

Why using an external verifier is still safe

According to the design rationale, bringing in an external Verifier contract is meant to avoid touching the recovery logic unique to RecoveryAccount. It explains that because the Verifier's logic is designed to be simple and clear with a fixed call format, the security risk that comes with integrating an external contract can be managed. Because recoveryConfigs are core account data, access and modification rights must be carefully managed and isolated, and no restriction is placed on storage method or count, ensuring flexibility of implementation.

A proposal still at the draft stage

This ERC was created on May 29, 2023 and is in Draft status. The reference implementation is TBD, and the security considerations section only states that discussion is needed, so the interface and details may change or stalling may occur going forward. It references ERC-1271 as a requirement.

Original ERC · ← ERCs