Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Routing & Beacons

7 messages, Apr 11 to May 4, 2016. Started by laurentmt.

laurentmt (4), Rusty Russell (3)

Permalink First message in the Wayback Machine

laurentmt permalink original

Hi there,

Just a LN noob here. I'm intrigued by the idea of routing based on beacons. Is it somewhat similar to the Pulse Protocol (http://www.cs.jhu.edu/~dholmer/600.647/papers/pulse_infrastructure_access.pdf) with a periodic computation of spanning trees rooted at beacons nodes ?

laurent

Rusty Russell in reply to laurentmt permalink original

laurentmt <laurentmt145 at gmail.com> writes:

Quoted text (6 lines)
> Hi there,
>
> Just a LN noob here. I'm intrigued by the idea of routing based on
> beacons. Is it somewhat similar to the Pulse Protocol
> (http://www.cs.jhu.edu/~dholmer/600.647/papers/pulse_infrastructure_access.pdf)
> with a periodic computation of spanning trees rooted at beacons nodes ?

Hi Laurent!

        There are several ways to do routing via a known set of
landmarks.  Since each node is interested in the cheapest route to and
from each beacon, that's pretty easy to propagate (simply always
broadcast the best route you know about).
        Of course, if rates are expressed as "base + per-satoshi-amount"
then "cheapest" depends on the amount, so some heuristics will be
required.

Cheers, Rusty.

laurentmt in reply to laurentmt permalink original

Hi Rusty,

If I'm correct, it means that on a given period all payments go through the selected beacons nodes ?

I ask this because some protocols like the pulse protocol are also based on beacons to update the routing tables but they don't require that all "messages" go through the beacons. "Messages" go through the first common ancestor of source and target in the spanning tree associated to the selected beacon.

The main drawback with this approach is that the source doesn't know the route beforehand... The main advantage is that it puts less "pressure" on the beacons.

Another question: have you already decided on an update strategy for the routing tables?

As I understand the problem, there's 2 variables which determine the best route:

- capacity of channels at time t (max number of bitcoins I can transfer through a given channel). It determines if a route can be used to transfer the amount.

- fees charged by nodes. It determines the best route.

Capacity is likely the most dynamic of the two variables. Do you consider capacity as an information stored in the routing tables (but it may be very challenging to keep tables up to date) or is it checked "in live" when the payment is propagated ?

laurent

Le 13/04/2016 02:40, Rusty Russell a écrit :

Quoted text (22 lines)
> laurentmt <laurentmt145 at gmail.com> writes:
>> Hi there,
>>
>> Just a LN noob here. I'm intrigued by the idea of routing based on
>> beacons. Is it somewhat similar to the Pulse Protocol
>> (http://www.cs.jhu.edu/~dholmer/600.647/papers/pulse_infrastructure_access.pdf)
>> with a periodic computation of spanning trees rooted at beacons nodes ?
>
> Hi Laurent!
>
>         There are several ways to do routing via a known set of
> landmarks.  Since each node is interested in the cheapest route to and
> from each beacon, that's pretty easy to propagate (simply always
> broadcast the best route you know about).
>
>         Of course, if rates are expressed as "base + per-satoshi-amount"
> then "cheapest" depends on the amount, so some heuristics will be
> required.
>
> Cheers,
> Rusty.
>
Rusty Russell in reply to laurentmt permalink original

laurentmt <laurentmt145 at gmail.com> writes:

Quoted text (4 lines)
> Hi Rusty,
>
> If I'm correct, it means that on a given period all payments go through
> the selected beacons nodes ?

To a first approximation, yes (obviously, if the route would go in and out the same channel, it can be eliminated, but that's statistically unlikely for a well-connected beacon).

BTW, the literature seems to use the term "landmarks", so I'm trying to stop saying "beacons" :)

Quoted text (9 lines)
> I ask this because some protocols like the pulse protocol are also based
> on beacons to update the routing tables but they don't require that all
> "messages" go through the beacons. "Messages" go through the first
> common ancestor of source and target in the spanning tree associated to
> the selected beacon.
>
> The main drawback with this approach is that the source doesn't know the
> route beforehand... The main advantage is that it puts less "pressure"
> on the beacons.

Yes, I'd really like something better, but the beacon/landmark idea is simple, enables a one-pass communication for the route (here's a QR code on how to reach me from N landmarks), and doesn't require the receiver to know the buyer's location.

Quoted text (2 lines)
> Another question: have you already decided on an update strategy for the
> routing tables?

No, I haven't. Thoughts welcome :)

Quoted text (13 lines)
> As I understand the problem, there's 2 variables which determine the
> best route:
>
> - capacity of channels at time t (max number of bitcoins I can transfer
> through a given channel). It determines if a route can be used to
> transfer the amount.
>
> - fees charged by nodes. It determines the best route.
>
> Capacity is likely the most dynamic of the two variables. Do you
> consider capacity as an information stored in the routing tables (but it
> may be very challenging to keep tables up to date) or is it checked "in
> live" when the payment is propagated ?

My base assumption is that payments are generally smaller than channel capacity, i.e. micropayments. Also, the route map itself is fairly static, and in fact could be fully known to a node: the pricing information is dynamic and needs careful thought.

You want a payment to Just Work most of the time; getting routefails and forcing retries should be unusual.

My current idea (beyond a prototype where every node chats on IRC indicating their current routes and prices) is that:

1) Prices are indicated as base + per-satoshi cost.
2) Nodes are ratelimited on their pricing updates (say, once every 30
   seconds, perhaps with some burst capacity).

I'm also considering that price changes phase in over time, indicating how they change over time from some base (eg. "increase by .01 satoshi every second from X until Y"). My concern is that slight price changes may cause massive changes in terms of traffic (once a parallel route becomes cheaper), so that makes sense. Some ratelimiting is definitely necessary because competition may well cause such route-flap.

And note that base+per-satoshi means "best route" selection depends on the value you're sending, so a handful of nominal values are probably required (so there may be different "best routes" for each one).

There's also the question of how to handle false advertising. Ideally, you should be able to broadcast the response from a node which refuses to route your payment. That gets a little complicated with onioning: it would have to sign the hash of the onion, HTLC and the routefail message, which would be checked by the previous node and encrypted, onioned all the way back to the source. If one node signs a invalid message, that can be broadcast and the node blacklisted. The sender can reveal the onion at that point and the decode key, and show that the node refused to route. It can then be temporarily blacklisted.

Sorry if this raises more questions than answers!

Cheers, Rusty.

laurentmt in reply to Rusty Russell permalink original

Thanks for the information. Indeed, it raises questions but this is exactly why I find the subject so interesting :)

WRT the update of routing tables, let me try to summarize my understanding with this scenario:

1/ Landmark nodes periodically send a message to their neighbours (every 30s ?). This message initiates a new temporal frame (symbolized by counter embedded in the message and sequentially increased by the landmark node). 2/ When a node receives the first message associated to a new temporal frame for a given landmark, it waits for a delay before forwarding the message to its own neighbours (it gives a chance to receive the same message from a better route). After this delay has elapsed, the node computes the best route to the landmark node and forward the message (information defining the temporal frame + best route to landmark node) to its neighbours. 3/ Every node repeats the same process (step 2).

When the process has completed, every node knows the best route to/from a given landmark. When a node needs to send a payment, the receiver sends her its best routes to each landmark node. Therefore the sender is able to compute the best route to reach the receiver and onion routing is possible.

Random remarks / questions:

- Agreed that the "base+per-satoshi" fee model creates a difficulty to
define the best route.
  I don't know if I'm right, but I see the base fee as a way to say "I
don't want to transfer amounts lower than X satoshis" (the base fee
makes them economically unviable).
  So, as you wrote, a solution may be a set of nominal values and the
forwarding of a set of best routes (a route for each range of amounts
between 2 nominal values).
- A shower thought: with this model, fees seem conceptually associated
to the node and there's no distinction related to the direction of the
payment (sending or receiving).
  A different model would be to associate fees to individual payment
channels (with a different fee defined for sending and receiving on this
channel).
  It means that for a given landmark, a node would forward 2 best routes
(for sending/receiving payments to/from the landmark).
  That may be useful to cope with unbalanced channels because it allows
the node to signal that, for instance, it's ok to receive payments on a
given route but sending payments is not encouraged.

- Would it be useful to have simulations ? (that may be an interesting side project on my hand).

laurent

Le 26/04/2016 02:43, Rusty Russell a écrit :

Quoted text (88 lines)
> laurentmt <laurentmt145 at gmail.com> writes:
>> Hi Rusty,
>>
>> If I'm correct, it means that on a given period all payments go through
>> the selected beacons nodes ?
>
> To a first approximation, yes (obviously, if the route would go in and
> out the same channel, it can be eliminated, but that's statistically
> unlikely for a well-connected beacon).
>
> BTW, the literature seems to use the term "landmarks", so I'm trying to stop
> saying "beacons" :)
>
>> I ask this because some protocols like the pulse protocol are also based
>> on beacons to update the routing tables but they don't require that all
>> "messages" go through the beacons. "Messages" go through the first
>> common ancestor of source and target in the spanning tree associated to
>> the selected beacon.
>>
>> The main drawback with this approach is that the source doesn't know the
>> route beforehand... The main advantage is that it puts less "pressure"
>> on the beacons.
>
> Yes, I'd really like something better, but the beacon/landmark idea is
> simple, enables a one-pass communication for the route (here's a QR code
> on how to reach me from N landmarks), and doesn't require the receiver
> to know the buyer's location.
>
>> Another question: have you already decided on an update strategy for the
>> routing tables?
>
> No, I haven't.  Thoughts welcome :)
>
>> As I understand the problem, there's 2 variables which determine the
>> best route:
>>
>> - capacity of channels at time t (max number of bitcoins I can transfer
>> through a given channel). It determines if a route can be used to
>> transfer the amount.
>>
>> - fees charged by nodes. It determines the best route.
>>
>> Capacity is likely the most dynamic of the two variables. Do you
>> consider capacity as an information stored in the routing tables (but it
>> may be very challenging to keep tables up to date) or is it checked "in
>> live" when the payment is propagated ?
>
> My base assumption is that payments are generally smaller than channel
> capacity, i.e. micropayments.  Also, the route map itself is fairly
> static, and in fact could be fully known to a node: the pricing
> information is dynamic and needs careful thought.
>
> You want a payment to Just Work most of the time; getting routefails and
> forcing retries should be unusual.
>
> My current idea (beyond a prototype where every node chats on IRC
> indicating their current routes and prices) is that:
>
> 1) Prices are indicated as base + per-satoshi cost.
> 2) Nodes are ratelimited on their pricing updates (say, once every 30
>    seconds, perhaps with some burst capacity).
>
> I'm also considering that price changes phase in over time, indicating
> how they change over time from some base (eg. "increase by .01 satoshi
> every second from X until Y").  My concern is that slight price changes
> may cause massive changes in terms of traffic (once a parallel route
> becomes cheaper), so that makes sense.  Some ratelimiting is definitely
> necessary because competition may well cause such route-flap.
>
> And note that base+per-satoshi means "best route" selection depends on
> the value you're sending, so a handful of nominal values are probably
> required (so there may be different "best routes" for each one).
>
> There's also the question of how to handle false advertising.  Ideally,
> you should be able to broadcast the response from a node which refuses
> to route your payment.  That gets a little complicated with onioning: it
> would have to sign the hash of the onion, HTLC and the routefail
> message, which would be checked by the previous node and encrypted,
> onioned all the way back to the source.  If one node signs a invalid
> message, that can be broadcast and the node blacklisted.  The sender can
> reveal the onion at that point and the decode key, and show that the
> node refused to route.  It can then be temporarily blacklisted.
>
> Sorry if this raises more questions than answers!
>
> Cheers,
> Rusty.
>
Rusty Russell in reply to laurentmt permalink original

laurentmt <laurentmt145 at gmail.com> writes:

Quoted text (10 lines)
> Thanks for the information. Indeed, it raises questions but this is
> exactly why I find the subject so interesting :)
>
> WRT the update of routing tables, let me try to summarize my
> understanding with this scenario:
>
> 1/ Landmark nodes periodically send a message to their neighbours (every
> 30s ?). This message initiates a new temporal frame (symbolized by
> counter embedded in the message and sequentially increased by the
> landmark node).

Technically, the landmark would ve a channel; it's just easier to select on that basis (since channels exist in the blockchain, you can prove it existed prior to landmark selection).

But your idea of temporal framing is new to me.

I had considered that we simply limit a single hop to advertising every 30 seconds, and you only re-broadcast if it's the best. That requires maintaining a little state for each hop you rebroadcast.

Quoted text (4 lines)
> 2/ When a node receives the first message associated to a new temporal
> frame for a given landmark, it waits for a delay before forwarding the
> message to its own neighbours (it gives a chance to receive the same
> message from a better route).

Hmm, I'm not sure how to calibrate that delay though? If everyone is delaying it's not clear that you'll hear about the better route, is it?

Quoted text (10 lines)
> After this delay has elapsed, the node computes the best route to the
> landmark node and forward the message (information defining the temporal
> frame + best route to landmark node) to its neighbours.
> 3/ Every node repeats the same process (step 2).
>
> When the process has completed, every node knows the best route to/from
> a given landmark.
> When a node needs to send a payment, the receiver sends her its best
> routes to each landmark node. Therefore the sender is able to compute
> the best route to reach the receiver and onion routing is possible.

s/to each landmark/from each landmark/

Quoted text (10 lines)
> Random remarks / questions:
>
> - Agreed that the "base+per-satoshi" fee model creates a difficulty to
> define the best route.
>   I don't know if I'm right, but I see the base fee as a way to say "I
> don't want to transfer amounts lower than X satoshis" (the base fee
> makes them economically unviable).
>   So, as you wrote, a solution may be a set of nominal values and the
> forwarding of a set of best routes (a route for each range of amounts
> between 2 nominal values).

Yes, I think so.

Quoted text (6 lines)
> - A shower thought: with this model, fees seem conceptually associated
> to the node and there's no distinction related to the direction of the
> payment (sending or receiving).
>   A different model would be to associate fees to individual payment
> channels (with a different fee defined for sending and receiving on this
> channel).

Yes; if landmarks are channels, then I think it falls out naturally.

There's a related question on how fees are collected: simplest is that the node pushing the HTLC into the channel collects the fee. This implies that they unilaterally set the fee for that direction.

But I wonder about weird fee games where one side charges far more than the other; are they completely independent or do they negotiate? My gut feeling is that it all works out: if the You->Me direction is popular today and you're making a mint, I'll be doing well from the Me->next-hop channels too.

Quoted text (5 lines)
>   It means that for a given landmark, a node would forward 2 best routes
> (for sending/receiving payments to/from the landmark).
>   That may be useful to cope with unbalanced channels because it allows
> the node to signal that, for instance, it's ok to receive payments on a
> given route but sending payments is not encouraged.

Definitely need asymmetry for balancing.

Quoted text (2 lines)
> - Would it be useful to have simulations ? (that may be an interesting
> side project on my hand).

This could well offer some insight.

Anthony Towns (added to To) did some simulations, but other than a simple YouTube video I'm not aware of any published results.

Cheers, Rusty.

laurentmt in reply to Rusty Russell permalink original

Le 03/05/2016 01:27, Rusty Russell a écrit :

Quoted text (17 lines)
> laurentmt <laurentmt145 at gmail.com> writes:
>> Thanks for the information. Indeed, it raises questions but this is
>> exactly why I find the subject so interesting :)
>>
>> WRT the update of routing tables, let me try to summarize my
>> understanding with this scenario:
>>
>> 1/ Landmark nodes periodically send a message to their neighbours (every
>> 30s ?). This message initiates a new temporal frame (symbolized by
>> counter embedded in the message and sequentially increased by the
>> landmark node).
>
> Technically, the landmark would ve a channel; it's just easier to select
> on that basis (since channels exist in the blockchain, you can prove it
> existed prior to landmark selection).
>
> But your idea of temporal framing is new to me.

Actually, the process described in my previous message is directly inspired from the Pulse Protocol I was citing in my first email (a "pulse" is the periodic message sent by landmark nodes to update routing tables). While this protocol was designed for a very different goal (routing on "multi-hop wireless infrastructures"), there may be interesting ideas for LN routing. This paper (http://www.cs.jhu.edu/~dholmer/600.647/papers/pulse_infrastructure_access.pdf) should be much better than explanations sent with my crappy english. :D

Quoted text (13 lines)
>
> I had considered that we simply limit a single hop to advertising every
> 30 seconds, and you only re-broadcast if it's the best.  That requires
> maintaining a little state for each hop you rebroadcast.
>
>> 2/ When a node receives the first message associated to a new temporal
>> frame for a given landmark, it waits for a delay before forwarding the
>> message to its own neighbours (it gives a chance to receive the same
>> message from a better route).
>
> Hmm, I'm not sure how to calibrate that delay though?  If everyone is
> delaying it's not clear that you'll hear about the better route, is it?
>

Agreed. Another constraint is related to the topology of the network (more especially to its diameter). Time required to propagate the message to the full network should be much lower than the period of the mechanism (30s).

There's clearly a trade-off to be made. Delay should be long enough to maximize the probability that you hear about the best route but short enough to ensure fast propagation of the message across the network.

Quoted text (12 lines)
>> After this delay has elapsed, the node computes the best route to the
>> landmark node and forward the message (information defining the temporal
>> frame + best route to landmark node) to its neighbours.
>> 3/ Every node repeats the same process (step 2).
>>
>> When the process has completed, every node knows the best route to/from
>> a given landmark.
>> When a node needs to send a payment, the receiver sends her its best
>> routes to each landmark node. Therefore the sender is able to compute
>> the best route to reach the receiver and onion routing is possible.
>
> s/to each landmark/from each landmark/

Yes ! The route to the landmark wouldn't be very useful :)

Quoted text (33 lines)
>
>> Random remarks / questions:
>>
>> - Agreed that the "base+per-satoshi" fee model creates a difficulty to
>> define the best route.
>>   I don't know if I'm right, but I see the base fee as a way to say "I
>> don't want to transfer amounts lower than X satoshis" (the base fee
>> makes them economically unviable).
>>   So, as you wrote, a solution may be a set of nominal values and the
>> forwarding of a set of best routes (a route for each range of amounts
>> between 2 nominal values).
>
> Yes, I think so.
>
>> - A shower thought: with this model, fees seem conceptually associated
>> to the node and there's no distinction related to the direction of the
>> payment (sending or receiving).
>>   A different model would be to associate fees to individual payment
>> channels (with a different fee defined for sending and receiving on this
>> channel).
>
> Yes; if landmarks are channels, then I think it falls out naturally.
>
> There's a related question on how fees are collected: simplest is that
> the node pushing the HTLC into the channel collects the fee.  This
> implies that they unilaterally set the fee for that direction.
>
> But I wonder about weird fee games where one side charges far more than
> the other; are they completely independent or do they negotiate?  My gut
> feeling is that it all works out: if the You->Me direction is popular
> today and you're making a mint, I'll be doing well from the Me->next-hop
> channels too.
>

Interesting. My initial thought was that each side of a channel may charge a fee for the use of the channel because it allows each one to signal its (dis)agreement for the use of the channel in a specific direction.

But it makes the implementation more complex and your observation highlights that it can be achieved differently. For instance, if I propose the unbalanced route (Me-->You), you may signal your "disagreement" by deciding to charge a higher fee for the next hop and in some cases it may lead you to forward another route as the best route.

Quoted text (19 lines)
>>   It means that for a given landmark, a node would forward 2 best routes
>> (for sending/receiving payments to/from the landmark).
>>   That may be useful to cope with unbalanced channels because it allows
>> the node to signal that, for instance, it's ok to receive payments on a
>> given route but sending payments is not encouraged.
>
> Definitely need asymmetry for balancing.
>
>> - Would it be useful to have simulations ? (that may be an interesting
>> side project on my hand).
>
> This could well offer some insight.
>
> Anthony Towns (added to To) did some simulations, but other than a
> simple YouTube video I'm not aware of any published results.
>
> Cheers,
> Rusty.
>

laurent