Research/Bitcoin Dev Archive / lightning-dev list
Generalizing proportional routing fees to exchange rates
5 messages, May 20 to 24, 2017. Started by ZmnSCPxj.
ZmnSCPxj (3), Rusty Russell, Christian Decker
Good morning list,
I would like to propose a modification to lightning protocol, regarding the use of proportional routing fees.
Consider Alice with a channel to Bob, who has a channel to Carol, and Alice must pay Carol 1.0BTC.
Bob advertises that he wants a 0.1% proportional fee, translating to 1,000/1,000,000 proportional routing fee.
(I ignore the fixed fee for now)
This means, Alice must send 1.001 BTC to Bob, who then sends 1.0 BTC to Carol.
This translates to Bob actually having approximately 0.999001 BTC-to-BTC exchange rate.
Since part of Lightning Network's roadmap is to eventually have cross-chain nodes, I would like to propose that, in lieu of advertising proportional routing fees, nodes advertise a BTC-to-BTC exchange rate. Then, we can generalize this exchange rate to cross-chain case.
A node needs to advertise multiple exchange rates for various coins. Currently, Lightning designates supported coins by hashes of their genesis blocks (32-byte `chain_hash`). An exchange rate denominated in ratio of 1/1,000,000 can be encoded in 4 bytes. Thus to advertise exchange rates a node provides 64 bytes to identify the coins being referred to, and 4 bytes for the actual exchange rate. For cross-chain exchange rates, a node needs to advertise both directions (e.g. LTC-to-BTC and BTC-to-LTC).
Possibly one way to advertise would be to advertise a BTC-to-LTC exchange rate plus a rate offset. For example, Bob might operate as a cross-chain exchange for LTC and BTC, and advertise a BTC-to-LTC rate of 4,000,000/1,000,000 (4 output LTC's for 1 input BTC), as well as a rate offset of 1,000/1,000,000.
If Alice sends LTC to Bob to be converted to 1.0BTC for Carol, she has to compute the Bob's exchange rate as (4,000,000+1,000)/1,000,000, then compute from the 1.0BTC for Carol to 1.0 * (4,001,000/1,000,000) as 4.001LTC to Bob.
If Carol sends BTC to Bob to be converted to 1.0LTC for Alice, she has to compute the Bob's exchange rate as (4,000,000-1,000)/1,000,000, then compute from the 1.0LTC for Alice to 1.0 / (3,999,000/1,000,000) as 0.25006252BTC to Bob.
Has this been considered and rejected before?
Regards, ZmnSCPxj
ZmnSCPxj via Lightning-dev <lightning-dev at lists.linuxfoundation.org> writes:
Quoted text (4 lines)
> Good morning list, > > I would like to propose a modification to lightning protocol, > regarding the use of proportional routing fees.
There needs to be more information across networks than just the exchange rate. For example, you need to know the block numbers for CLTV timeouts on both sides, and you need to know the topology of the network on both sides. Those are problems we can push to the edges of the network, and nobody else should notice.
Moreover, there are two general problems with random currencies on lightning. Firstly, it's not clear why you'd want them once bitcoin has lightning: why use a highway to nowhere (unless you have invested money in nowhere, of course). Secondly, we've made several assumptions that it's not free to create channels, which punts many DoS problems to the underlying blockchain. If you can create free channels, this protection vanishes.
Finally, we're trying to close down spec changes, so we're reluctant to add features to 1.0 if we can avoid it.
Thanks! Rusty.
Good morning Rusty,
Thank you for your many explanations, I appreciate it.
Quoted text (9 lines)
>> >> I would like to propose a modification to lightning protocol, >> regarding the use of proportional routing fees. > >There needs to be more information across networks than just the >exchange rate. For example, you need to know the block numbers for CLTV >timeouts on both sides, and you need to know the topology of the >network on both sides. Those are problems we can push to the edges >of the network, and nobody else should notice.
Do you mean, there will be some special LN variant or service specifically for cross-chain operation (i.e. "edge of the network")?
Quoted text (4 lines)
>Moreover, there are two general problems with random currencies on >lightning. Firstly, it's not clear why you'd want them once bitcoin has >lightning: why use a highway to nowhere (unless you have invested money >in nowhere, of course).
I suppose that would be a good reason to want altcoin on LN....
Quoted text (4 lines)
>Secondly, we've made several assumptions that >it's not free to create channels, which punts many DoS problems to the >underlying blockchain. If you can create free channels, this protection >vanishes.
By "free", do you refer to the fact, that most altcoins have low or practically 0 transaction fees?
Quoted text (2 lines)
>Finally, we're trying to close down spec changes, so we're reluctant to >add features to 1.0 if we can avoid it.
I understand.
Regards, ZmnSCPxj
On Tue, May 23, 2017 at 06:41:33PM -0400, ZmnSCPxj via Lightning-dev wrote:
Quoted text (8 lines)
> >There needs to be more information across networks than just the > >exchange rate. For example, you need to know the block numbers for CLTV > >timeouts on both sides, and you need to know the topology of the > >network on both sides. Those are problems we can push to the edges > >of the network, and nobody else should notice. > > Do you mean, there will be some special LN variant or service > specifically for cross-chain operation (i.e. "edge of the network")?
The edge of the network in this case refers to either the node performing the exchange, i.e., straddling both blockchains by having channels in both, and the endpoint creating the route, i.e., the sender of the transfer. These are the only ones who need to concern themselves with the problems that come from this being a cross-chain transfer. There may be some added noise for other nodes when it comes to being able to prove things along routes, e.g., "here's proof that the next hop is misbehaving" if we don't understand the proof since it is in a blockchain we don't know. But since the node straddling the chains is already providing the exchange service it can simply increase its margin to compensate for these cases.
It is far more efficient then to have them communicate out of band by creating an order book on top of the base network and do order matching in there, rather than attempting to fit this added complexity into LN itself.
Quoted text (6 lines)
> >Moreover, there are two general problems with random currencies on > >lightning. Firstly, it's not clear why you'd want them once bitcoin has > >lightning: why use a highway to nowhere (unless you have invested money > >in nowhere, of course). > > I suppose that would be a good reason to want altcoin on LN....
While I understand the interest in LN as a decentralized and trustless exchange, I think our primary goal is to create a payment network, and accomodating the cross-chain needs brings in a lot of complexity into an already complex system, with the need to translate all parameters into Bitcoin equivalent terms (CLTV, amount, off-chain fees, on-chain fees, ...). So I'm also rather hesitant to consider them now, while we haven't gotten the base network off the ground in the simple one chain scenario. Like Rusty I'd like to punt this to a future version of the protocol.
Quoted text (7 lines)
> >Secondly, we've made several assumptions that > >it's not free to create channels, which punts many DoS problems to the > >underlying blockchain. If you can create free channels, this protection > >vanishes. > > By "free", do you refer to the fact, that most altcoins have low or > practically 0 transaction fees?
Yes, many of the DoS deterrents require Bitcoin-like on-chain fees to work at all. As I mentioned above we might push the risk onto the nodes straddling the chains, but how attractive would their service be if they need to charge high fees to absorb that risk?
I'd like to apologize for braking so much with the ideas you have come up, I just wanted to make it clear that we are currently focusing on slowing down the evolution of the 1.0 spec, so that we can finalize our implementations and start integration testing. It should not dissuade you from bringing them up, and I'd encourage discussion on the ML, as long as it is understood that it likely won't be part of the the 1.0 spec ;-)
Cheers, Christian
Quoted text (20 lines)
>> >There needs to be more information across networks than just the >> >exchange rate. For example, you need to know the block numbers for CLTV >> >timeouts on both sides, and you need to know the topology of the >> >network on both sides. Those are problems we can push to the edges >> >of the network, and nobody else should notice. >> >> Do you mean, there will be some special LN variant or service >> specifically for cross-chain operation (i.e. "edge of the network")? > >The edge of the network in this case refers to either the node >performing the exchange, i.e., straddling both blockchains by having >channels in both, and the endpoint creating the route, i.e., the >sender of the transfer. These are the only ones who need to concern >themselves with the problems that come from this being a cross-chain >transfer. There may be some added noise for other nodes when it comes >to being able to prove things along routes, e.g., "here's proof that >the next hop is misbehaving" if we don't understand the proof since it >is in a blockchain we don't know. But since the node straddling the >chains is already providing the exchange service it can simply >increase its margin to compensate for these cases.
Ah, so my understanding, this is some variant of LN or a layer on top of LN which basically has some extensions, and that this will be for some future development.
Quoted text (4 lines)
>It is far more efficient then to have them communicate out of band by >creating an order book on top of the base network and do order >matching in there, rather than attempting to fit this added complexity >into LN itself.
I understand.
Quoted text (16 lines)
>> >Moreover, there are two general problems with random currencies on >> >lightning. Firstly, it's not clear why you'd want them once bitcoin has >> >lightning: why use a highway to nowhere (unless you have invested money >> >in nowhere, of course). >> >> I suppose that would be a good reason to want altcoin on LN.... > >While I understand the interest in LN as a decentralized and trustless >exchange, I think our primary goal is to create a payment network, and >accomodating the cross-chain needs brings in a lot of complexity into >an already complex system, with the need to translate all parameters >into Bitcoin equivalent terms (CLTV, amount, off-chain fees, on-chain >fees, ...). So I'm also rather hesitant to consider them now, while we >haven't gotten the base network off the ground in the simple one chain >scenario. Like Rusty I'd like to punt this to a future version of the >protocol.
I understand.
Quoted text (12 lines)
>> >Secondly, we've made several assumptions that >> >it's not free to create channels, which punts many DoS problems to the >> >underlying blockchain. If you can create free channels, this protection >> >vanishes. >> >> By "free", do you refer to the fact, that most altcoins have low or >> practically 0 transaction fees? > >Yes, many of the DoS deterrents require Bitcoin-like on-chain fees to >work at all. As I mentioned above we might push the risk onto the >nodes straddling the chains, but how attractive would their service be >if they need to charge high fees to absorb that risk?
I understand. It is very interesting to me to consider about how incentives work out in this situation, and I shall study further.
Quoted text (7 lines)
>I'd like to apologize for braking so much with the ideas you have come >up, I just wanted to make it clear that we are currently focusing on >slowing down the evolution of the 1.0 spec, so that we can finalize >our implementations and start integration testing. It should not >dissuade you from bringing them up, and I'd encourage discussion on >the ML, as long as it is understood that it likely won't be part of >the the 1.0 spec ;-)
There is no need to apologize, I understand completely. I am studying now the components needed to make Lightning Network work, and I shall continue to ask.
A quick question. Is it possible to (at least theoretically) create an LN node software that is effectively SPV? From my current understanding of current LN software, it seems most of them require some Bitcoin core full or pruning node, or integrates such functionality. Perhaps, lit appears to use SPV, though I have not delved much into the code, so I suppose my understanding is correct.
Regards, ZmnSCPxj