Candide Wallet is a smart contract wallet for Ethereum Mainnet and EVM compatible rollups.
This repo includes the smart contracts used by Candide Labs.
- EIP-4337: Account Abstraction via Entry Point Contract
- Account Recovery
- Pay gas with ERC-20 using a Paymaster
In this section, we highlight and explain the SocialRecoveryModule.sol contract.
The Account Recovery module is designed to work for both a single-owner account and an n-m multi-sig account. In the case of the single-owner account, the signer key is typically stored on the user's device. More specifically, owners can add recovery addresses (also known as Guardians) to change the ownership of the account, in case their signer key is lost or compromised.
Recovery methods are typical Ethereum accounts. They can be:
- Family & Friends' contacts
- Hardware wallets
- Institutions
- Custodial services that offer cloud-based wallets
Normal operations of the Account do not require the approval of added Guardians in the module.
Owners of the account decide the threshold for the number of guardians needed for recovery, as well as the number of guardians. A typical single-owner account can have 3 guardians with a threshold of 2. This decreases the likelihood that a single guardian can overtake the account.
Owners are encouraged to ask their guardians to provide fresh addresses. This makes them private and eliminates the possibility of malicious guardians cooperating against an owner. By design, a guardian does not need to necessarily store value in their account to maintain their duties, even during a recovery process.
Once the recovery is initiated, the owners have until the delayPeriod
to cancel the recovery, if the initiation was done with malicious intent. Once the delayPeriod
is over, anyone can finalize the recovery to update the ownership of that particular Safe Wallet.
Account Recovery interfaces can be built with or without a backend service:
-
An interface without a backend service can simply let each guardian submit their signatures separately. Once the threshold is met, anyone can call execute recovery to start the recovery period.
-
An interface that leverages a backend service can aggregate guardians' signatures so that only the last guardian executes the transaction and pay gas fees. This is similar to how Safe's interface works when multiple owners for a multi-sig sign transactions before submitting them.
We assume that the signer key belongs to its real owner. The probability of the signer key being in control of someone else should be close to zero. Under this model, we can build a simple yet highly secure non-custodial wallet. To enable that model to evolve if needed, upgrading the wallet to a new implementation requires the approval of only the owner of the account.
Method | Owner | Guardians | Anyone | Comment |
---|---|---|---|---|
addGuardianWithThreshold |
X | Owner can add a guardian with a new threshold | ||
revokeGuardianWithThreshold |
X | Owner can remove a guardian from its list of guardians | ||
confirmRecovery |
X | Lets a single guardian approve the execution of the recovery request | ||
multiConfirmRecovery |
X | Lets multiple guardians approve the execution of the recovery request | ||
cancelRecovery |
X | Lets an owner cancel an ongoing recovery request | ||
finalizeRecovery |
X | Finalizes an ongoing recovery request if the recovery period is over. The method is public and callable by anyone |
yarn install
cp .env.example .env
yarn build
yarn test
certoraRun certora/conf/SocialRecoveryModule.conf
certoraRun certora/conf/GuardianStorage.conf
certoraRun certora/conf/RecoveryConfirmationSignatureValidity.conf
Note: You will need to install Certora CLI and a valid Certora Key for running FV. To provide a custom solc
path, use --solc
flag.
GNU General Public License v3.0