Atomic swaps and Interledger

Hi everyone,

I’m new to Interledger and I am currently exploring the use cases it can serve.

From what I’ve read so far (PDF paper, RFC-s, demos), most of the time Interledger is used to route a payment from a sender to a receiver, via a (linear) path of connectors.

However, a much more interesting use case would be to “swap” assets tracked on one ledger (e.g. car ownership) for assets tracked on another ledger (e.g. ETH). Effectively those could materialize as two payments grouped as a transaction.

The PDF paper (https://interledger.org/interledger.pdf) does briefly mention the possibility to implement swaps:

“When trading different assets, connectors in C effectively
write the sender p1 an American option [4, 6] which, on
exercise, swaps an asset on one ledger for an equivalent
asset on another ledger.”

So, how does this “american option” fit the current vision of Interledger?

Thank you,
Teodor

Hey Teodor!

The original version of Interledger specified in the whitepaper, ILPv1, defined a protocol for atomic, cross-ledger payments. (This supported atomic swaps since that’s the same as a user making a payment to themselves).

However, the current version of the protocol, ILPv4, removed ledger-enforced hashlocks and moved to a packetized payments model. The high level rationale for this:

  • Atomic swaps introduce floating options. Long, ledger-enforced timeouts provide the recipient fulfilling the payment with a floating option, or as you noted, American-style call option. If the exchange rate changes in their favor, they can execute the trade; if the exchange rate goes against them, they can let the timeout expire at no cost. A recent paper estimated counterparties may charge a premium of 1% - 2.3% per trade to cover this risk when using a timeout of one day (pg. 8), which is pretty standard for atomic swaps on Bitcoin.
  • Few ledgers support hashlocks. Cryptocurrencies like Bitcoin and Ethereum support escrows using HTLCs and Lightning-style, conditional payment channels, but most traditional ledgers don’t. By having connectors rather than ledgers enforce conditions in ILPv4, the only requirement of ledgers to support ILP is simple value transfers (but the faster and cheaper the better). This means… Interledger can support every ledger, and not strictly those that support HTLCs.
  • Much simpler protocol. If every payment is a small payment, this removed the need for a complex quoting protocol and liquidity curves that every intermediary connector would need to handle. Determining the exchange rate can use probing and unfulfillable test packets, which are an end-to-end concern between senders and receivers.

For fungible assets, ILPv4 can enable asset swaps/trades: it’s just making a payment to yourself though a connector. Using payment channels and very low in-flight amounts, users can minimize counterparty risk. This is how the Switch app enables non-custodial crypto trading.

Unfortunately, “packetized payments” don’t really work for non-fungible assets, such as a title to a car, since that requires atomicity :man_shrugging:

4 Likes

Many thanks for the detailed reply! Now I see what was meant by “american option” in the paper.

So, if I understand correctly, the ILPv4 protocol focuses on interop between ledgers which track “money-like” assets/tokens (BTC, ETH, XRP, etc.).

Are NFT transactions or even generalized cross-chain transactions on the roadmap for future ILP versions?

Best regards,
Teodor