wbobeirne / lightning-app-tutorial

A four part series with code that shows how to build your very own Lightning app!
28 stars 8 forks source link

Cannot complete payment (Route/Liquidity issues?) #2

Open LAMike310 opened 5 years ago

LAMike310 commented 5 years ago

Having an issue completing the payment for my post. I first thought it was because I was trying to send a payment to myself, since my Joule extension and web server were operating from the same node.

Screen Shot 2019-05-30 at 7 12 08 PM

Then I tried in my BlueWallet, and I got another error, which might have to do with inbound liquidity?

IMG_522EB38B024A-1

Do I need to get some inbound liquidity to complete this tutorial?

wbobeirne commented 5 years ago

Yep, this is something I hadn't covered yet but there are two issues at play here.

  1. You cannot send payments to your own node. I don't think there are any protocol limitations on this, but LND does not currently allow it.
  2. You need inbound liquidity. This doesn't mean you need someone to open a channel to you though! You can send some satoshis to your blue wallet, which will push some of your liquidity to a channel connected to it. Then you can send it back for testing.

I'll be sure to add some notes to the guides about this. I had planned on talking more about it with step 5 for productionizing your lapp.

joshakeman commented 5 years ago

Hey this is the spot I'm stuck as well. I'm new to using my zap node and the payment's just not going through. I'm a little confused as to where the invoice being generated in this app is being sent to? Is it trying to send to my own node? Where is that determined in the code?

wbobeirne commented 5 years ago

I'm a little confused as to where the invoice being generated in this app is being sent to? Is it trying to send to my own node? Where is that determined in the code?

That depends on what you (as a user) do with the invoice you're presented with when you try to make a post. If you click on the link or paste it back into Zap, then yes you're trying to make a payment to your own node. The code doesn't do anything to limit who the sender will be, since BOLT-11 invoices can't encode who pays them.

If you want to test out a payment but can't setup a second node, I suggest you try out a custodial wallet to make it easier. Something like BlueWallet or Bitlum. These are only setup for mainnet though.

joshakeman commented 5 years ago

I see, so the code is generating an invoice for your node. Makes sense. So I could pull that invoice into bluewallet and attempt to pay it from there? Sorry for the super basic questions, still new to this lightning thing.

wbobeirne commented 5 years ago

No worries. Yep, you could definitely do that! Unfortunately I didn't implement a QR code for this go of it though, so it might be a little more difficult to use on a mobile device. I planned to use a library as a part of the WebLN stuff in part 4 that'll display one for us though.