ERC4337 Smart Account Wallets
Crypto for consumers
Polystream integrates ERC-4337 Account Abstraction to provide a seamless user experience by abstracting away complex blockchain interactions. This architecture allows users to interact with DeFi protocols without managing gas fees directly or dealing with the traditional complications of cryptocurrency wallets.
Polystream's ERC-4337 integration is enabled by leveraging Biconomy’s Nexus Smart Accounts.
Smart Account Architecture
1. EntryPoint Contract
The EntryPoint.sol
contract is the central hub through which all user operations are processed:
Validates signatures and transaction parameters
Executes batched user operations
Manages gas refunds and paymaster interactions
Provides simulation capabilities for off-chain validation
2. Bundler
Bundlers are a critical component of the ERC-4337 infrastructure that collect "UserOperation" objects from users and submit them to the EntryPoint contract:

While the bundler itself is typically an off-chain service, your codebase integrates with bundlers through:
UserOperation creation and signing in client-side code
Verification and validation mechanisms in the smart contracts
Tests for bundler compatibility
The core bundler interaction happens through the SendUserOp
interface which is referenced in the AASigner
class:
3. Factory Contract
The SimpleAccountFactory.sol
contract deploys new smart accounts when needed:
Deterministic account creation with CREATE2
Address calculation for counterfactual accounts
Batched account creation
4. Paymaster
The optional VerifyingPaymaster.sol
contract can sponsor gas fees for users:
Validates operations it's willing to sponsor
Implements post-operation logic for accounting
Defines payment criteria and limitations
User Operation Structure
The UserOperation.ts
structure is the fundamental data type in ERC-4337:
Sponsored Transactions
Polystream implements sponsored transactions through paymasters, allowing users to execute transactions without holding ETH. This creates a "Web2-like" experience where users don't need to understand gas or acquire ETH to use the platform.
The PaymasterFlow implementation is referenced in several test files, showing how transactions can be sponsored:
Paymasters can sponsor gas fees and can implement different payment models:
Free transactions: Subsidizing user operations as a business expense
Token payments: Users pay in ERC-20 tokens instead of ETH
Subscription models: Users with active subscriptions get free transactions
Dealing with popups and signing for every transaction is one of the worst parts of crypto UX.

Thanks to ERC4337, you won't need to sign endless transaction prompts:
Set up once with a single approval
No more constant wallet connection requests
No more confusing technical permissions
No more gas fee surprises
If interaction is needed, you'll only see one final confirmation - not dozens of confusing approval requests.
Last updated