Halborn Logo

// Blog

Smart Contracts

What Is a Smart Contract Wallet?


profile

Rob Behnke

January 12th, 2023


Many cryptocurrency users often face a dilemma when choosing options to store funds: use a custodial or non-custodial wallet? Custodial wallets (issued and controlled by centralized exchanges) promise ease of use but require trusting a third party. Non-custodial wallets offer security and reduce trust assumptions, but are difficult to use for average users.

But what if there was another means of storing cryptocurrencies that provides ease of use and security? Smart contract wallets are designed for this purpose. This article will explore smart contract wallets in detail: how they work and what benefits and drawbacks users should expect. 

How do smart contract wallets work?

A smart contract wallet is a wallet managed by a contract account instead of an EOA (Externally Owned Account). A brief refresher on the types of Ethereum accounts:

Contract Account: A contract account is controlled by logic programmed into the code. It has no associated private key and cannot initiate transactions, but it can execute operations (eg. calling another contract or transferring funds) after receiving transactions from an EOA. 

Externally Owned Account (EOA): An Externally Owned Account (EOA) is controlled by an associated private key. The key holder can initiate transactions with an EOA or contract account as the recipient. EOAs are limited to basic functionalities (e.g., transfers) since no code is stored in the account’s state. 

Many wallets today are managed by EOAs, which is how users can transfer Ether (ETH) and other tokens from a wallet by signing transactions with a private key. In contrast, smart contract wallets (also called smart wallets) are controlled by contract code instead of a private key. 

The contract code defines how funds can be accessed, by whom, and under what conditions. Moreover, as smart contracts are programmable, smart wallets are often designed with more advanced features than traditional wallets. 

While smart contract wallets work differently, most share a similar workflow to the process described below:

1. After signing up with a smart contract wallet provider such as Argent or Instadapp, a new wallet contract is deployed on the Ethereum network. Note that the user needs to sign up for the service with their regular EOA. 

2. The user’s original EOA is set as the owner or admin of the contract account tied to the smart wallet. Thus, to access funds stored in the wallet, users initiate a regular transaction, and sign with their private key, with the wallet contract as the target. Since the smart contract stores the user’s wallet address, it can easily verify if a new request comes from the owner. 

3. Many smart contract wallets offer users the option to skip paying gas (denominated in ETH) for transactions. This is possible through meta-transactions in which a user signs a transaction off-chain, while a third-party (called a relayer) broadcasts it on-chain for execution. Typically, users can refund the relayer in ETH or tokens (automatically deducted from the smart contract wallet). 

Benefits of smart contract wallets 

Ease of use

Smart contract wallets require less effort to use than traditional wallets. For example, smart wallets like Argent can be recovered without a seed phrase. This process, described as social recovery, works by letting users set some trusted parties (e.g., friends and family) as “Guardians”. 

If a user’s phone is lost or stolen, a new operation changing the ownership of a smart contract wallet can be initiated and signed by a quorum of guardians. This way, users don’t need to memorize long mnemonic phrases or take great pains to store seed phrases in a safe place. 

Advanced security features

The programmable nature of smart contract wallets lets developers design complex safety features to protect user funds. In comparison, the safety of an EOA-controlled wallet relies solely on the security of the private key—if the key is lost or stolen, users have no way of accessing funds. 

For instance, some smart contract wallets allow users to set daily limits on transfers, limiting the possibility of attackers stealing all funds in one transaction (i.e., after stealing a user’s private key). Other security features available on smart wallets include:

  • Requiring trusted parties to approve transactions
  • Allowing a trusted party to lock the smart wallet if the owner’s device is misplaced or compromised
  • Creating a whitelist of addresses that can receive funds from a wallet 
  • Using two-factor authentication (2FA) to protect against unauthorized wallet access 

Access to complex functionalities

Having a wallet built as a smart contract provides access to more complex functionalities like interacting with DeFi applications. DeFi Saver and Instadapp are two examples of smart wallets designed for advanced use cases. 

Both wallets come with integration to on-chain lending and trading markets (e.g., Compound, Uniswap, and Maker) and let users perform complex interactions, and batch multiple calls, in one operation. As an example, DeFi Saver offers “recipes”—bundled actions that allow for, say, borrowing Dai from Maker or contributing liquidity to Compound Protocol. 

With a regular wallet, users are limited to basic payments and must undergo a cumbersome process when interacting with DeFi applications. Smart contract wallets integrate with dApps seamlessly, making them a better option for expert users. 

Disadvantages of smart contract wallets   

While smart contract wallets certainly have many benefits, they also have a few drawbacks. The disadvantages of smart contract wallets can be grouped broadly under security risks and administrative overhead. 

Smart contract wallet security risks 

Errors in smart contract code

Smart wallets rely heavily on smart contracts, which increases the attack surface for users. For example, a bug in the wallet contract might leave users unable to access funds, while a vulnerability in contract code can lead to attackers stealing funds from the wallet. 

Private-key wallets are much simpler and less susceptible to various security issues that can affect a smart contract’s operation. As long as the private key remains safe, no one can transfer funds out of the wallet without the user’s approval. This is true, even if the underlying blockchain suffers a 51% attack

Malicious counterparties 

Unlike an EOA wallet exclusively controlled by a single user, smart contract wallets rely in part on other (trusted) third parties to work properly. This may include accounts participating in multisignature validation and account recovery/locking as well as transaction relayers. While this setup is crucial for smart wallet operations, it can introduce counterparty risk—especially if those parties act maliciously. 

Malicious relayer: A malicious relayer can censor a user’s transaction by (a) refusing to execute transactions and (b) griefing users by using a small amount of gas such that some part of the call, but not all, executes. In the latter case, the transaction would revert on-chain, but users would still be required to pay for gas used. 

Malicious guardians: Argent pioneered the use of guardians—trusted parties that can validate transactions and control access to a user’s account. This can, however, cause problems if one or more guardians are malicious. A set of malicious guardians can take some or all of the following actions:

  • Refuse to approve transactions that require a threshold of signatures to execute 
  • Refuse to participate in account recovery and deny users access to funds  
  • Collude to transfer ownership of the wallet to another account (which is not controlled by the user) and authorize illegal withdrawals/transfers 

Administrative overhead 

Using smart contract wallets involves a steeper learning curve than regular wallets. Users must get used to performing actions like requiring approval for transactions, granting and revoking access to trusted accounts, using relayers, and so on. 

Furthermore, using a smart contract wallet often requires users to pay more gas when executing transactions. Transactions from contract wallets have more data and trigger more complex computation in the EVM. Storage and compute resources are expensive, which explains the high costs associated with using smart contract wallets. 

Conclusion 

Smart contract wallets represent a breakthrough in wallet technology—one that combines ease of use and efficiency with security. Importantly, smart wallets decrease the difficulty of self-custody for new cryptocurrency users and reduce the complexity of interacting with DeFi protocols. 

Nevertheless, smart wallets still have their drawbacks as in the article. From counterparty risk to flaws in contract code to administrative overhead, smart contract wallets are riskier than simple EOA-controlled wallets. Smart wallet owners are also not immune to classic attacks like phishing or private key theft that can result in lost funds. Some of these risks can be mitigated—for example, by using trusted relayers and ensuring that wallet contracts have been extensively audited. Moreso, you can avoid counterparty risk by using another account (e.g., a Ledger/Trezor wallet or MetaMask account) as a trusted party instead of another human. Finally, the same best practices for protecting traditional wallets (e.g., keeping private keys safe) apply to smart contract wallets.