Research/Bitcoin Dev Archive / lightning-dev list
Directionality of the transaction fees
6 messages, Dec 6 to 22, 2017. Started by Edward Marynarz.
Edward Marynarz (3), Rusty Russell (2), Johan Torås Halseth
I tried to find this information in the BOLT documents but I couldn't find it. Is it possible to set up the channel so that the fee depends on the direction, i.e. a different fee on the receive direction and different on the send one? Why such functionality?
Imagine that you start with a bidirectional channel to Alice and a channel to Bob with 1000 satoshi each. For some reasons, the network routes most of the transactions from Alice to you and then to Bob and you end up with 1900 satoshi in the Alice channel and only 100 satoshi in the Bob one. The route will stop working and if there is little traffic in the other direction you will have to close the channels to rebalance them or wait a very long time for the rebalancing.
If the fee could depend on the direction, one could start to ramp up fees on the receiving end of the channel that is getting large and lower the one that is empty to prevent the imbalance.
There is also a risk factor involved. The lightning network channels get riskier on the receive side the more the channel value deviates from the original state since the counterparty may try to broadcast the old state so you may want to regulate this imbalance with fees. It would be best if the LN applications could do it automatically.
Regards,
Edward
Hi, Edward! Welcome to the mailing list :) The fees can indeed be set for each direction of the channel, check out https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#the-channel_update-message [https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#the-channel_update-message] Basically each node in the channel can announce the fee til will take to route a payment in the direction leading “away” from it. We also have something called “channel reserves” ensuring that each node always has some balance at stake in case an old state is broadcast. Cheers! Johan
On Wed, Dec 6, 2017 at 12:04, Edziu Marynarz <edziumarynarz at gmail.com> wrote: I tried to find this information in the BOLT documents but I couldn't find it. Is it possible to set up the channel so that the fee depends on the direction, i.e. a different fee on the receive direction and different on the send one? Why such functionality? Imagine that you start with a bidirectional channel to Alice and a channel to Bob with 1000 satoshi each. For some reasons, the network routes most of the transactions from Alice to you and then to Bob and you end up with 1900 satoshi in the Alice channel and only 100 satoshi in the Bob one. The route will stop working and if there is little traffic in the other direction you will have to close the channels to rebalance them or wait a very long time for the rebalancing. If the fee could depend on the direction, one could start to ramp up fees on the receiving end of the channel that is getting large and lower the one that is empty to prevent the imbalance. There is also a risk factor involved. The lightning network channels get riskier on the receive side the more the channel value deviates from the original state since the counterparty may try to broadcast the old state so you may want to regulate this imbalance with fees. It would be best if the LN applications could do it automatically. Regards, Edward
Johan Torås Halseth <johanth at gmail.com> writes:
Quoted text (2 lines)
> Hi, Edward! Welcome to the mailing list :) > The fees can indeed be set for each direction of the channel, check out https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#the-channel_update-message [https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#the-channel_update-message]
Indeed; just to confirm, after the initial mutual channel_announce message, each peer sends its own channel_update; this means you control your own fees.
In particular, fees are charged on entry to the channel, so if there's an A->B channel, A charges the fee. If you traverse B->C, B charges the fee, etc.
Hope that clarifies, Rusty.
On Mon, Dec 11, 2017 at 12:15 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (5 lines)
> > In particular, fees are charged on entry to the channel, so if there's > an A->B channel, A charges the fee. If you traverse B->C, B charges the > fee, etc. >
Thank you for your explanations.
It's good, though not as good as if both sender and recipient could set their own fees. I know it would have made everything more complicated but receiving is actually more costly than sending. If you have less balance than the initial opening of the channel, it is risk-free. But if you have more than the initial state, you have to monitor if there are no old states published.
Another trivial question: can the fee be negative? It might help with some channel rebalancing.
I tried to get the information from BOLT #3 but BOLT's are very hard to read if you are not an expert. Who pays for the closing of the channel? Is it the person who initiates the closing? Since opening and closing fees are probably going to be larger than lifetime channel fees, it is much more important than the LN fees. I worry about a scenario that I create a channel (paying fees), send some funds through the channel to have the channel available also for receiving and the other side of the channel, simply cashes out the balance, and I'm without the channel opening fees and with no receiving channel.
Best,
Edward
Edward Marynarz <edziumarynarz at gmail.com> writes:
Quoted text (15 lines)
> On Mon, Dec 11, 2017 at 12:15 AM, Rusty Russell <rusty at rustcorp.com.au> > wrote: > >> >> In particular, fees are charged on entry to the channel, so if there's >> an A->B channel, A charges the fee. If you traverse B->C, B charges the >> fee, etc. >> > > Thank you for your explanations. > > It's good, though not as good as if both sender and recipient could set > their own fees. I know it would have made everything more complicated but > receiving is actually more costly than sending. If you have less balance > than the initial opening of the channel, it is risk-free.
But forwarding nodes do both, so they can charge appropriate fees.
Quoted text (2 lines)
> Another trivial question: can the fee be negative? It might help with some > channel rebalancing.
In my original implementation, they could be. However, that turns out to be a very strange idea, and complicates routing.
Quoted text (9 lines)
> I tried to get the information from BOLT #3 but BOLT's are very hard to > read if you are not an expert. Who pays for the closing of the channel? Is > it the person who initiates the closing? Since opening and closing fees are > probably going to be larger than lifetime channel fees, it is much more > important than the LN fees. I worry about a scenario that I create a > channel (paying fees), send some funds through the channel to have the > channel available also for receiving and the other side of the channel, > simply cashes out the balance, and I'm without the channel opening fees > and with no receiving channel.
The channel initiator pays all onchain fees, at the moment. This is simple, but potentially gamable. However, current alternatives are complex and potentially gamable, so we went with simple.
Cheers, Rusty.
On Tue, Dec 12, 2017 at 2:25 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (7 lines)
> > It's good, though not as good as if both sender and recipient could set > > their own fees. I know it would have made everything more complicated > but > > receiving is actually more costly than sending. If you have less balance > > than the initial opening of the channel, it is risk-free. > > But forwarding nodes do both, so they can charge appropriate fees.
If there is only one path, then yes. But with many paths, you cannot restrict the path you do not want to receive with.
Quoted text (20 lines)
> > > Another trivial question: can the fee be negative? It might help with > some > > channel rebalancing. > > In my original implementation, they could be. However, that turns out > to be a very strange idea, and complicates routing. > > Interesting. > important than the LN fees. I worry about a scenario that I create a > > channel (paying fees), send some funds through the channel to have the > > channel available also for receiving and the other side of the channel, > > simply cashes out the balance, and I'm without the channel opening fees > > and with no receiving channel. > > The channel initiator pays all onchain fees, at the moment. This is > simple, but potentially gamable. However, current alternatives are > complex and potentially gamable, so we went with simple. > >
So the only thing that protect a small-scale user from a hub that closes the channels with some balance fee-free is a) market pressure by avoiding the hubs that do it b) that Bitcoin is actually more expensive to receive than to send since inputs are larger than outputs?
It should indeed work now but with Schnorr signatures, b) i no longer the case and we would only rely on a). And market pressure may be a too weak incentive because it requires knowledge that hubs behave in a certain way. And this information may be difficult to obtain,
Regards,
Edward