Paymaster Guide
MOSS sponsorship is configurable per partner: choose a sponsor URL, sponsorship mode, and sponsor fee token. Default behavior is backward-compatible — if you already use sponsorUrl, the defaults stay app-only mode and native fee token.
For funding UX (users adding ETH/stablecoins to their wallet), use the built-in Deposit Flows instead of building your own.
Gas Abstraction at a Glance
User-paid token gas (default)
User
No sponsor endpoint needed
Partner sponsorship via sponsor config
Developer sponsor balance
Partner backend policy via sponsorUrl + mode
Out-Of-Box Gas Payment (Default)
Built in. No developer setup required. Users can pay gas with ETH or enabled stablecoins (currently USDm and USDT0) — no mandatory ETH balance. The MegaETH relay handles token-gas routing and execution.
Sponsorship Modes
app-only (default)
Sponsor app-initiated requests. Wallet UI swaps/transfers are paid by the user.
Most production partner integrations.
explicit
Sponsor only requests your app marks with sponsor: true.
Onboarding/setup sponsorship without paying for all downstream actions.
everything
Sponsor anything the user does, including wallet UI swaps/transfers.
Testing only. Not recommended for production.
Sponsors can pay fees with ETH (default) or USDm.
Provider Support
Live
Use your own sponsor account + approval endpoint and pass it into MOSS via sponsorUrl.
MegaETH managed paymaster
In progress
MegaETH's managed paymaster service will be available for partner teams.
Client Setup
Set sponsorship URL + mode + fee token during SDK initialisation. Existing sponsorship integrations keep working — they don't automatically sponsor wallet-internal swaps/sends.
For React apps, the same config goes into MegaProvider:
Server Setup
Keep paymaster decisions server-side. Never expose sponsorship policy logic in the client.
Your paymaster endpoint must do four things for every incoming sponsorship request:
Receive the proposed UserOperation payload from the wallet flow.
Validate against your rules (allowlisted contracts, budgets, rate limits).
Sign and return sponsorship data when approved.
Reject quickly with structured errors when rules fail.
Risks to Protect Against
Rate limiting
Per-user and per-IP limits with short windows and burst caps.
Budget caps
Daily/monthly sponsorship ceilings globally and per-account.
Contract allowlists
Only sponsor calls to approved contracts and methods.
Monitoring
Alert on error spikes, spend anomalies, and endpoint latency.
Explicit Mode
In sponsorMode: 'explicit', sponsorship is only requested when the specific action includes sponsor: true. Other calls execute as user-paid.
Transaction Flow
Default (user-paid): user action → wallet approval → gas paid with ETH or enabled stablecoins → transaction submits.
Sponsored: user action → wallet/app requests sponsorship based on mode → sponsor endpoint approves gas → transaction submits with sponsor-paid fees.
Related
Best Practices — security guidance for permissions, session keys, and production hardening.
Server Verify — verify SIWE signature payloads on your backend auth flows.
Last updated