- The concept of social recovery
- How it works in the EIP-4337 context
- The specific implementation details from SimpleAccountV2.sol
- Code examples from the contract
- Usage patterns and best practices
The document should be in English and follow a clear, technical style appropriate for developers and users of the Weber implementation.
```markdown:consensus-specs-1.4.0/docs/EIP4337/social-recovery.md
Social Recovery in EIP-4337¶
Introduction¶
Social recovery is a critical security feature for smart contract wallets that enables users to regain access to their accounts without relying on traditional private key backup methods. EIP-4337 (Account Abstraction) creates a foundation for implementing robust social recovery mechanisms within smart contract wallets.
Weber's implementation of EIP-4337 includes a comprehensive social recovery system that allows users to designate trusted individuals or entities (guardians) who can collectively help recover account access when needed.
Core Concepts¶
Guardians¶
Guardians are trusted entities (individuals, institutions, or even other smart contracts) that have the authority to participate in the account recovery process. The account owner designates these guardians in advance, establishing a security network for potential recovery scenarios.
Threshold-based Recovery¶
Rather than requiring all guardians to approve a recovery, the system uses a configurable threshold approach. This means that a pre-defined minimum number of guardians must approve a recovery request before it can be executed.
Recovery Process¶
The recovery process typically involves: 1. Initiation - A guardian starts the recovery process 2. Support - Additional guardians confirm their approval 3. Execution - When the threshold is reached, ownership is transferred 4. Confirmation - The new owner gains full control of the account
Weber's SimpleAccountV2 Implementation¶
Weber has implemented social recovery through the SimpleAccountV2
contract, which extends the base SimpleAccount
functionality with guardian management and recovery processes.
Guardian Management¶
The contract maintains a list of guardians and provides functions for the account owner to add or remove guardians:
Guardians can be removed by the owner, but only if it doesn't violate the threshold requirements:
Threshold Configuration¶
The account owner can set the minimum number of guardians required for a successful recovery:
Recovery Process¶
The recovery process in SimpleAccountV2 consists of three main steps:
- Initiation: Any guardian can initiate a recovery process by proposing a new owner address:
- Support: Other guardians can support the ongoing recovery process:
- Execution: When the threshold is reached, the recovery is automatically executed:
Cancellation¶
The current owner can cancel an ongoing recovery process:
Integration with UserOperations¶
The social recovery mechanism works seamlessly with EIP-4337's UserOperation model. When a recovery is executed, the new owner gains the ability to sign UserOperations for the account without requiring the previous owner's private key.
Best Practices for Social Recovery¶
-
Guardian Selection: Choose guardians carefully, considering both trustworthiness and availability.
-
Diversification: Select guardians from different social circles and/or institutions to reduce collusion risks.
-
Threshold Configuration: Set a threshold that balances security (higher threshold) with recovery convenience (lower threshold).
-
Guardian Education: Ensure guardians understand their responsibilities and how to participate in recovery.
-
Regular Review: Periodically review and update your guardian list and threshold settings.
Security Considerations¶
-
Guardian Compromise: If multiple guardians are compromised, an attacker could potentially gain control of the account.
-
Social Engineering: Guardians may be susceptible to social engineering attacks targeting the recovery process.
-
Threshold Setting: A threshold set too low increases security risks, while one set too high might make recovery impossible if guardians are unavailable.
-
Owner Notification: The implementation should consider notifying the current owner when recovery is initiated to prevent unauthorized recovery attempts.
Conclusion¶
Social recovery represents a significant advancement in smart contract wallet security, addressing one of the most challenging aspects of blockchain account management: key loss recovery. Weber's implementation of social recovery within the EIP-4337 framework provides a secure, flexible solution that balances security with usability.
By leveraging guardians and threshold-based approval, users can recover access to their accounts without relying on centralized services or compromising on security principles. This approach maintains the self-custodial nature of crypto wallets while providing practical solutions for real-world recovery scenarios. ```