Skip to content

Adding support for Lightning Network - #2

Open
natefriedman wants to merge 14 commits into
NicolasDorier:masterfrom
natefriedman:natefriedman-LN
Open

Adding support for Lightning Network#2
natefriedman wants to merge 14 commits into
NicolasDorier:masterfrom
natefriedman:natefriedman-LN

Conversation

@natefriedman

Copy link
Copy Markdown

I am proposing to expand this to cover two LN senarios:

  1. A mirror of the original BTC protocol but for LN addresses and payments. This allows merchants to receive LN payments without running LN infrastructure. This gives them even better hedging ability than onchain payments as there is no delays (from payment to confirmation). Once a payment is received it can be instantly converted.
  2. Where merchants run their own LN configuration. Crypto-savvy merchants might want to receive payments directly on their own channel. The only dis-incentive of doing so is that it subjects the merchants revenue to exchange rate volatility as long as the channel is open. So COX could be used to initiate sell requests to mitigate this.

I didn't fully spec out scenario #2 but wanted to share this as is to discuss. Let me know what you think.

NicolasDorier and others added 10 commits December 20, 2017 15:34
The current proposal has the processor independently determine when payment is made.   This adds significant complexity to each processor and creates the possibility that the processor thinks a payment was made when the exchange does not (or vice versa).

Having the exchange notify the processor of payments via a webhook solves this.   This is easier for the exchange to implement since they are already crypto experts, lowers the barrier for processor adoption (since they don't now need to be crypto experts), and ensures that invoices are marked as paid only when they really are.
Exchange notifies processor of payments
Comment thread bip-xxx.mediawiki Outdated
"receivedTimestamp" : timestamp,
"confirmedTimestamp" : timestamp,
# When exchange provided a guarenteed rate
"guarenteedRateReceived" : "false",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"guarenteedRateReceived" typo, guaranteed.

Comment thread bip-xxx.mediawiki Outdated
"cryptoCurrencyCode" : "BTC",
"rate" : "15600",
"validUntil" : timestamp, # for LN only
“cryptoAmmount: 0.1, #for LN only

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange quotes

Comment thread bip-xxx.mediawiki

===Case II: Merchant uses exchange’s LN===

In this case, the Payment Processor requests a LN address from the exchange. The exchange keeps the Payment Processor up-to-date on payment status and sells the funds as configured.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spell LN completely (Lightning network)

Comment thread bip-xxx.mediawiki

In this case, the Payment Processor requests a LN address from the exchange. The exchange keeps the Payment Processor up-to-date on payment status and sells the funds as configured.

The steps are identical to Case I except LN addresses are sent instead of Bitcoin.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a different field should be used. The exchange could allow any of them, Carol is the one choosing whether to pay on LN or BTC depending on her wallet.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I had assumed that LN & BTC would be different endpoints at the exchange but it probably makes more sense for there to be a single endpoint that just offers both options if available.

@NicolasDorier

Copy link
Copy Markdown
Owner

Awesome, I briefly read, I will do more tomorrow. A note: It can be useful to not only specify the LN address (BOLT11), but also the address of the LN node of the exchange. By doing so, the wallet can ask a user to open a channel with the merchant if he can't route his payment.

@NicolasDorier

Copy link
Copy Markdown
Owner

Ping @lepipele I think it would make sense to use the BOLT you are creating for the LN address instead of using BOLT11.

Merchant may want to be able to hedge funds received on live channel.
@rockstardev

Copy link
Copy Markdown

Sure, let me reference all this to Jack also and then @natefriedman can maybe join us when we have group discussion on implementation. With working integration we can definitely tweak proposals so that it's ensured they work well in practice.

@NicolasDorier

Copy link
Copy Markdown
Owner

@natefriedman does it interest you to join http://slack.forkbitpay.ninja/ ? we have a channel about a spec for getting LN invoice address in a way that is more UX friendly. It is not clear yet if we should use this instead of what you just specified here for COX though, but might be interesting to talk about it.

@natefriedman

Copy link
Copy Markdown
Author

I would be interested in participating, didn't know this project existed!

NicolasDorier pushed a commit that referenced this pull request Jul 25, 2019
NicolasDorier pushed a commit that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants