Open Paymaster

Decentralized ERC-4337 paymaster enabling cross-chain gasless transactions via liquidity pools.

Open Paymaster

Created At

ETHGlobal Buenos Aires

Winner of

Ethereum Foundation

Ethereum Foundation - Best use of the EIL SDK 1st place

Project Description

Open Paymaster is a decentralized, trustless paymaster built on ERC-4337 that enables gasless blockchain transactions through community-funded liquidity pools.

The frustrating problem:

Users face three fundamental barriers when using Ethereum-compatible networks:

  1. The Gas Paradox: Having tokens but being unable to use them due to lack of native currency for gas
  2. Acquisition Friction: Getting gas requires bridging funds or using centralized exchanges with KYC
  3. Complexity Barrier: End users shouldn't need to understand gas, it's an implementation detail that should be abstracted away

Why Centralized Paymasters available today Don't Solve This:

  • Trust dependency: Users rely on third party managed Paymasters to maintain operations and liquidity
  • Liveness risk: No guarantee the service will stay operational or funded
  • High fees: Typically charge 10%+ markup on gas costs

A proposed solution

Open Paymaster enables users to pay transaction fees with any supported ERC-20 token. Liquidity providers earn yield on native ETH deposits, while users get seamless access without ever touching gas tokens.

How It Works:

  • Community-funded liquidity pools: LPs deposit native ETH to the tokens they are willing to support and earn yield from the user operations fees.
  • Token-to-gas conversion: Users pay fees in tokens they already hold
  • Permissionless rebalancing: anyone can "rebalance" the pools by re-filling them ETH and claiming the accumulated tokens plus a `rebalancing fee, effectively "buying tokens at a discount price", before being able to sell them outside the system, fulfilling arbitrage opportunities that maintain the pools operable.
  • ERC-4337 infrastructure: Leverages account abstraction and can be integrated into any ERC-4337 Wallet.

Complementation with EIL

Open Paymaster strongly complements the Ethereum Interoperability Layer (EIL) to achieve a truly unified Ethereum experience. While EIL CrossChainPaymaster covers gas on destination chains, the Open Paymaster covers the gas on the origin chain. Together, these systems eliminate the need to maintain ETH balances across multiple chains or trust centralized intermediaries.

Example:

Alice has 100 USDC on Ethereum mainnet. She wants to send 50 USDC to Bob on Base. Neither of them has or understands what gas is.

Traditional approach (broken UX):

  1. Buy ETH with USDC on mainnet
  2. Bridge ETH to Base
  3. Bridge USDC to Base
  4. Send USDC to Bob
  5. Bob needs Base ETH to use the funds

With Open Paymaster + EIL:

  1. Alice sends 50 USDC to Bob's Base address
  2. Open Paymaster takes gas payment in USDC on mainnet (origin)
  3. EIL Voucher Request is fulfilled by an XLP on Base (destination)
  4. Bob receives 50 USDC on Base, usable immediately

Neither Alice nor Bob needed to understand gas, acquire native tokens, or trust centralized services.

Key Properties:

Trustless: No reliance on centralized operators Permissionless: Anyone can become a liquidity provider Gasless UX: Users pay fees in tokens they already hold ERC-4337 native: Built on the account abstraction standard Cross-chain ready: Integrates with EIL for multi-chain operations

How it's Made

`The system is built in Solidity with Foundry as the development framework. The OpenPaymaster contract inherits from three base contracts: BasePaymaster (ERC-4337 interface), EntryPointVault (ERC-6909 multi-token vault for LP share accounting), and PythOracleAdapter (Pyth Network price feed integration).

The contract defines three roles: Liquidity Providers deposit ETH and earn fees, Users pay gas in tokens, and Rebalancers arbitrage token accumulation to keep pools balanced.

SYSTEM COMPONENTS

Open Paymaster: Singleton on-chain contract holding all liquidity pools. Handles token-to-gas conversion, gas sponsorship, and LP share management.

Paymaster Router (optional): Off-chain service that queries all pools for a given token and returns the cheapest option. Example: "I want to pay in USDC, which pool gives me the best rate right now?"

Frontend (optional): Next.js web app providing fallback UI for liquidity providers to deposit, withdraw, and rebalance pools. Also serves as a fallback for users whose wallets don't support Open Paymaster yet, enabling cross-chain gasless transactions directly through the web interface.

HOW A TRANSACTION WORKS

When a user wants to pay gas in USDC instead of ETH:

  1. User signs a permit allowing the paymaster to transfer tokens (gasless approval using EIP-2612)

  2. User submits a UserOperation with paymasterData encoding the token address and Pyth price update data

  3. Validation phase (_validatePaymasterUserOp): Verifies the pool exists and has sufficient ETH reserves Queries cached token/ETH price from Pyth oracle Calculates conservative prefund estimate including LP fees and rebalancing fees Transfers tokens from user to paymaster Returns context data for postOp

  4. EntryPoint executes the user's transaction, sponsored by the paymaster's ETH

  5. PostOp phase (_postOp): Updates Pyth price feeds with fresh off-chain data Recalculates actual gas cost using current prices Refunds excess tokens to user Updates pool accounting (decreases ETH reserves, increases token reserves)

The two-phase pricing (cached for validation, fresh for settlement) prevents MEV and ensures users pay fair market rates while giving bundlers predictable validation.

POOL MANAGEMENT

Anyone can initialize a new token pool by calling initializePool with token address, Pyth feed ID, LP fee (basis points), and rebalancing fee (basis points). The contract uses ERC-6909 to track LP shares per pool, encoding the pool ID as uint256(uint160(tokenAddress)).

Liquidity providers deposit ETH by calling deposit() with a specific pool ID. They receive ERC-6909 shares representing their portion of that pool's ETH reserves. Withdrawals burn shares and return proportional ETH.

REBALANCING MECHANISM

As users pay gas in tokens, pools accumulate tokens and deplete ETH reserves. The rebalance() function allows anyone to buy accumulated tokens at a discount (the rebalancingFeeBps). This creates an arbitrage opportunity: rebalancers deposit ETH, extract tokens below market price, and resell them elsewhere for profit. This keeps pools healthy without requiring active management.

PYTH ORACLE INTEGRATION

Pyth provides pull-based price feeds where off-chain price data is submitted on-chain only when needed. The paymaster stores two feed IDs: ETH/USD and the token's feed ID. During validation, we use the cached on-chain price. During postOp, we update both feeds with signed price data from Pyth's off-chain service and pay the update fee from the paymaster's balance.

EIL CROSS-CHAIN INTEGRATION

For cross-chain transactions, Open Paymaster handles origin chain gas while EIL's CrossChainPaymaster handles destination chain gas. A user paying USDC on Ethereum to send funds to Base only signs once. The origin transaction is sponsored by Open Paymaster (paid in USDC), which creates an EIL voucher request. An XLP fulfills the voucher on Base, and the destination transaction executes gaslessly from the user's perspective.

FRONTEND & SDK

The frontend is Next.js 14 with TypeScript, using wagmi and viem for wallet interaction. The SDK abstracts the complexity: developers call paymasterClient.estimateUserOpGas(token) and the SDK queries Pyth feed IDs, fetches current prices, encodes paymasterData, and constructs the UserOperation.

The system is fully permissionless with no admin keys, upgrade mechanisms, or pause functionality. Anyone can create pools, provide liquidity, or rebalance without permission.

background image mobile

Join the mailing list

Get the latest news and updates

Open Paymaster | ETHGlobal