{"id":"ERC-2266","name":"Atomic Swap Contract","status":"Last Call","chain":"both","category":{"id":"defi","name":"DeFi Patterns","description":"Vaults, bonds, and financial primitives"},"journeyStages":[{"id":"status","name":"Status & Confirmation","description":"Waiting for and confirming outcomes"},{"id":"management","name":"Asset Management","description":"Managing assets over time"}],"uxImpact":"ERC-2266 defines an HTLC-based American Call Option for peer-to-peer token exchanges. It coordinates initiator and participant assets, a premium, separate timelocks, and redeem/refund calls; settlement and refund availability depend on the option state and the relevant deadlines.","officialUrl":"https://ercs.ethereum.org/ERCS/erc-2266","lastReviewed":"2026-09-18","lastUpdated":"2026-09-18","kind":"proposal","hasDetailedContent":true,"content":{"id":"ERC-2266","summary":"ERC-2266 defines an HTLC-based American Call Option for peer-to-peer token exchanges. It coordinates initiator and participant assets, a premium, separate timelocks, and redeem/refund calls; settlement and refund availability depend on the option state and the relevant deadlines.","partialDeployment":{"body":"ERC-2266 is Last Call. Treat option setup, participation, redeem/refund calls, and deadlines as conditional on the target deployment and its token, counterparty, liveness, and gas terms; verify those terms before presenting a swap flow."},"applicability":{"whenToUse":["The product needs a peer-to-peer HTLC option with explicit initiator/participant assets, premium, secrets, and timelocks.","The target deployment exposes the required setup, initiate, participate, redeem, and refund paths.","The UI can disclose counterparty, liveness, deadline, and actual contract/token/gas terms.","You are designing a swap-offer lifecycle with visible pending and recovery states."],"whenToAvoid":["The flow has no counterparty, premium, secret, or timelock state.","The product only performs an immediate same-party swap without HTLC legs.","The deployed implementation does not expose the required initiate, participate, redeem, or refund actions.","The product promises a universal atomic-swap interface or zero-fee outcome."]},"designerTakeaways":["Explain the HTLC option lifecycle with separate asset, premium, deadline, and refund states.","Design a direct counterparty swap only when the target deployment's terms are disclosed, including premium, timelock, liveness, and fees.","Show contract-enforced conditions without implying that the protocol guarantees a successful or zero-cost settlement."],"problemsSolved":[{"problem":"Peer-to-peer trades require trust","oldWay":"One party sends first and hopes the other sends back.","newWay":"An HTLC option can coordinate redemption and refund conditions for the selected legs.","impact":"critical"},{"problem":"A direct trade needs explicit cost disclosure","oldWay":"A UI compares against an unsupported universal DEX fee or says intermediary fees are zero.","newWay":"Show the deployed contract's premium, token, gas, and any application/intermediary terms.","impact":"high"},{"problem":"Large trades need a visible recovery path","oldWay":"Users cannot tell when or how a refund becomes eligible.","newWay":"Show each timelock, caller condition, and refund action from the target state.","impact":"high"},{"problem":"Atomic-swap implementations vary","oldWay":"Assume every atomic swap conforms to ERC-2266.","newWay":"Identify the ERC-2266 deployment and its actual setup/initiate/participate/redeem/refund interface.","impact":"medium"}],"uxPatterns":[{"name":"Create Swap Offer","description":"Initiate an atomic swap with another party","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","userFlow":["Counterparty receives swap notification","Reviews offer details","Sees funds are locked","Accepts swap, sending their tokens","Show whether the participant has joined and which redeem/refund deadline applies"]},{"name":"Swap Status Tracker","description":"Track swap progress through stages","userFlow":["User checks swap status","Progress shown visually","Initiator and participant asset/premium states displayed separately","Time remaining shown","Show a refund option only when the relevant timelock and state permit it"]},{"name":"Expired Swap Refund","description":"Claim refund when swap expires","userFlow":["Time lock expires without completion","User notified of expiry","A refund becomes claimable only after the relevant timelock and state checks","Show the eligible refund action and its required caller","Confirm funds returned only after the refund transaction settles"]}],"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":"Calling the swap universally safe or free","why":"ERC-2266 defines an HTLC option pattern but does not remove contract, token, gas, premium, or application risk.","instead":"Show the selected deployment's protection model, costs, counterparty, and liveness requirements.","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":"Show the eligible refund call, timelock, and caller conditions with clear instructions","severity":"high"},{"pattern":"No notification when counterparty acts","why":"User misses window to complete","instead":"Offer notification or polling only when the product has a reliable provider; keep the user-visible deadline and pending state otherwise.","severity":"medium"}],"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"}],"specConstraints":[{"id":"swap-sequencing","constraint":"The initiate timestamp should cover the whole swap, and the participant should not participate before the premium is deposited.","appliesTo":"application","normativity":"security-considerations","specQuote":"+ The `initiateTimestamp` should cover the whole swap process.\n+ The participant should never participate before the premium has been deposited.","specSection":"Security Considerations","specUrl":"https://ercs.ethereum.org/ERCS/erc-2266#security-considerations","designImplication":"Show the premium-deposited prerequisite and the complete swap deadline before participation, and keep pending, redeemable, and refundable states distinct."},{"id":"atomic-swap-sequencing","constraint":"The participant SHOULD decide only after the initiator locks the token and sets a timelock; the initiator SHOULD decide whether to proceed only after the participant locks the tokens and timelock.","appliesTo":"application","normativity":"rationale","specSection":"Rationale","specUrl":"https://eips.ethereum.org/EIPS/eip-2266#rationale","designImplication":"Show each party's lock, timelock, and next decision gate separately; never present the swap as ready while the reciprocal lock is missing.","specQuote":"+ The participant should decide whether to participate after the initiator locks the token and sets up the timelock."}],"lastUpdated":"2026-09-18","sources":[{"label":"ERC-2266 official specification","url":"https://ercs.ethereum.org/ERCS/erc-2266","type":"official-spec"}],"lastReviewed":"2026-09-18","technicalNotes":"ERC-2266 standardizes an HTLC-based American Call Option pattern with setup/initiate/participate/redeem/refund paths, initiator and participant assets, a premium, secrets, and timelocks. It removes the need for a trusted third party in the protocol model but does not mandate zero intermediary, contract, token, gas, or application fees, and does not make every atomic-swap implementation conform. Show the deployed contract's actual terms and caller/deadline conditions."},"sources":[{"label":"Official specification","url":"https://ercs.ethereum.org/ERCS/erc-2266","type":"official-spec"},{"label":"Discussion search","url":"https://ethereum-magicians.org/search?q=ERC-2266","type":"discussion"}],"urls":{"canonical":"https://www.eipsfordesigners.com/standards/ERC-2266","markdown":"https://www.eipsfordesigners.com/standards/ERC-2266/content.md","agent":"https://www.eipsfordesigners.com/standards/ERC-2266/agent.md","api":"https://www.eipsfordesigners.com/api/standards/ERC-2266","official":"https://ercs.ethereum.org/ERCS/erc-2266","discussion":"https://ethereum-magicians.org/search?q=ERC-2266"},"freshness":{"lastReviewed":"2026-09-18","lastUpdated":"2026-09-18"}}