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
function isValidSigners(bytes[] signers) external returns (bool);: Checks whether the signer key formats to be used as guardians are valid.function getGuardianVerifierInfo() public view returns (bytes memory);: Returns information such as the signer key formats, signature formats, and hash algorithms this verifier supports.function verifyRecoveryPolicy( Permission[] memory permissions, uint64[] memory properties) external view returns (bool succ, uint64 weight);: Checks whether the submitted list of guardian signatures satisfies the recovery policy, and returns the success status and the value used to calculate the lock period.function getPolicyVerifierInfo() public view returns (bytes memory);: Returns the policy configurations and guardian attribute definitions this policy verifier supports.event RecoveryStarted(bytes newOwners, uint256 nonce, uint48 expiryTime);: Emitted when recovery begins and the candidate new owner and expiration time are recorded.event RecoveryExecuted(bytes newOwners, uint256 nonce);: Emitted when recovery is executed and the owner key is actually replaced.event RecoveryCanceled(uint256 nonce);: Emitted when an in-progress recovery is canceled.function DOMAIN_SEPARATOR_NAME() external view returns (string memory);: Returns the domain separator name used in EIP-712 signatures.function DOMAIN_SEPARATOR_VERSION() external view returns (string memory);: Returns the domain separator version used in EIP-712 signatures.function domainSeparatorV4() external view returns (bytes32);: Returns the domain separator hash used for EIP-712 signature verification.function updateGuardians(RecoveryConfigArg[] recoveryConfigArgs) external onlySelf;: Replaces the guardian list and recovery policy. Multiple recovery configurations can be set as an array simultaneously, and only the account itself can call this.function executeRecovery(uint256 configIndex) external;: Finalizes the pending state into an actual owner key replacement once the lock period has passed.function cancelRecovery(uint256 configIndex) external onlySelf InRecovering(policyVerifier);: Lets the account itself cancel an in-progress recovery.function cancelRecoveryByGuardians(uint256 configIndex, Permission[] permissions) external InRecovering(policyVerifier);: Cancels an in-progress recovery using guardian signatures.function isGuardian(uint256 configIndex, identity guardian) public view returns (bool);: Checks whether a given identity is a guardian under that configuration.function getRecoveryConfigs() public view returns (RecoveryConfigArg[] recoveryConfigArgs);: Returns the recovery configurations stored on the account.function getRecoveryNonce() public view returns (uint256 nonce);: Returns a recovery-specific nonce used to prevent replay attacks.function getRecoveryStatus(address policyVerifier) public view returns (bool isRecovering, uint48 expiryTime);: Returns whether a recovery is in progress and its expiration time.
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.