40% Cost Reduction Through Payment Innovation
How we redesigned a Web3 payment flow that cut transaction costs by 40% while dramatically improving the user experience.
Client
DeFi Protocol
Timeline
3 weeks
Date
August 2024
The Problem
A DeFi protocol came to us with a payment UX problem that was costing them users every day. Their transaction flow required users to approve tokens, then execute the transaction — two separate on-chain calls, each requiring a gas fee. Combined with confusing error states and no progress feedback, the drop-off rate at the payment step was over 40%.
The technical and UX problems were intertwined:
- Double gas cost. Requiring two separate transactions (approve + execute) was charging users unnecessarily. Most modern DeFi protocols have moved to EIP-2612 permit signatures — a gasless approval mechanism.
- Confusing error states. When a transaction failed, users saw a raw MetaMask error with no helpful context. Many would just abandon.
- No progress feedback. Between submitting a transaction and confirmation, users saw a loading spinner with no time estimate. Some would close the tab thinking it failed.
- Mobile experience was broken. The flow assumed desktop MetaMask. Mobile wallet deep-linking was non-functional.
The Solution
We rebuilt the payment flow from the ground up with three core improvements:
1. EIP-2612 Permit Signatures
We replaced the two-transaction (approve + execute) flow with EIP-2612 permit signatures. Users sign a message (gasless) granting permission, which is bundled with the actual transaction. One transaction instead of two — immediate 50% reduction in gas costs for users.
For tokens that didn't support EIP-2612, we implemented a smart detection system that falls back to the traditional approve flow gracefully.
2. Smart Error Handling
We intercepted every possible failure state and mapped it to a human-readable error with a clear action:
- Insufficient balance → Show exact shortfall with one-click link to buy
- Transaction underpriced → Automatically suggest new gas price
- Slippage exceeded → Explain slippage, offer to increase tolerance
- User rejected → Simple "Try again" with no judgment
3. Transaction Progress UI
We built a real-time progress component that shows the user exactly what's happening:
- Signing permit ✓
- Submitting transaction...
- Confirming (block countdown)
- Complete ✓
Users could see which block their transaction was in and estimate time to confirmation based on current network conditions.
The Results
Three weeks after deployment:
- 40% reduction in average transaction cost for users
- 97% transaction success rate (up from 58%)
- 60% reduction in drop-off at the payment step
- 45% faster average completion time (due to eliminating the approval transaction)
The protocol's retention metrics improved significantly in the following month as users who previously abandoned due to failed transactions returned.
Technical Implementation
The stack for this build:
- Wagmi + Viem for blockchain interaction
- React with custom transaction state machine
- EIP-2612 permit signature implementation
- Alchemy for transaction status webhooks
- ethers.js for gas estimation and optimization
The key architectural decision was modeling the transaction lifecycle as a state machine. Each state had a clear UI, a clear set of valid next states, and a clear error handling path. This eliminated the class of bugs that came from inconsistent UI state.
Results
40%
Cost reduction
97%
Transaction success rate
60%
User drop-off reduction
-45%
Avg completion time