ERC-4337 Integration Tutorial: How to Build with Account Abstraction & Etherspot SDK

ERC-4337 Integration Tutorial: How to Build with Account Abstraction & Etherspot SDK

Written by

Alexandra

September 12, 2025

Account Abstraction (ERC-4337) is reshaping how Web3 developers build dApps by enabling smart contract wallets, gasless transactions, and seamless onboarding.

As we explained in Account & Chain Abstraction: From Hype to Real Product Value, these innovations are central to achieving product-market fit and driving Web3 adoption. In this ERC-4337 integration tutorial, we’ll show you how to add account abstraction (ERC-4337 & ERC-7579) to your project using the Etherspot SDK — without rebuilding your entire architecture.

Getting Started with the Etherspot SDK for ERC-4337 & ERC-7579

Etherspot Infrastructure gives you everything you need to start working with Account Abstraction. It includes support for both ERC-4337 and ERC-7579, and comes with:

Modular SDK, Skandha Bundler, Arka Paymaster, Multi-chain APIs, Chain Abstraction Pulse SDK (coming soon).

Currently, Etherspot supports 25+ chains, including Ethereum, Optimism, Arbitrum, Base, Avalanche, Scroll, and more.

Install the Etherspot Modular SDK

The Etherspot Modular SDK is the entry point to our infrastructure. It lets you install and uninstall modules for an Etherspot ERC-7579 account, as well as interact with them directly.

Register on the Etherspot Developer Dashboard to get your API key.

Install the SDK with:

npm i @etherspot/modular-sdk – save
or
yarn add @etherspot/modular-sdk

Instantiate the SDK and Deploy a Smart Account

Import the SDK and set up your smart account with some of the following properties:

– walletProvider

– chainId

– chain (optional)

– bundlerProvider (optional)

– factoryWallet (optional)

const modularSdk = new ModularSdk(
privateKey: process.env.WALLET_PRIVATE_KEY,
{
chainId: Number(process.env.CHAIN_ID),
bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey, customBundlerUrl)
})

❗️To get your API key, simply sign up on the Etherspot Developer Dashboard.

That’s it! You can now call any of the Modular SDK functions.

To fully configure a bundler or paymaster for gasless transactions, check our documentation.

Alternative: Integrate with Etherspot’s TransactionKit

Another option is to integrate the Modular SDK through our TransactionKit, which includes it by default. You just need to install TransactionKit (and Viem) to get started:

# Using npm
npm install @etherspot/transaction-kit

# Using yarn
yarn add @etherspot/transaction-kit

# Using pnpm
pnpm add @etherspot/transaction-kit

Example of implementation:

const client = createWalletClient({
account,
chain: Chain,
transport: http(),
});

const kit = TransactionKit({
provider: client as WalletProviderLike,
chainId: Number(process.env.CHAIN_ID),
bundlerApiKey: process.env.ETHERSPOT_BUNDLER_API_KEY,
});

❗️Generate your API key on the Etherspot Developer Dashboard.

TransactionKit was built to make blockchain transactions feel effortless for developers. Instead of wrestling with low-level complexities, you get a clean, fluent API that’s both flexible and intuitive.

Some of the highlights include:

  • Chainable methods that let your code read naturally, almost like a sentence.
  • Lightweight by design, so your dApp only bundles what it actually uses, keeping things fast and lightweight.
  • Framework agnostic support, whether you’re building with React, Vue, Angular, or plain JavaScript.
  • TypeScript-first approach with full type safety and IntelliSense.
  • Built-in error handling that helps you avoid frustrating debugging sessions.
  • Batch transaction support makes it easy to send multiple transactions at once.
  • Debug mode for detailed logging when things don’t go as planned.

With just a few steps, your dApp is ready to leverage the full power of Account & Chain Abstraction through Etherspot.

For more details, check out our documentation, join the discussion on Discord, or book a call with our team if you’d like a deeper dive.


📢 Free censorship-resistant EIP-7702 Infrastructure

EIP-7702 opens the door for EOAs to gain Account Abstraction features without requiring users to migrate.

To support this shift, Etherspot and the Ethereum Foundation are developing and launching publicly accessible, censorship-resistant UserOp mempool nodes. The infrastructure includes:

  • Bundlers with native tracer support for faster execution
  • Seamless integration with popular Web3 libraries and 24/7 developer support
  • Redundancy across bundlers, sharing UserOps from both ERC-4337 and EIP-7702
  • Free access for any project or developer building on the EVM ecosystem

The rollout begins with Ethereum, Optimism, and Arbitrum, followed by World Chain, Base, Unichain, and Linea.

If you’d like to explore how this integration can benefit your product, reach out to us at [email protected].


FAQ: ERC-4337 Integration with Etherspot

Q: What is the Etherspot Modular SDK?
A: Etherspot introduced Modular Accounts compliant with ERC-7579. The Modular SDK is the way to integrate and customize these smart accounts in a dApp on top of account-abstraction (ERC-4337) infrastructure. Through the SDK, developers can create/manage modular accounts and attach modules that improve security and UX, for example:

  • Social recovery (restore access via a trusted device or guardians),
  • Allowance / spend-on-behalf (predefined token-spend limits per dApp),
  • Session keys (pre-approved actions for a limited time under set rules).

Q: How do smart accounts differ from EOAs in ERC-4337?
A: Smart accounts are programmable wallets enabled by account abstraction. Compared to EOAs, they support features like policy-based approvals, batching, social recovery, session keys, and gasless flows through paymasters.

Q: Can the SDK be used for gasless transactions?
A: Yes. Gasless experiences are enabled via ERC-4337 paymasters (sponsoring gas or accepting ERC-20 for fees via Arka Paymaster).

Q: Can I implement an ERC-4337 bundler via Etherspot’s SDK?
A: Yes. Etherspot’s Modular SDK provides access to Skandha, a reliable ERC-4337 bundler that integrates seamlessly with the Modular SDK. This allows developers to send UserOperations without managing low-level bundler logic directly, while still having the flexibility to connect their dApps to Skandha or run their own bundler instance if needed.


Get In Touch:

Website | XDiscord | Github | Telegram | Developer Portal

Powered by Etherspot

TransactionKit | PillarX | Pillar Wallet | Case Studies