3

Let's say I want to make some kind of gambling app:

  1. The user creates a channel with the business. (local_amt = 1000, remote_amt = 0, capacity = 1000)
  2. User bets a few times and wins a jackpot of 5000 satoshis which is more than the capacity of existing channel.

How do I transfer the 5000 sats over lightning when the channel capacity is 1000? The only way I can see getting the jackpot money to the user is by me opening a new channel with extra capacity, but obviously that would take an undesirable amount of time.

In other words, I'm curious how a site like https://www.lightningspin.com/ accomplishes instant withdrawals.

3 Answers 3

2

3 possible ways:

  1. Obviously the house can open a new channel with the user but that takes time.
  2. There is still a lightning network So even if you have a small direct channel with the house you might have some inbound capacity from other nodes and the house has some larger channels to the network. So you might not need a channel at all. The house could route the payment to you through the network even though it has a direct channel with you.
  3. Lightning invoices also have a fallback address. The house can use this address to do an onchain tx if there is no route found.
1
  • Also, Multi-part payments can help, which allows automatic splitting of a single payment into multiple smaller ones and use multiple channels for a single payout from the site. But currently they need more adoption, they are supported by the latest release of c-lightning, but not other implementations yet AFAIK. Commented Aug 5, 2020 at 8:44
1

If the user opens the channel, and funds it unilaterally with 1000, the capacity of the channel will be 1000, and the initial balance 1000 (user)/0 (remote).

Two issues to consider.

  • Liquidity (Can change over lifetime of channel): In this initial state, only the user can send funds, there is 1000 liquidity in one direction only. As payments are made from from user to remote, liquidity in the opposite direction is built up.
  • Channel capacity (Does not change over lifetime of channel): Even if there were 1000 liquidity from remote to the user resulting after payment(s) from user to remote, there isn't enough capacity to transfer 5000.

In order for the user to receive a 5000 reward described in your scenario, the following are possibilities, assuming no additional user channels:

  • The user initially funded a channel to remote with at least 5000 capacity, and has made enough bets (payments) so that their is at least 5000 liquidity from remote to user. The user has essentially gambled away 5000 worth of payments at his point.
  • An additional channel* is opened and funded by remote, to achieve the necessary capacity & liquidity to make collect this reward.

*A cynical observer may note that the house always wins, so that this is rarely necessary. **On-chain transactions are obviously an alternative way to conduct payouts.

0

House should open a channel with you to make the transfer or do it directly onchain. This is something you would need to talk with the website support ATM, but probably in future it will be more automated; if no route, ask user if wants to receive via lightning or onchain and ask for pubkey.

1
  • Pubkey -> Address.
    – James C.
    Commented Jan 9, 2019 at 9:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.