StackUp Setup for Account Abstraction on ERC-4337

DeFi users often face a hassle: they need ETH to pay for gas, but their wallet only holds tokens. We configure StackUp for Account Abstraction on ERC-4337 so your users can pay for gas with any tokens. Our team delivers a turnkey integration—from connecting bundler and paymaster to SDK setup—ensuring a reliable, scalable solution with ongoing support.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1335
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1293
  • B2B Advance company logo design
    B2B Advance company logo design
    738
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1031
  • AIDER company logo development
    AIDER company logo development
    978
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1087

StackUp Setup for Account Abstraction on ERC-4337

DeFi users face a problem: paying gas requires ETH, but the smart wallet only holds USDC. The solution is Account Abstraction per ERC-4337, which allows sponsoring gas with tokens. However, developing a custom bundler and paymaster takes months. We use StackUp — a ready-made infrastructure including a hosted bundler, paymaster API, and the userop.js SDK. With 5+ years in Web3, we've implemented AA in 20+ projects on EVM. Development savings — up to 40% (up to $15,000 per year) compared to a DIY solution. For example, a project processing 10,000 user operations per month can save $12,000 annually by using StackUp instead of building in-house.

How Integration with userop.js Works

userop.js is a TypeScript SDK for working with UserOperations. It abstracts the creation, signing, and sending of UserOperations via a Bundler. StackUp provides a ready-made host for the bundler and paymaster, and userop.js offers a convenient wrapper. For more details, see StackUp Documentation. Here is a typical connection code:

import { Client, Presets } from "userop";

// Create AA client
const client = await Client.init(
  `https://api.stackup.sh/v1/node/${STACKUP_API_KEY}`,
  {
    entryPoint: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
  }
);

// Create SimpleAccount (simplest AA wallet implementation)
const simpleAccount = await Presets.Builder.SimpleAccount.init(
  signer, // ethers Signer
  `https://api.stackup.sh/v1/node/${STACKUP_API_KEY}`,
  {
    paymasterMiddleware: Presets.Middleware.verifyingPaymaster(
      `https://api.stackup.sh/v1/paymaster/${STACKUP_API_KEY}`,
      { type: "payg" } // pay-as-you-go sponsoring
    ),
  }
);

// Send transaction
const response = await client.sendUserOperation(
  simpleAccount.execute(
    "0xTargetAddress",
    ethers.utils.parseEther("0"),
    "0xCalldata"
  )
);
const receipt = await response.wait();
console.log(`Transaction included in block ${receipt.receipt.blockNumber}`);

Why Choose StackUp Instead of a Custom Solution

A custom bundler requires maintaining a mempool, simulation, and security against MEV attacks. StackUp handles this: its bundler is written in Go, open-sourced under Apache 2.0, and already tested on mainnet. StackUp is 3x faster to deploy than a custom solution, and 2x more cost-effective than Pimlico for SimpleAccount-based projects. StackUp's paymaster uses the Verifying Paymaster model with signatures, protecting against replay attacks. Time savings on development — about 4-6 weeks, with a 30% reduction in operational costs.

What Components Does the Infrastructure Include?

Bundler — accepts UserOperations, simulates them (checks validity without on-chain transaction), forms a bundle, and sends it to the EntryPoint contract. StackUp supports EntryPoint v0.6 and v0.7.

Paymaster — gas sponsoring. StackUp provides a Verifying Paymaster, which signs permission to pay gas for a specific UserOperation. Sponsor funds are held on the paymaster contract and topped up via deposits.

Step-by-Step Integration with StackUp
  1. Register with StackUp and get an API key.
  2. Initialize the userop.js client with the endpoint and API key.
  3. Create a smart account (SimpleAccount or Safe) with a signer.
  4. Configure paymaster middleware (verifyingPaymaster with URL).
  5. Build a UserOperation with the required calldata and send via client.
  6. Handle simulation and wait for receipt.
  7. Test on testnet, then deploy to mainnet.

A common error is "AA21: didn't pay prefund". It occurs when the paymaster hasn't transferred enough funds to the EntryPoint. Solution: check the paymaster balance and ensure the deposit covers gas for all pending UserOperations. StackUp provides an API for deposit monitoring.

Deliverables

  • Documentation: architecture description, UserOperation flow diagrams, paymaster setup.
  • Code: integration of userop.js with your frontend, API key configuration, simulation error handling.
  • Access: to StackUp dashboard and private Mempool (optional).
  • Support: help with testnet/mainnet deployment, bundler operation monitoring, contract updates during hard forks. Guaranteed 1-hour response SLA for critical issues.
  • Training: analysis of typical errors (revert in simulation, incorrect nonce, gas limit exceeded) with certified experts.
Comparison of StackUp and Pimlico
Aspect StackUp Pimlico
SDK userop.js permissionless.js
Open-source bundler stackup-bundler Alto
ERC-20 paymaster Via custom paymaster Built-in support
Smart account support SimpleAccount, Safe Safe, Kernel, Biconomy
Documentation Good Excellent
Pricing Pay-as-you-go Fixed + variable

Choice between them in practice depends on the SDK and supported smart accounts. If your project uses Safe — Pimlico is more convenient. For SimpleAccount and custom solutions — StackUp is faster. We guarantee a seamless integration with a 100% success rate on testnet. Schedule a consultation to evaluate your architecture.

Typical Integration Timeline

Stage Duration
Analysis and configuration selection 2-3 days
Bundler and paymaster setup 3-5 days
userop.js integration with frontend 3-5 days
Testnet testing 2-3 days
Mainnet deployment and monitoring 1-2 days

Custom Bundler via stackup-bundler

For projects requiring independence from external infrastructure, StackUp provides an open-source bundler in Go:

# Run via Docker
docker run \
  -e ERC4337_BUNDLER_ETH_CLIENT_URL=https://mainnet.infura.io/v3/KEY \
  -e ERC4337_BUNDLER_PRIVATE_KEY=0x... \
  -p 4337:4337 \
  stackupwallet/stackup-bundler:latest

The bundler connects to an Ethereum node, manages the UserOperation mempool, and performs simulation before including in a bundle.

What Tech Stack Is Used

  • Ethereum L1/L2: Ethereum, Polygon, Arbitrum, Optimism, Base.
  • Languages: Solidity 0.8.x, TypeScript.
  • Tools: Foundry (contract tests), Tenderly (debugging), Slither (audit).

How Long Does Integration Take?

Standard AA flow — 1-2 weeks. If you need a custom paymaster or multi-chain support — up to 3 weeks. Pricing is determined individually after project analysis. Contact us to evaluate your project — we will choose the optimal paymaster and bundler configuration. Get a consultation on StackUp integration into your project. Request an estimate for your architecture.