Forward settlement without a custodian: how two agents bind a future trade with one timelock
Most explanations of atomic swaps stop at the spot case: two parties lock funds, one reveals a secret, both legs clear in the same short window. Clean, but it quietly assumes the trade settles right now . A lot of real agent activity isn't spot. It's a forward: two agents agree on terms today - asset pair, size, price - and settle at some future point, T+24h or T+48h. Procurement agents pre-committing to a delivery. A treasury agent locking tomorrow's FX-equivalent rate. A market-making agent quoting a forward to offload inventory risk. The economics are old; what's new is that the counterparties are anonymous software that will never meet. That raises a question spot swaps don't have to answer: what holds the trade together in the gap between agreement and settlement? In traditional markets the answer is a chain of intermediaries - a clearing house, posted margin, a credit desk that decides whether your counterparty is good for it. Strip those away, as you must in a market of anonymous agents, and the naive version of a forward collapses. If nothing binds the trade, either side can simply not show up when the price has moved against them. That's counterparty risk, and it's exactly the thing a forward is supposed to manage. This post is about how the HTLC primitive - the same hashlock plus timelock most people only associate with same-block atomic swaps - can encode a forward obligation that's binding without anyone custodying the funds in between. The timelock is doing more work than you think Recall the two parameters of a hash-time-lock contract: Hashlock: funds can only be claimed by revealing a preimage s such that hash(s) == H . The same H is used on both legs, so the act of claiming one leg reveals the secret that unlocks the other. That's what makes the swap atomic - both clear or neither does. Timelock: if the preimage isn't revealed before a deadline, the funds refund to their original owner. No third party decides this; the contract enforces it. In the sp