Doing automatic payouts to users on the Lightning Network

No service wants to keep users balances forever or “become a custodian”, as that may have some complications dependending on who is doing it.

But the sad truth is that there is no way to do automatic payouts to users on the Lightning Network. So if you’re running a marketplace or a game of some kind that takes sats from some users, does something, then sends sats out to other users, you must keep a table with balances for each user.

– But I can ask for a Lightning Address!

No, you can’t, because mobile users of noncustodial wallets do not have those things generally, and that’s not the purpose of Lightning Addresses anyway. Well, of course you can, but what I’m trying to say is that you shouldn’t, as that is an anti-practice that will cause people to not want to use your service or force them into custodial providers – which may be ok for them, but may not be.

– So if I ignore the concerns above I can do this with Lightning Addresses, right?

Not really, because payments can fail. The user might input an invalid Lightning Address, or the Lightning Address may stop working after a while. Or even if it is working and online your payout can still fail for many reason inherent to Lightning.

That means you need to keep a table of balances for your users anyway. It doesn’t matter.

Since you are already keeping a table of balances, now it’s your chance to bring back the mobile noncustodial wallet users into a greater standard that accomodates everybody: LUD-14.

Wallets can implement LUD-14 support and then be made to withdraw balances from your service automatically every time they’re turned on or periodically or upon manual request from the user. That limits the amount of user balance you’ll have to keep on your service (but you can also add more rules around that, for example, automatically confiscating balances that stay parked too long, or putting a hard limit on the balance size for each user).

– But with Lightning Addresses I can do instant payouts!

Yes, you can, but that’s why LUD-15 exists: for all custodial providers, noncustodial wallets that rely on some kind of friendly server or coordinator (like Breez, Blixt or Phoenix) or even noncustodial providers running some kind of homemade server, you can dispatch these requests that cause them to withdraw the money automatically, which makes the experience similar to instant payouts – and better, since then the payment requests can be more meaningful and say they are withdrawals from your service instead of saying that you’re donating money to them (which is what most Lightning Address payments really mean).