Account Abstraction
How embarkAI uses ERC-4337 account abstraction for smart wallet functionality.
embarkAI smart wallets are built on the ERC-4337 Account Abstraction standard. Instead of relying on externally owned accounts (EOAs) controlled by a single private key, every embarkAI wallet is a smart contract with programmable transaction logic, gas sponsorship, and batched calls.
What is Account Abstraction?
Account Abstraction (AA) decouples transaction validation from Ethereum’s native protocol. With ERC-4337, smart contract accounts can define their own signature schemes, pay gas on behalf of users, and execute multiple operations atomically — all without changes to the consensus layer.
Key Concepts
| Concept | Description |
|---|---|
| Smart Account | A smart contract that acts as a user’s wallet, with custom validation logic |
| UserOperation | A pseudo-transaction object that describes what the smart account should execute |
| EntryPoint | A singleton contract that validates and executes UserOperations on-chain |
| Bundler | An off-chain service that collects UserOperations and submits them to the EntryPoint |
| Paymaster | An optional contract that sponsors gas fees on behalf of the user |
UserOperations Explained
A UserOperation replaces the traditional Ethereum transaction. Instead of signing a transaction directly, users sign a UserOperation that the EntryPoint contract processes.
// Sending a UserOperation with the EmbarkAI SDK
import { createServerWalletManager, MemoryKeyshareStorage } from '@embarkai/core'
const manager = createServerWalletManager({
apiKey: process.env.EMBARK_API_KEY!,
chainId: 994873017,
storage: new MemoryKeyshareStorage(),
})
const wallet = await manager.getWallet('my-wallet')
// The SDK constructs, signs, and submits the UserOperation internally
const userOpHash = await wallet.sendUserOperation(
'0xRecipientAddress',
'1000000000000000000', // 1 LUMIA in wei
)Behind the scenes, the SDK:
- Constructs a UserOperation with the correct nonce, gas limits, and calldata
- Signs the operation using the DKLS23 threshold signature protocol
- Submits it to the Bundler
- The Bundler validates and sends it to the EntryPoint contract on-chain
The EntryPoint Contract
The EntryPoint is a singleton contract deployed at a well-known address on every supported chain. It is responsible for:
- Validating each UserOperation’s signature via the smart account’s
validateUserOpmethod - Executing the call defined in the UserOperation
- Handling gas payments — either from the smart account’s deposit or via a Paymaster
- Emitting events that allow off-chain indexing of UserOperation results
embarkAI uses EntryPoint v0.7, which is automatically configured for all supported chains.
The Bundler
The Bundler is an off-chain service that aggregates UserOperations and submits them to the EntryPoint in a single on-chain transaction. embarkAI runs managed Bundler infrastructure so you do not need to operate your own.
The Bundler performs several checks before inclusion:
- Validates the UserOperation signature
- Simulates execution to ensure it will succeed
- Estimates gas requirements
- Submits the bundle to the blockchain
Paymaster: Gas Sponsorship
A Paymaster contract can pay gas fees on behalf of users, enabling gasless transactions. When a Paymaster is configured, users never need to hold native tokens to transact.
import { createServerWalletManager, MemoryKeyshareStorage } from '@embarkai/core'
const manager = createServerWalletManager({
apiKey: process.env.EMBARK_API_KEY!,
chainId: 994873017,
storage: new MemoryKeyshareStorage(),
paymasterAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', // optional: your own paymaster instead of the default one
})See the Paymaster documentation for details on configuring gas sponsorship.
Smart Account Lifecycle
embarkAI smart accounts follow a counterfactual deployment model:
1. Wallet Creation (Off-chain)
When you call createWallet(), the SDK runs the DKG protocol to generate a key pair and computes the counterfactual address — the deterministic address where the smart account will be deployed. No on-chain transaction occurs at this stage.
2. First Transaction (Deployment)
The first UserOperation sent from the wallet includes the factory and factoryData fields (ERC-4337 v0.7) that deploy the smart account contract. The EntryPoint uses the AA factory contract to deploy the account and then executes the operation — all in one transaction.
3. Active
After deployment, the smart account is a live contract on-chain. Subsequent UserOperations omit factory/factoryData and execute directly against the deployed account.
Advantages Over EOA Wallets
| Feature | EOA Wallet | embarkAI Smart Account |
|---|---|---|
| Key management | Single private key | MPC threshold signatures (no single point of failure) |
| Gas payment | Must hold native tokens | Paymaster can sponsor gas |
| Batch operations | One tx at a time | Multiple calls in a single UserOperation |
| Account recovery | Seed phrase only | Vault backup with password encryption |
| Custom validation | ECDSA only | Programmable signature verification |
| Deployment cost | Free (built-in) | Deferred to first transaction (counterfactual) |
How embarkAI Implements AA
embarkAI combines Account Abstraction with MPC security:
- Key generation uses the DKLS23 2-of-2 threshold protocol — no single party holds the full private key
- Smart accounts are deployed via a deterministic factory contract per chain
- Bundler infrastructure is fully managed — you interact only with the SDK
- Gas sponsorship is opt-in via Paymaster configuration
- Batch operations are supported natively through
sendBatchUserOperation
Next Steps
- MPC Security — Learn how threshold signatures protect your keys
- Paymaster — Configure gas sponsorship for your users
- Server Wallets — Create and manage wallets from your backend
- Send Your First Transaction — Hands-on tutorial