Alchemy Account Kit Integration: Smart Accounts in 2 Weeks
The Problem: Users Pay Gas from Their Wallet—a Barrier to Mass Adoption
Every time a new user wants to mint an NFT or swap a token in your dApp, they must have ETH in their wallet for gas. This cuts off up to 80% of the audience who doesn't want to bother buying a native token. Alchemy Account Kit solves this through Account Abstraction (ERC-4337): the user can pay gas in tokens, or you sponsor gas via Paymaster.
We have integrated Account Kit for several DeFi protocols and games. On one DeFi project, we reduced the onboarding flow from 5 clicks to 1, increasing registration conversion by 38%. Below, we break down how we do this—with code, comparisons, and typical pitfalls.
Components of Alchemy Account Kit
Light Account — a minimal ERC-4337 implementation. Cheaper to deploy and use than Safe. Supports: single owner, session keys, EIP-1271.
Modular Account — an extensible account based on ERC-6900 (Modular Smart Account). Allows adding plugins: multisig, spending limits, social recovery.
Gas Manager (Paymaster) — gas sponsorship with policies: by amount, by number of operations, by whitelist of contract addresses.
Alchemy Bundler — built-in bundler with 99.9% SLA and support for all major EVM chains.
Light Account vs. Modular Account: Which to Choose?
| Feature | Light Account | Modular Account |
|---|---|---|
| Standard | Basic ERC-4337 | ERC-6900 (modular) |
| Customization | Minimal, only owner | Plugins: multisig, spending limits, social recovery |
| Gas | Cheaper (single contract) | More expensive but flexible |
| When to use | MVP, simple apps | Complex logic, enterprise |
Why Use the Built-in Alchemy Bundler?
The bundler is the most critical component: it aggregates user operations, signs them, and submits to the network. Alchemy runs its own bundler with 99.9% SLA and support for all major L2s (Polygon, Arbitrum, Optimism, Base). After setup, synchronization with the network takes minutes, not days. For production, we recommend it—you get uptime guarantees and priority support.
How to Configure the Gas Manager (Paymaster)?
The Gas Manager sponsors gas via policies. In the Alchemy Dashboard, you create a policy, set limits, and receive a policyId. Example configuration:
Example setup in code (click to expand)
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { LocalAccountSigner, sepolia } from "@alchemy/aa-core"; import { http } from "viem"; const client = await createModularAccountAlchemyClient({ apiKey: "YOUR_ALCHEMY_API_KEY", chain: sepolia, signer: LocalAccountSigner.privateKeyToAccountSigner(privateKey), gasManagerConfig: { policyId: "YOUR_GAS_POLICY_ID", }, }); // Отправка user operation без ETH на кошельке const { hash } = await client.sendUserOperation({ uo: { target: contractAddress, data: encodeFunctionData({ abi, functionName: "mint", args: [] }), value: 0n, }, }); await client.waitForUserOperationTransaction({ hash }); After integration, the user doesn't notice that the transaction is paid—everything is covered by the dApp. Our clients save up to 40% on gas thanks to optimal policies.
React Hooks
Account Kit provides @alchemy/aa-alchemy/react with ready-to-use hooks:
import { AlchemyAccountProvider, useSmartAccountClient, useSendUserOperation, } from "@alchemy/aa-alchemy/react"; function MintButton() { const { client } = useSmartAccountClient({ type: "ModularAccount" }); const { sendUserOperation, isSendingUserOperation } = useSendUserOperation({ client, waitForTxn: true, }); return ( <button onClick={() => sendUserOperation({ uo: { target: NFT_ADDRESS, data: mintCalldata, value: 0n }, }) } disabled={isSendingUserOperation} > {isSendingUserOperation ? "Minting..." : "Mint NFT"} </button> ); } Session Keys
Account Kit supports session keys—temporary keys with limited permissions. The user approves the session key once, then the app can execute transactions without requesting a signature each time:
const sessionKey = await client.createSessionKey({ expirationTime: Math.floor(Date.now() / 1000) + 3600, // 1 hour permissions: [ { type: "contract", address: GAME_CONTRACT, functionSelectors: [MOVE_SELECTOR, ATTACK_SELECTOR], // only specific functions }, ], spendingLimit: parseEther("0.01"), // max 0.01 ETH per session }); This is especially valuable for games and applications with frequent small transactions.
How We Integrate Account Kit: Step-by-Step Process
| Step | Duration | Outcome |
|---|---|---|
| Analytics | 1-2 days | Gather dApp architecture, auth flow, transaction frequency, gas budget |
| Account type selection | 1 day | Decision: Light or Modular Account. If session keys needed, only Modular |
| Gas Manager setup | 2-3 days | Policies, budget, test on testnet |
| SDK integration | 3-4 days | Connect @alchemy/aa-alchemy, configure signer (Web3Auth, Privy, or email) |
| UI overhaul | 2 days | Replace "Send" button with component using useSendUserOperation |
| Testing | 2-3 days | Test reorg, insufficient gas, rejected operations with Tenderly |
| Deployment | 1 day | Publish to mainnet, monitor via Alchemy dashboard |
The entire cycle takes 1–2 weeks. We include documentation with code examples and team training.
What's Included in the Service
- Selection and customization of smart account (Light or Modular) — turnkey
- Gas Manager setup with sponsorship policies
- Integration with existing auth (email, social, Web3)
- Adaptation of React UI to Account Kit hooks
- Testing on testnet and mainnet
- Documentation and storybook of components
We have done dozens of integrations for DeFi protocols and NFT marketplaces. Alchemy Account Kit is a mature tool but requires deep understanding of ERC-4337. Get a free assessment of your project—contact us.
Typical Integration Mistakes
When integrating, it's important to avoid: using LocalAccountSigner in production (not safe—replace with Web3Auth or WalletConnect); neglecting nonce management (different from EOA); failing to test Gas Manager policies to prevent budget overruns. We account for these points in every project.
Order your integration today to boost your dApp's conversion. Contact us to discuss details.







