Sending Bitcoin Over Lightning
How to build flawless Lightning sending experiences for your customers
Design Guide
Whether your users are withdrawing from an exchange or simply paying a friend, the process of sending bitcoin is a very critical part of the experience for your product. If there is too much friction during the send process, then it impedes the primary use-cases of bitcoin, which is a form of money.
As bitcoin has matured over 15+ years, it has accrued a plethora of payment request formats. When it comes to receiving, you may only support a few of these. However, for sending, it’s important that you try to support as many of these payment request formats as possible. At the very bare minimum, it is a good idea to be able to detect and parse these formats so you can provide good messaging for your users, even if you are not capable of sending to them.
The Happy Path - Lightning Sends
At Voltage, we believe that the Lightning network is a great solution for a variety of use-cases. It gives you near-instant final settlement and it works for both small amounts and large amounts. We find Lightning fees to be typically smaller than on-chain fees. Of course, there will be situations where on-chain payments make more sense (very large payments, for example). But in general, we feel Lightning is a sensible default.
As such, we’ve outlined the Happy Path: your customer goes to send bitcoin from your product using a lightning compatible payment format. Both you and your customer save on-chain fees.
Helping Your Users Save on Fees
There will be some situations where your customers are going to try sending to an on-chain address for small amounts of bitcoin. In this situation, it might save them time and money to use Lightning. It will save them from higher on-chain fees. It will also prevent creating tiny on-chain coins which might be more expensive to use later. Of course, you should not prevent your users from sending on-chain if that is what they would like to do. However, it might be worth letting them know they could save fees with a Lightning format.
Sending to Usernames
There are a few options in bitcoin for usernames. The current best practice is BIP-353 usernames, because they are verifiable and support many payment formats. The legacy Lightning address format is also widely used.
Handling Errors
Things don’t always go according to plan. Make sure you are surfacing error messages that are informative to your users. Avoid going into too much technical detail and instead focus on helping them understand what they can do to fix the problem.