Pitch: Lightning Mobile Push Payments
What this solves
One of the largest UX barriers to non-custodial mobile lightning payments is only being able to receive payments while having your app open.
LnPush allows recipients to add a webhook to their invoices which enables senders from any wallet to wake up the recipient's app in the background to come online and receive the payment.
Demo video
<iframe class="remirror-iframe remirror-iframe-youtube" src="https://www.youtube-nocookie.com/embed/bouWwl_hQZA?" data-embed-type="youtube" allowfullscreen="true" frameborder="0"></iframe>How it was built
This is not meant to be a full featured mobile lightning wallet but just a spec outline and reference implementation. The project includes an example for a push notification server and a lightning mobile app.
-
Swift (Mobile)
-
Kotlin (Mobile)
-
React Native (Mobile)
-
NodeJS (Server)
Next steps
-
Solve for Android
-
Refine spec
-
Implement in Bitkit
-
Chat to other wallets about supporting for wallet interoperability
Quick links
-
Repo: https://github.com/Jasonvdb/lightning-mobile-push-payments
-
Example app: https://github.com/Jasonvdb/lightning-mobile-push-payments/tree/main/mobile
-
Example server: https://github.com/Jasonvdb/lightning-mobile-push-payments/tree/main/server
How it works
-
Mobile lightning wallet user wants to receive a payment but doesn't want to coordinate with the sender to be online at the same time.
-
App requests permission to enable remote push notifications and keeps authorization token.
-
Recipient calls https://mypushserver.com/register?token=ksldk12... and receives back a webhook which authorizes someone with the ability to trigger 1 push notification to this receivers phone.
-
Recipient creates an invoice with a description that includes the webhook in brackets. e.g. "
Coffee date {
https://mypushserver.com/abc123}" -
Invoice is shared with sender as you would any regular payment request via a string or QR.
-
Sender (could be same wallet or different wallet provider) sees the webhook encoded in the invoice and knows to trigger it before attempting the payment.
-
In the webhook response the sender will have the number of milliseconds to delay before attempting the payment. This will vary between wallet providers as different lightning implementations can take a different amount of time to start up and be in a state ready to receive payments.
-
The notification to the receiver is sent with all latest block data (and any other values the node needs to sync) included as part of the notification payload as well as
mutableContent: 1
which tells the device it needs to intercept the notification with its notification extension on iOS or pending intent on Android. -
The extension or intent then spins up a lightning node that shares the state with the main app and gets into the correct state for receiving. On iOS an app group is configured so the main app and the extension can share a storage directory.
-
On the sender side once delay has passed it will pay the invoice just as they would any other.
-
Once the recipient's phone has received the transaction (or timed out) in the background the notification is delivered to the user informing them of the sats they received or of the failed payment.