Seven years ago today - 17 August 2019 - Runchao Han, Haoyu Lin and Jiangshan Yu filed ERC-2266, "Atomic Swap-based American Call Option Contract Standard." It is still marked Last Call in the EIP repository. Its motivation section contains the sentence that anyone building forward settlement on hash-time-locked contracts eventually has to reckon with:
the HTLC-based Atomic Swap has optionality. More specifically, the swap initiator can choose to proceed or abort the swap for several hours, which gives him time for speculating according to the exchange rate.
We wrote up how an atomic forward works a while back: keep the hashlock, keep the timelock, add a third knob that gates the claim path so it is only valid inside a window [forward_start, timeout). Two parties fix terms at T+0 and settle at T+24h, and no custodian holds the gap in between.
That post covered the mechanism. This one covers what the mechanism costs. It is the harder half, and it is the half most settlement writeups skip.
The asymmetry
Recall who does what in a two-leg swap.
The initiator picks a random secret s, publishes H = SHA-256(s), and funds their leg. The participant sees H, funds their leg against the same hash, and waits. Both legs can only be claimed by revealing s.
Now notice: only one party knows s. The initiator can reveal it and complete the trade, or sit on it and let both legs time out and refund. The participant cannot force completion either way. They can only wait.
For the entire duration of the claim window, the initiator holds a right without a corresponding obligation. That is the textbook definition of an option. The strike is the agreed exchange rate. The expiry is the timeout. And the initiator paid nothing for it.
Han, Lin and Yu formalized this in On the optionality and fairness of Atomic Swaps; the observation itself traces back to a January 2019 lightning-dev thread that ERC-2266 cites. The conclusion is unambiguous: an HTLC atomic swap is an American call option with a premium of zero.
Why spot gets away with it and forwards do not
A ten-minute spot swap has this same defect. Almost nobody prices it, and for good reason - the option is worth very little over ten minutes.
Use the standard at-the-money approximation for option value, V ≈ 0.4 · σ · S · √T, where σ is annualized volatility, S is notional, and T is time to expiry in years. Take σ = 60%, a plausible annualized figure for a liquid crypto pair, and hold everything else fixed:
| Claim window | T (years) | Option value as % of notional | In bps |
|---|---|---|---|
| 10 minutes | 1.90e-5 | 0.105% | ~10 bps |
| 1 hour | 1.14e-4 | 0.256% | ~26 bps |
| 24 hours | 2.74e-3 | 1.256% | ~126 bps |
The scaling is √T, so the ratio between the 10-minute case and the 24-hour case is √144 = 12. Twelve times the free optionality, from the single design change that makes a forward a forward.
Two caveats, stated plainly. This approximation ignores drift, skew, and the fact that a real counterparty has to actually be watching and willing to act. And 60% annualized vol is an assumption, not a measurement - halve it and every number in that table halves. The level is illustrative. The √T scaling is not; it is a property of the model, and it holds whatever σ you plug in.
The uncomfortable comparison is the one against our own usual argument. We spend a lot of words on custodial settlement pricing counterparty risk at roughly 8-10 bps versus atomic settlement compressing toward 1-2 bps. If a 24-hour forward hands one side ~126 bps of unpriced optionality, that gap is not the dominant term. The optionality is. Anyone selling you atomic forwards on the fee argument alone is selling you the wrong number.
Three ways to close it, each with a real cost
1. Charge a premium. This is ERC-2266's answer, and it is the most principled one. The initiator deposits a premium alongside their asset. The participant redeems that premium if they participate honestly and the initiator then walks away; the initiator gets it back only if the participant never participates at all. The option stops being free, so the arbitrage stops being free.
Cost: you now have three locked balances instead of two, and you have to price the premium. Pricing it correctly means agreeing on volatility - which means an oracle, or a negotiation, or a hardcoded table that will be wrong. ERC-2266 specifies the mechanism and leaves the pricing to you. That is honest of it, and it is also the hard part.
2. Shorten the window. Option value falls as √T, so cutting a 24-hour forward to 4 hours removes about 59% of the free optionality. Cheap, requires no new contract logic.
Cost: you gave up most of the reason to want a forward. If the agent needed T+24h because its treasury rebalances daily, a 4-hour window does not serve it.
3. Bond the initiator. Require slashable stake, forfeited on non-reveal. Economically similar to a premium, but the collateral is posted once against a reputation rather than per-trade. This is the direction our Execution Rewards primitive points, and it composes with a verified counterparty layer - a bonded, identified initiator has more than one trade at risk.
Cost: it only works against counterparties who have something staked. For an anonymous one-shot counterparty it does nothing, and "agents can trade with strangers" is supposed to be the point.
None of the three is free. That is the actual finding.
Four things we are not going to hide
Beyond optionality, an atomic forward carries constraints that a custodial forward does not:
- Capital lockup for the full window. Both legs sit idle from T+0 to settlement. The counterparty risk you removed is paid for in opportunity cost, and over 24 hours on a large notional that is not nothing.
- Both legs must be on-chain. HTLCs cannot bind a leg that settles in a bank account. Anything with a fiat leg needs a different instrument.
- Liveness. Someone has to be online inside the window to reveal and to claim. An agent that crashes at hour 20 of a 24-hour forward gets a refund, not a settlement. That is safe, but it is not the outcome anyone wanted.
- Timeout ordering eats the window. The second mover needs an earlier refund deadline than the first mover, with enough margin to survive a fee spike or a reorg near the deadline. Those safety margins come out of the usable claim window, so the window you advertise and the window you actually get are not the same number.
Where this actually stands
Forward Settlement is a designed primitive in our roadmap, not a shipped product. We are not going to describe it as live, because it is not. What is live: Ethereum mainnet, end-to-end. Sui contracts are deployed and CLI-tested but not live. Bitcoin is signet-validated with mainnet pending. The MCP server (hashlock-tech/mcp (scoped), currently 0.6.0) exposes six tools against what is actually running.
The reason to publish the cost analysis before the feature is that the analysis is what determines whether the feature is worth building the way we sketched it. If we cannot answer "who pays for the optionality," a forward is a nicer-sounding version of a worse trade.
Mechanism writeup and the academic grounding: hashlock.markets/methodology · SSRN whitepaper · github.com/Hashlock-Tech/hashlock-mcp
If you were writing the settlement layer an autonomous agent trades through: premium, shorter window, or slashable stake? And what would you want the agent to be able to see about that choice before it agrees to the trade?
Top comments (0)