~/arifin
GitHub ↗
~/arifin · Indonesia
WorkWritingAbout
GitHub ↗LinkedIn ↗Email
← work
2025·Solo build·oss

AAPM

OSS ↗
backgroundPrediction market participation requires users to manage wallets and gas separately from their positions, adding friction that reduces liquidity.
goalApply account abstraction to prediction markets so users interact with positions through a unified smart account without gas management.
outcomeAAPM — a working demo where a user signs in with Google, gets a smart account automatically, and trades on prediction markets without touching ETH for gas.
TypeScriptAccount AbstractionEVMPrediction MarketsERC-4337Web3AuthSocial AuthGasless

Prediction markets are fascinating from a financial theory perspective, but the UX is broken. Every time I looked at Polymarket or similar platforms, I kept thinking about how many people were bouncing off the gas fee and wallet management screens before ever placing a position. The question wasn't whether prediction markets were useful — it was whether anyone outside of crypto natives would ever actually use them.

The core idea was to wrap ERC-4337 smart accounts around prediction market contracts and remove every piece of friction at once. Users authenticate with Google via Web3Auth — no seed phrases, no wallet setup. A smart account is created automatically on first login. Gas fees are sponsored through a paymaster so users pay only in USDC, never in ETH. The stack is React on the frontend, Express for the API, and Solidity contracts running on Anvil locally during development.

The hardest part was the gas sponsorship layer. ERC-4337 UserOps have to be constructed and signed in a specific format, and getting the bundler, paymaster, and smart account to coordinate without errors took significant iteration. The paymaster validation logic went through several rewrites — the original version had edge cases where malformed UserOps could drain the sponsor balance, which needed to be closed before anything was usable.

The result is a working demo where the entire onboarding flow — Google sign-in, smart account creation, and first position entry — takes under a minute and requires zero knowledge of wallets or gas. It proved the pattern works. The same ERC-4337 wrapper approach could be applied to any DeFi primitive that's currently gated behind crypto-native UX.

← all workwriting →
OSS ↗
TypeScriptAccount AbstractionEVMPrediction MarketsERC-4337Web3AuthSocial AuthGasless
← all workwriting →