Skip to content

Commit

Permalink
docs: add various docs (#1345)
Browse files Browse the repository at this point in the history
* feat: add Choosing a Smart Account page

* chore: lint

* feat: benchmarks

* feat: add mav2 overview

* docs: update table to display diff from MAv2 as a percentage increase

* docs: adding in feature table and other account details

* docs: updating copy

* docs: updating multisig

* chore: cleanup gas benchmarks, remove runtime column

* docs: clarify safe 4337 module

* docs: remove sidebar link

* docs: remove repeated table, add details

* docs: mention ERC-4337

* docs: link audits, clarify legacy contracts

* docs: rename legacy to other

* docs: specify MAv2 breaking the sub-100k gas barrier

* chore: format

---------

Co-authored-by: Ava Robinson <[email protected]>
  • Loading branch information
Zer0dot and avarobinson authored Feb 12, 2025
1 parent ef1b3ae commit 199eee0
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 14 deletions.
62 changes: 49 additions & 13 deletions site/pages/smart-contracts/choosing-a-smart-account.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,64 @@ description: Learn about different smart account implementations to use with

# Choosing a Smart Account

## What is a Smart Account?
## Why Smart Accounts?

A smart account is an [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) smart account. You can use it to manage assets, execute transactions (known as `UserOperation`s), and more. There are many different implementations of a smart account, including [Modular Account](/smart-contracts/modular-account/) and [Light Account](/smart-contracts/light-account/).
Smart accounts are the key to unlocking the best online user experience ever had-- enabling features that have never been possible with traditional EOAs (externally-owned-accounts) like session keys, granular permissions, different authentication methods like email and passkeys, and much more.

We provide some of the cheapest accounts on the market. You should also consider [account deployement gas costs](https://github.com/alchemyplatform/aa-benchmarks) when choosing an account.
Beyond that, alchemy's Account Kit offers a simple & clean SDK to provide your users with top-tier ERC-4337 smart account features. With Account Kit's most powerful, most natively-supported account being Modular Account V2.

## Modular Account
MAv2 is the most fully-featured and efficient smart account out there, allowing for limitless modular expansion. All the while the account is secured by extensive [audits](https://github.com/alchemyplatform/modular-account/tree/develop/audits) as well as a [bug bounty on Cantina.](https://cantina.xyz/bounties/246de4d3-e138-4340-bdfc-fc4c95951491)

[Modular Account](/smart-contracts/modular-account/) is an enterprise-grade smart contract account designed from the ground up for ERC-4337. It is highly secure, gas optimized, and endlessly customizable with ERC-6900 plugins. With our pre-built plugins, it supports multiple owners (1-of-n), multisig thresholds (m-of-n), and session keys with scoped permissions.
MAv2 also strives to be maximally gas-efficient, being the **only** account where runtime deployment breaks the **sub-100k gas barrier**, which is cheaper than _one Uniswap swap_. For more details around MAv2, and for more sweet benchmarks, check out the [MAv2 overview!](/smart-contracts/modular-account-v2/overview)

Modular Account is the first [ERC-6900](https://eips.ethereum.org/EIPS/eip-6900) account implementation, making it infinitely extensible with custom plugins. Plug and play from a selection of existing plugins, including session keys and multisig, or write your own to customize the account for your app. We have created three pre-built plugins available today: [`MultiOwnerPlugin`](#TODO/smart-contracts/using-smart-accounts/transfer-ownership/modular-account), [`SessionKeyPlugin`](#TODO/smart-contracts/using-smart-accounts/session-keys/), and [`MultisigPlugin`](/smart-contracts/modular-account/multisig-plugin/). We're actively building new plugins and look forward to what new plugins you create!
## Modular Account V2

For most applications, we recommend using **Modular Account**. Suppose you have already deployed Light Account in the past. In that case, you can follow [Upgrading to a Modular Account](/smart-contracts/modular-account/upgrading-to-modular-account) guide to easily upgrade your account from Light Account to Modular Account using Account Kit and unlock an ecosystem of plugins for your smart account stack.
MAv2 is a zero-compromise smart account designed from the ground up for maximal security, modularity, and gas-efficiency. MAv2 abides by [ERC-6900](https://eips.ethereum.org/EIPS/eip-6900), meaning if you have a use case, there's probably a module for it-- and if there isn't, the simple, straightforward module interface ensures building new innovative features is a walk in the park.

Modular Account has been audited by both [Spearbit](https://github.com/alchemyplatform/modular-account/blob/develop/audits/2024-01-31_spearbit_0e3fd1e.pdf) and [Quantstamp](https://github.com/alchemyplatform/modular-account/blob/develop/audits/2024-02-19_quantstamp_0e3fd1e.pdf). It is fully [open source](https://github.com/alchemyplatform/modular-account) and supported by a [Bug Bounty](https://hackerone.com/alchemyplatform) program. It is [deployed](/smart-contracts/deployed-addresses) on multiple networks and their respective testnets.
By default, MAv2 includes a fallback validation. This allows a zero-customization setup where the account's owner (which, technically, could be another account!) has full control over the account. The fallback validation signer, or the account's owner, can be swapped or the entire validation can be disabled entirely in favor of one or more other validations.

## Light Account
Validations are themselves modules that define an authorization scheme with granularly managed control over the account. You could use a [WebAuthn validation](https://github.com/alchemyplatform/modular-account/blob/develop/src/modules/validation/WebAuthnValidationModule.sol) to support passkeys or biometrics for example.

[Light Account](/smart-contracts/light-account) is a collection of lightweight, production-ready [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) smart accounts. It builds on top of Ethereum Foundation's canonical [SimpleAccount](https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/samples/SimpleAccount.sol) to add key improvements such as ownership transfers, multiple owners, ERC-1271 signature support, and gas optimizations.
MAv2 also supports [EIP-7702](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md) out of the box, allowing EOAs to seamlessly turn into maximally expandable smart accounts.

It is fully [open source](https://github.com/alchemyplatform/light-account) and has been audited [multiple](https://github.com/alchemyplatform/light-account/blob/develop/audits/2024-01-09_quantstamp_aa8196b.pdf) [times](https://github.com/alchemyplatform/light-account/blob/develop/audits/2024-04-26_quantstamp_93f46a2.pdf) by Quantstamp. It is [deployed](/smart-contracts/deployed-addresses) on multiple networks and their respective testnets.
## Other Smart Accounts

## Use your own Account
While **MAv2** is the recommended choice, Account Kit also supports other audited and gas-optimized ERC-4337 smart account implementations:

Account Kit also makes it easy to use your own smart account implementation. To learn how, see our guide on how to [use your own account](/third-party/smart-contracts).
### [Light Account](/smart-contracts/light-account)

Light Account is a minimalist ERC-4337 smart account optimized for **low gas costs**. It is based on **Ethereum Foundation's SimpleAccount** but adds key improvements like:

- Ownership transfers
- ERC-1271 signature validation

While **Light Account is fully audited**, it does **not** support **advanced modular features like modules or session keys**.

### [Multi-Owner Light Account](/smart-contracts/light-account)

This account extends **Light Account** with support for **multiple owners**, allowing **shared control over an account** without needing a full modular setup.

### [Modular Account V1](/smart-contracts/modular-account)

Predecessor to Modular Account V2, this advanced account offers:

- ERC-6900 compatibility for custom extensibility
- Session keys
- Multisig plugin support
- Flexible ownership validation

### Account features

| Feature | LightAccount | MultiOwnerLightAccount | ModularAccountV1 | ModularAccountV2 |
| ----------------- | ------------ | ---------------------- | ---------------- | ---------------- |
| Multiple owners |||||
| Session keys |||||
| Multi-sig |||| 🔜 |
| Ecosystem modules |||||
| EIP-7702 support |||||
| Gas optimized |||||

## Bring Your Own Smart Account

If you have your own **ERC-4337-compatible** smart account, you can integrate it with Account Kit.
See our guide on [using a custom smart account](/third-party/smart-contracts).
56 changes: 56 additions & 0 deletions site/pages/smart-contracts/gas-benchmarks.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: Gas Benchmarks
description: See gas benchmarks for multiple popular accounts and how they stack up.
---

# UserOp Gas Benchmarks Table

Below is a collection of gas benchmarks resulting from the open-source [aa-benchmarks repository.](https://github.com/alchemyplatform/aa-benchmarks/blob/master/README.md) Each of these tables presents the gas costs for specific operations done via userOps-- the key feature of ERC-4337 account abstraction.

Note that these benchmarks are denominated in EVM gas units. For reference, a simple Uniswap swap without smart accounts typically costs in the ballpark of `150,000` gas.

## Deployment

| | Gas Cost |
| :------------------------- | --------: |
| Alchemy Modular Account v2 | `233,004` |
| Biconomy Nexus | `342,381` |
| ZeroDev Kernel v3.1 | `338,419` |
| Safe v1.4.1 | `435,486` |
| Coinbase Smart Wallet | `317,904` |
| Simple Account | `297,367` |

## Native Transfer

| | Gas Cost |
| :------------------------- | --------: |
| Alchemy Modular Account v2 | `158,725` |
| Biconomy Nexus | `164,351` |
| ZeroDev Kernel v3.1 | `190,912` |
| Safe v1.4.1 | `176,479` |
| Coinbase Smart Wallet | `156,812` |
| Simple Account | `151,045` |

## ERC-20 Transfer

| | Gas Cost |
| :------------------------- | --------: |
| Alchemy Modular Account v2 | `182,665` |
| Biconomy Nexus | `188,136` |
| ZeroDev Kernel v3.1 | `214,817` |
| Safe v1.4.1 | `200,732` |
| Coinbase Smart Wallet | `181,014` |
| Simple Account | `175,283` |

## Uniswap V3 Swap

| | Gas Cost |
| :------------------------- | --------: |
| Alchemy Modular Account v2 | `201,790` |
| Biconomy Nexus | `207,286` |
| ZeroDev Kernel v3.1 | `234,378` |
| Safe v1.4.1 | `220,464` |
| Coinbase Smart Wallet | `200,573` |
| Simple Account | `194,829` |

Take a look at more detailed benchmarks as well as $USD-denominated examples [here!](https://github.com/alchemyplatform/aa-benchmarks/blob/master/README.md)
53 changes: 53 additions & 0 deletions site/pages/smart-contracts/modular-account-v2/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Modular Account V2
description: An overview of the Modular Account V2 smart account.
---

# Modular Account V2 Overview

Alchemy's Modular Account V2 is the most robust and feature-rich smart account on the market with top-tier enterprise grade security. Being an ERC-6900 account, MAv2 can tap into a rich ecosystem of modules comprising different authentication methods like multisig or webauthn, as well as permissions and more!

With multiple developer-years of work and two comprehensive audits from [ChainLight](https://github.com/alchemyplatform/modular-account/blob/develop/audits/2024-12-03_chainlight_14afcd8.pdf) and [Quantstamp](https://github.com/alchemyplatform/modular-account/blob/develop/audits/2024-12-11_quantstamp_14afcd8.pdf), MAv2 is the most advanced smart account available:

- 40%+ reduced gas costs
- Rich ecosystem of modules from teams like Circle
- Super simple & clean developer experience

## Cost

Cost matters, so gas optimization was essential throughout the whole development process. As a result, MAv2 is one of the most optimized smart contracts ever written.

As an example, see the gas comparison for deployment execution costs below:

| | **Runtime gas for account creation** | **% More expensive than MAv2** |
| ------------------------------ | ------------------------------------ | ------------------------------ |
| **Alchemy Modular Account v2** | **97,764** | - |
| **ZeroDev Kernel v3** | 180,465 | 84.6% |
| **Safe (with 4337 module)** | 289,207 | 195.8% |

We have a whole host of open-source benchmarks [here!](/smart-contracts/gas-benchmarks.mdx)

At scale, these optimizations could save tens of thousands of dollars in gas fees if not more-- all without compromising on features or security.

## Modularity

Along with Circle, Trust Wallet, Quantstamp and the Ethereum Foundation, we've already developed multiple plug & play modules for use with ERC-6900 accounts like MAv2. Out of the box, on the validation side, MAv2 supports session keys, Webauthn validation (passkeys/biometrics).

On the permissions front, MAv2 already has first-class support for the following:

- Allowlists, ensuring a validation can only access what you want it to and nothing else.
- ERC-20 spend limits, think session keys with spend limits!
- Native spend limits, which take gas into account.
- Enforcing expiries, so your session keys can last as short or as long as you need them to.

Note that these features are only possible thanks to the modular nature of ERC-6900, as they're all separate modules. This also means it's possible to combine any number of modules to perfectly fine-tune your permission set.

Want a session key that's only valid for 24 hours, can only spend up to 0.001 ETH (incl. gas) and 100 USDC, all the while it's only able to authenticate calls to one specific address with one specific function? Go for it!

## Simplicity

Regardless of how feature-rich MAv2 is, it's all for nothing if it's not easy to use. The account standard MAv2 adheres to has over 5,000 words-- it's understandably intimidating. However, the depth of ERC-6900 allows each feature in MAv2 to be secure and ultimately extremely simple for you, the developer.

Leveraging the standard's lack of ambiguity, aa-sdk can safely create high-level zero-cost abstractions, which translate down to RPC calls exactly how you expect them to. No more fighting with your tools.

The SDK is designed from the ground up to get out of your way so you can focus on what matters-- building the best smart wallet experience for your app!
2 changes: 1 addition & 1 deletion site/sidebar/smart-contracts.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 199eee0

Please sign in to comment.