thirdweb Modular Smart Accounts Powered by ERC-7579

thirdweb Modular Smart Accounts Powered by ERC-7579

Ever wanted to build a fully custom smart wallet with next-generation capabilities?

You might have heard of thirdweb Smart Accounts, built on the ERC-4337 standard. These types of web3 wallets are a step up from their traditional counterparts, offering programmability, batch transactions, and social recovery. But with combining this technology with modular contracts, smart accounts just got even smarter. 

Introducing thirdweb modular smart accounts powered by ERC-7579; a combination of modular contracts and account abstraction wallets

Confused? No need to be, let’s explain how each piece works:

What Are Smart Accounts?

Smart accounts are wallets powered by smart contracts that follow the ERC-4337 standard, otherwise known as account abstraction wallets. Unlike traditional wallets (EOAs) that rely on private keys, smart accounts use programmable logic to enhance functionality. They allow you to interact with the blockchain while staying secure and offering customizability. 

Smart wallets stand out from other web3 wallets since they:

  • are programmable, providing custom logic so wallets can execute specialized functions.
  • offer gas sponsorship; removing onboarding barriers for all users
  • introduce simple social and multi-signature recovery, allowing users to recover accounts without seed phrases.
  • can batch transactions; unlocking transactions at scale.

What Are Modular Smart Accounts (ERC-7579)?

Modular Smart Accounts expand the functionality of traditional smart accounts by allowing devs to add, remove, or upgrade specific features.  This is achieved by creating interoperable modules for smart account contracts using the ERC-7579 standard.

What is ERC-7579 and how does it work?

ERC-7579 compliant smart accounts improve interoperability and make it easy for developers to update, migrate and add functionalities to smart wallets. That said, the standardization that makes them interoperable also limits their flexibility.

For more information, check out the full details of the ERC-7579 standard here.

Like other modular contracts, modular smart accounts using the ERC-7579 standard have two main components. 

Firstly, they rely on a Core Contract which provides the base contract implementation that supports extensions; and secondly, they use Extensions that add specific functionalities to the core contract.

thirdweb Modular Smart Accounts

With thirdweb's Modular Account Factory, developers can create accounts designed specifically for their app needs programmatically. Extensions, like the Default Validator Module, offer additional functionality. Plus, they are compliant with the ERC-4337 standard, enabling features such as transaction validation and gas sponsorship. 

Why use Modular Smart Accounts?

Modular Smart Accounts implementation helps to solve real-world problems such as:

Adding Custom Features

Modular smart accounts allow you to install modules to add functionality specifically for each dApp. Deliver better user experience with advanced features like gas sponsorship. Or improve your app’s security with a module unlocking multisig capabilities.

Future-proofing Accounts

Modular smart contracts let you adapt to changing needs through upgrades. Simply upgrade accounts to implement new features or roll out bug fixes.

Onboarding

Modular smart Accounts support gasless transactions and social media log-ins, improving user experience, especially for non-crypto natives.

Development Simplicity

Modular smart accounts are easy to implement, fit together, and start using immediately. Plus, they are customizable! thirdweb’s modular smart accounts simplify development with reusable components and personalized modules.

How to Implement Modular Smart Accounts with thirdweb

We can easily create a new account for a user for any EVM chain, we need to specify:

  • The Factory Contract Address
  • Validator Contract Address (This is the Basic Module). 
import { sepolia } from "thirdweb/chains";  
import { smartWallet, Config } from "thirdweb/wallets/smart";  

const modularSmartWallet = smartWallet(  
  Config.erc7579({  
    chain: sepolia,  
    sponsorGas: true,  
    factoryAddress: "0x...", // the 7579 factory address  
    validatorAddress: "0x...", // the default validator module address  
  })  
);  

We can also integrate the smart account directly into thirdweb’s Connect Button as follows:

<ConnectButton  
  client={client}  
  accountAbstraction={  
    Config.erc7579({  
      chain: sepolia,  
      sponsorGas: true,  
      factoryAddress: "0x...", // the 7579 factory address  
      validatorAddress: "0x...", // the default validator module address  
    })  
  }  
/>  

How Modular Smart Accounts Work? 

The Modular Account Factory creates new smart accounts by calling the createAccountWithModules function, it deploys a new smart account with specific modules:

  • Owner: The wallet’s admin.
  • Salt: A unique value for deterministic deployments.
  • Modules: a list of the compatible extension addresses that will be installed on the account. 

The Default Validator Module ensures the account supports ERC-4337 features, such as bundling transactions and validating user operations. 

Modular Smart Accounts: Next-Gen Programmable Wallets

Modular smart accounts are the next generation of programmable wallets you can use to enhance your development cycle and implementation of in-app wallets for user users. This approach helps you to ease the onboarding process, sponsor gas transactions and adapt the functionalities with modules and upgradeability.

Be sure to try the new implementation and happy coding!