Primitives vs. Platforms: Scaling DeFi Velocity with MagicSpend and ERC-4337
TL;DR: Building retail onchain products traditionally requires teams to manage a fragmented stack: smart wallets, bundlers, paymasters, and complex UserOperation construction. To solve this, we engineered two foundational layers: MagicSpend, an atomic onchain funding primitive that authorizes debits from Coinbase balances with revert-safe semantics and Magic Platform, an abstraction layer that codifies ERC-4337 infrastructure. Together, they reduced product shipping timelines by 3x and have processed over $1B in volume.

The Problem: The Integration Tax
Coinbase’s mission is to move the financial system onchain, but the path from a CeFi balance to a DeFi protocol was fraught with high-friction engineering and UX hurdles.
The User Friction: Funding a transaction meant a multi-step odyssey: withdrawing to an external wallet, waiting for confirmations, connecting to a dApp, and hoping gas estimation succeeded. If the transaction failed, funds remained stranded onchain with no automated path back to the user's primary account.
The Engineering Friction: For our product teams, shipping an onchain feature meant integrating a dozen disparate internal systems—smart wallets, key management systems, bundlers, paymasters, and block data pipelines. Each system came with its own APIs and unique failure modes. Teams spent months becoming experts in Account Abstraction (ERC-4337) and UserOperation encoding—knowledge entirely tangential to their actual product domain, such as lending mechanics or risk parameters.
The Organizational Friction: This created a "Cold Start" problem. Tribal knowledge was rebuilt by every team, and infrastructure improvements didn't propagate. We were solving the same problems repeatedly, leading to a slow, predictable time-to-market bottleneck.
Part 1: MagicSpend – The Atomic Funding Primitive
We first tackled the funding gap by building MagicSpend, a primitive for atomic onchain funding.

MagicSpend authorizes funds as a core component of an ERC-4337 compatible UserOperation. Key technical attributes include:
Revert-Safe Semantics: The authorization includes a cryptographically secure nonce and expiry. If the UserOperation reverts onchain, the authorization is invalidated and funds are never debited from the user's Coinbase account.
Dual-Mode Execution: It can function as a Paymaster (sponsoring gas) or as a Liquidity Provider (transferring assets into the wallet for the execution call). These modes can be combined to cover gas while simultaneously providing the principal for a trade or deposit.
Secure Authorization: Signatures are produced by authorized signers using Coinbase’s secure key management, ensuring each signature is used exactly once and only within its valid window.
While MagicSpend solved the funding hurdle, it was only one piece of the puzzle. Product teams still struggled with the surrounding orchestration.
Part 2: Magic Platform – Encoding Expertise into Infrastructure
After shipping our first DeFi product—a bespoke integration that required months of hard-won expertise in bundler behavior and transaction confirmation—we asked: What if the next team didn't need to learn any of this?
Magic Platform is the generalization of those patterns. It unifies MagicSpend with wallet infrastructure and transaction execution into a single abstraction layer. Products provide only the call data (the business logic); the platform handles the rest.
The Four Pillars of Magic Platform
Wallet Infrastructure: We built Coinbase Smart Wallets on top of ERC-4337. It supports counterfactual deployment—where the address is deterministic before the first transaction—and integrates MagicSpend for streamlined "withdraw-and-execute" flows.
Product/Platform Separation: We defined clear boundaries. Products own the intent (call data, payment method); Magic Platform owns the implementation (UserOperation construction, gas estimation, and signature aggregation).
Reliable Submission: The platform manages the full interaction with network bundlers, including de-duplication across chains and nonce management to enable parallel transactions without conflicts.
Lifecycle Confirmation: Submission is straightforward; confirmation is hard. Magic Platform tracks the full lifecycle through an internal pipeline, normalizing revert data and enforcing expiry to prevent indefinite fund holds.
Engineering Impact: Velocity and Latency
The transition from bespoke integration to platform-led development yielded immediate results. Following our initial Borrow product, subsequent launches like Lend and DEX shipped 2–3x faster.
Borrow (Bespoke): Over $1.93B in cumulative originations; $876M+ in active loans.
Lend (Platform-built): Over $1.7B in cumulative deposits and $280M TVL, utilizing the exact same underlying infrastructure as Borrow.
Source: Data is sourced from the Morpho x Coinbase Dune dashboard.
Beyond velocity, the platform enabled Latency Optimization. By restructuring the orchestration flow to generate MagicSpend authorizations early—parallelized with other async steps—we significantly reduced the time-to-sign for the end user.
What We Learned
Primitives are necessary, but insufficient: MagicSpend solved the funding problem, but the "last mile" of orchestration was what actually multiplied velocity.
Intent-Based Abstractions: Infrastructure should handle encoding; products should express intent. When a product engineer has to debug a UserOperation internals, the abstraction has failed.
Confirmation is the real challenge: Knowing exactly when a transaction is confirmed—while handling timeouts, re-orgs, and reverts—requires more investment than the initial submission.
The Road Ahead
We are currently scaling Magic Platform to power every onchain interaction at Coinbase. Our next milestones include:
Autonomous Intent: Transactions that trigger without user intervention via session keys.
Performance: Achieving sub-2-second end-to-end transaction finality.
Reliability: Engineering for 99.999% signing success rates and multi-chain expansion beyond Base and Solana.
We’re hiring. Check out our careers page.


