{"id":"EIP-2266","name":"Atomic Swap Contract","status":"Last Call","chain":"both","category":{"id":"defi","name":"DeFi Patterns","description":"Vaults, bonds, and financial primitives"},"journeyStages":[{"id":"management","name":"Asset Management","description":"Managing assets over time"}],"uxImpact":"Users perform trustless cross-party token swaps using HTLC-based atomic swaps — also functions as American Call Options. Design implications: show swap timeline with initiate/participate/redeem/refund stages, display timelock countdowns for each phase, show premium amount for option-like behavior, guide through the multi-step swap process. Design decisions: how to communicate the optionality risk to counterparty, representing the secret/secretHash mechanism simply, whether to frame as 'swap' or 'option' based on use case.","hasDetailedContent":true,"content":{"id":"EIP-2266","summary":"EIP-2266 defines a standard for atomic swap contracts - trustless peer-to-peer token exchanges without intermediaries. Using hash time-locked contracts (HTLCs), two parties can swap tokens knowing that either both transfers complete or neither does. No middleman, no counterparty risk, just direct trading.","applicability":{"whenToUse":["Your product addresses: peer-to-peer trades required trust.","Your product addresses: dEXs charge fees and require liquidity.","The flow should deliver: atomic swap ensures both sides execute or neither does.","You are designing a create swap offer experience with visible states and recovery paths."],"whenToAvoid":["Clearly explain \"Either both complete or neither does\".","Prominent countdown and clear expiry explanation.","One-click refund with clear instructions.","No token balances, swaps, lending, or yield flows appear in the product."]},"designerTakeaways":["You can design UI that delivers atomic swap ensures both sides execute or neither does.","You can design UI that delivers direct swap with counterparty, no intermediary fees.","You can design UI that delivers smart contract enforces the swap trustlessly."],"problemsSolved":[{"problem":"Peer-to-peer trades required trust","oldWay":"One party sends first, hopes other party sends back","newWay":"Atomic swap ensures both sides execute or neither does","impact":"critical"},{"problem":"DEXs charge fees and require liquidity","oldWay":"Pay 0.3% fee to Uniswap, plus slippage on large trades","newWay":"Direct swap with counterparty, no intermediary fees","impact":"high"},{"problem":"Escrow services needed for large trades","oldWay":"Trust third party to hold funds, pay escrow fees","newWay":"Smart contract enforces the swap trustlessly","impact":"high"},{"problem":"No standard for OTC trades","oldWay":"Each platform had custom swap mechanics","newWay":"Standard interface for all atomic swap implementations","impact":"medium"}],"uxPatterns":[{"name":"Create Swap Offer","description":"Initiate an atomic swap with another party","mockup":"concept/one-click-swap","userFlow":["User specifies tokens to swap","Enters counterparty address","Sets time lock duration","Creates and funds the swap","Shares swap ID with counterparty"]},{"name":"Accept Swap","description":"Counterparty accepts and completes the swap","mockup":"concept/one-click-swap","userFlow":["Counterparty receives swap notification","Reviews offer details","Sees funds are locked","Accepts swap, sending their tokens","Both sides complete atomically"]},{"name":"Swap Status Tracker","description":"Track swap progress through stages","mockup":"concept/tx-status","userFlow":["User checks swap status","Progress shown visually","Both sides' status displayed","Time remaining shown","Refund option if counterparty doesn't act"]},{"name":"Expired Swap Refund","description":"Claim refund when swap expires","mockup":"concept/one-click-swap","userFlow":["Time lock expires without completion","User notified of expiry","Refund available to claim","One-click refund process","Funds returned to user"]}],"uiComponents":[{"name":"SwapCreator","description":"Form to create new atomic swap","states":["configuring","confirming","creating","created"],"props":["sendToken","receiveToken","counterparty","timelock","onCreate"]},{"name":"SwapAcceptor","description":"UI to review and accept incoming swap","states":["reviewing","accepting","completed"],"props":["swapDetails","onAccept","onDecline"]},{"name":"SwapStatusTracker","description":"Shows progress of active swap","states":["pending","funded","accepted","completed","expired"],"props":["swapId","stages[]","timeRemaining","onRefund"]},{"name":"TimeLockIndicator","description":"Shows time remaining for swap","states":["active","warning","expired"],"props":["expiryTime","warningThreshold"]}],"antiPatterns":[{"pattern":"Not explaining atomic swap protection","why":"Users don't understand why it's safe","instead":"Clearly explain \"Either both complete or neither does\"","severity":"high"},{"pattern":"Hiding time lock details","why":"User doesn't know when funds could be stuck","instead":"Prominent countdown and clear expiry explanation","severity":"high"},{"pattern":"Complex refund process","why":"User's funds stuck if they can't figure out refund","instead":"One-click refund with clear instructions","severity":"high"},{"pattern":"No notification when counterparty acts","why":"User misses window to complete","instead":"Push notification or email when swap is funded by counterparty","severity":"medium"}],"onMonad":[{"aspect":"Fast Swap Completion","ethereum":"Each step takes 12+ seconds","monad":"Sub-second confirmation for each step","designImplication":"Swaps complete almost instantly, show real-time progress"},{"aspect":"Lower Time Locks","ethereum":"24h locks common due to slow finality","monad":"Could use shorter locks (1-2 hours) safely","designImplication":"Offer shorter time lock options for faster swaps"},{"aspect":"Gas Costs","ethereum":"Multiple transactions can be expensive","monad":"Cheap transactions make atomic swaps more viable","designImplication":"Emphasize cost savings vs CEX/DEX alternatives"}],"relatedStandards":[{"id":"ERC-20","relationship":"Atomic swaps typically exchange ERC-20 tokens"},{"id":"ERC-721","relationship":"Can also swap NFTs atomically"},{"id":"ERC-6105","relationship":"ERC-6105 provides another approach to peer-to-peer NFT trading"},{"id":"ERC-7683","relationship":"Cross-chain intents offer alternative to atomic swaps for bridging"}]},"sources":[{"label":"Official specification","url":"https://eips.ethereum.org/EIPS/eip-2266","type":"official-spec"},{"label":"Discussion","url":"https://ethereum-magicians.org/search?q=EIP-2266","type":"discussion"}],"urls":{"canonical":"https://www.eipsfordesigners.com/standards/EIP-2266","markdown":"https://www.eipsfordesigners.com/standards/EIP-2266/content.md","agent":"https://www.eipsfordesigners.com/standards/EIP-2266/agent.md","api":"https://www.eipsfordesigners.com/api/standards/EIP-2266","official":"https://eips.ethereum.org/EIPS/eip-2266","discussion":"https://ethereum-magicians.org/search?q=EIP-2266"},"freshness":{"lastReviewed":"2026-04-05","lastUpdated":"2026-04-05"}}