As we strive to boost Bitcoin adoption at App-Learning, we not only provide a vast amount of content in Simple Bitcoin but also share our app development expertise with other developers in the Bitcoin space. Today, we're sharing this guide on how to deep-link with Lightning in your application.
How deep links improve the UX for Lightning apps
Deep links enable linking directly to specific apps within a mobile app, rather than requesting the user to open the app by themselves. For a lightning wallet, deep links allow a mobile application to redirect users to the send or receive functionality (e.g., by clicking on a
LNURL). It is streamlining the process of making payments without navigating through multiple screens or menus.
Reduction of UX steps
One example of a Bitcoin-Lightning wallet using deep links is Blue Wallet. Developers can use the "
bluewallet:" URI scheme followed by the relevant path to deep link to a specific location within the app. For instance, to deep-link to the lightning wallet within Blue Wallet, a developer would use the following URI: "
bluewallet:lightning" followed by a LNURL.
Deep links simplify the process for users to claim rewards from businesses for completing specific tasks. Without deep links, users have to copy a LNURL, manually open their wallet, and paste the URL. With deep links, businesses can provide a "claim" button that redirects the user to the chosen wallet with a predefined deep link. The same applies to sending satoshis. Businesses can simply implement a Send button and show the user the invoice in their Lightning Wallet with one click.
In our application "Simple Bitcoin," we've implemented the process of claiming funds. Users can view their installed wallets and receive Satoshis with a single click. Recognizing installed and uninstalled wallets require additional steps based on the operating system.
Check which wallets are installed
As Lightning technology is relatively new, many users may not have a Lightning wallet installed. By predefining a set of wallets you want to offer to users, you can check if the app is installed and if not you can offer your users a download link. To offer this feature, you need the following data:
- The package id of the Android app of the wallet (e.g., "
IOSAppStoreID: The bundle id of the iOS app (e.g.,
1376878040for Blue Wallet).
LSApplicationQueriesScheme(Only for iOS): To request another app to open via deep link, add the URL scheme to your Info.plist (Same as the deeplink for the lightning wallet expect without the suffix ":lightning".
For Blue Wallet, it would look like this:
<key>LSApplicationQueriesSchemes</key> <array> <string>bluewallet</string> </array>
Depending on your mobile application's framework, you can check if an app is installed with this information. If an app isn't installed, you can redirect the user to the App Store or Google Play entry for the selected wallet.
To make it easier for you, I've compiled a list of common wallets with their deep link scheme, package id, and other necessary information:
|Wallet||Deep Link Scheme
|Wallet of Satoshi||walletofsatoshi:||com.livingroomofsatoshi.wallet||1438599608||walletofsatoshi|
Unfortunately, despite the advantages of deep links, different Bitcoin-Lightning wallets have not yet agreed on a common standard for implementing it. This can make it more challenging for developers to create a seamless experience for users when making payments or accessing other functionality across multiple wallets. Some wallet provider require a ":lightning" in front of the lnurl and some not. In the future a standard for this has to be established.
Moving forward with deep links and Lightning
As the Lightning Network continues to grow and gain adoption, it's crucial for developers to consider how deep links can enhance the user experience. By incorporating deep links, app developers can streamline navigation, reduce the number of steps needed to perform specific tasks, and ultimately improve the overall experience for users interacting with Lightning wallets.
By sharing this guide and the information on deep links with Lightning wallets, we hope to contribute to the growth of the Bitcoin-Lightning ecosystem and enable developers like you to create even more engaging and user-friendly applications.