xud icon indicating copy to clipboard operation
xud copied to clipboard

Support c-lightning as swap client

Open kilrau opened this issue 6 years ago • 5 comments

Code base: https://github.com/ElementsProject/lightning Docs: https://lightning.readthedocs.io/

Todo:

  1. implement ClightningClient as SwapClient
  2. there is no suitable hold invoice plugin to directly support our use case, but hold invoices are implemented by e.g. https://github.com/lightningd/plugins/blob/ea8e24eb5643db5c2693f4d24cb304a009533492/jitrebalance/jitrebalance.py & https://github.com/lightningd/plugins/blob/3290e4e45695393430dd9efe9ee767fa9f38e004/noise/noise.py (thanks @cdecker). Hold invoice hook is implemented since https://github.com/ElementsProject/lightning/pull/2540. Opened a separate issue for c-lightning swap hold-invoice plugin: https://github.com/lightningd/plugins/issues/98
  3. make an experimental ltc/btc or even btc/btc swap work (with lnd)

Ignore for now: L-BTC/Liquid support, backups etc

  • Here the PR implementing Liquid support (only L-BTC, no Liquid Assets yet): https://github.com/ElementsProject/lightning/pull/3078
  • Slight differences in transaction and block formats will need adjustements in our locktime, delta, slippage calculations
  • An updated fee estimation mechanism to account for the proofs and the additional fee outputs https://medium.com/blockstream/getting-started-with-lightning-on-the-liquid-network-8b5682752ffe (?)
  • https://mm.fulmo.org/fulmo/channels/x-backup-plugin-c-lightning

kilrau avatar Oct 09 '19 15:10 kilrau

Noting in case it's helpful that a BTC <> L-BTC swap is interesting to me, even before c-lightning supports Liquid Assets

john-light avatar Mar 17 '20 15:03 john-light

We just bumped the prio on this one :) @john-light

kilrau avatar Apr 03 '20 16:04 kilrau

Not sure if you are following our discussion in https://mm.fulmo.org/fulmo/channels/c-lightning, but looks like we need two things to support c-lightning with xud: c-lightning integration into xud (https://github.com/ExchangeUnion/xud/issues/1281) and a hold invoice plugin tight to our use case (https://github.com/lightningd/plugins/issues/98)

Two ways to enforce the payment locktimes in c-lightning:

  1. getroute + sendpay, basically the sendtoroute of lnd which we used before
  2. encode the last hop cltv into the invoice which is generated by our hold invoice plugin

There doesn't seem to be a good way to set a cltv with the regular pay call (https://lightning.readthedocs.io/lightning-pay.7.html) according to docs & @cdecker

Which one do you think is better? @sangaman @michael1011

kilrau avatar Apr 06 '20 08:04 kilrau

Justr curious to hear if there has been any progress here since the last post?

@kilrau While the pay command doesn't take cltv as an input , invoice now does. Would tha tbe sufficient? https://github.com/ElementsProject/lightning/commit/1a8978100efd55a8878cf6e79a3eb40c980c9c8d#diff-a59e947277b5a6f8696529091c84a49882df40952df323db08e34f11c181bf9d

Also curious of there is/was ny actual WIP on https://github.com/lightningd/plugins/issues/98 that one could pick up on?

3nprob avatar Feb 07 '21 12:02 3nprob

Hi there! Active development moved to https://github.com/opendexnetwork/opendexd now, I already transferred this issue: https://github.com/opendexnetwork/opendexd/issues/2

BitcoinOG avatar Feb 09 '21 12:02 BitcoinOG