Rusty Russell [ARCHIVE] on Nostr: 📅 Original date posted:2015-09-22 📝 Original message: Anthony Towns <aj at ...
📅 Original date posted:2015-09-22
📝 Original message:
Anthony Towns <aj at erisian.com.au> writes:
> On Mon, Sep 21, 2015 at 11:46:13AM +0930, Rusty Russell wrote:
>> We regularly choose a dozen "beacon" nodes at random (using proximity to
>> the SHA of latest block hash or something). Everyone propagates the
>> cheapest route to & from those nodes (which is pretty efficient, similar
>> to your scheme).
>
> I think what you're implicitly assuming here is:
>
> a) global p2p network of lightning nodes; at a minimum each node has
> a connection to every node it has a channel open with
>
> b) consensus protocol for choosing an ordering of potential beacons
>
> c) potential beacons have to have committed to a beacon id prior to
> ordering being chosen (with spam/flooding protection)
>
> d) gossip protocol to announce potential beacons and compare against
> ordering, keeping the top few in memory.
>
> e) sharing routes to beacons with direct neighbours
>
> f) distributed hash to store/lookup route recommendations, keyed by
> beacon/endpoint
>
> g) distributed hash to lookup fees for hops keyed by hop ends
>
>
> I think (a) is trivial; and you already called out (b).
>
> For (c), not having a commitment means that people could generate a new
> node id that does well in the ordering algorithm after the fact; if it's
> SHA comparisons, that means miners would likely monopolise being a beacon.
>
>> 4) How to avoid fake beacons?
>> Require a signature attached to an unspent bitcoin TX from before
>> beacon selection? That TXID is actually what competes to be close
>> to the beacon selector.
>
> This might as well be the (an) anchor transaction. It's already in the
> blockchain, it's already associated with a channel. You couldn't just
> use the txid directly, because that wouldn't differentiate between
> endpoints though. This would give an advantage to nodes with lots of
> channels open; not sure whether that's desirable? Probably it is?
>
> For (d), once you've got the ordering, nodes tell each other about their
> 12 favourite beacons, and if they hear about better ones, they pass those
> on too. That needs to be global knowledge, but it doesn't matter too much
> if we have slightly different sets of 12 beacons at any point. 12 beacon
> ids is a fine amount of information to pass around globally, too.
>
> For (e), I don't think you want to gossip globally about routes --
> that's too much information to pass around if it's not necessary; but
> you still have to share your routes to beacons with your neighbours in
> order to figure anything out. Nodes announcing their best routes to their
> neighbours is basically just Dijkstra's algorithm in parallel I think.
Indeed, it's trivial (and I've already implemented a simple simulator to
do it). The initial spamminess can be mitigated by waiting before
broadcasting depending on how likely you are a beacon.
> But just knowing your neighbours' routes isn't enough; you need to be
> able to lookup a route for anyone, and that (by definition I think)
> means you need (f) a DHT of routes-to-beacons. Note that looking up a
> route has privacy implications, in that it implies you're probably going
> to make a payment along that route!
That's why the recipient provides a set of routes from (some subset of)
beacons to them. You know routes to all beacons, so pathfinding solved.
>> To receive a payment, B picks a few beacon nodes at random and sends
>> those routes (beacons -> B) to A. Presumably A knows its route to all
>> the beacon nodes and thus can choose the best.
>
> A trivial DHT would be to have each node store its routes locally,
> and just make a TCP/IP connection to the node directly to ask for its
> routes. That seems like it'd be pretty bad for privacy though. I'm a
> fan of being able to route to/through nodes you can't reach via IP, and
> this would prevent that too.
Yes, that's a bad idea. And I'm not sure why you need this?
> Finally for (g), I don't think you want to store fees in the routes
> directly, since updating fees would require updating an unknown number
> of routes; but fees have to be queryable, so that's a separate DHT. This
> one doesn't need to be updated when new beacons are elected though. This
> DHT would want to be fairly high performance, because you're doing 2*B*L
> lookups everytime you want to find a route, and it has to accept and
> propogate updates fairly quickly if fees change.
Well, propagating fee updates for (say) 1200 routes isn't too bad,
as long as they're not changing too fast.
>> There are some twisty details here:
>> 1) How many beacon nodes?
>> 12, and increase on a log scale with network size. That size can
>> be derived from previous beacons.
>
> I think it's also something you could set per-node, like the
> minrelaytxfee.
That doesn't make sense, since we need to agree on who is a beacon.
>> 2) How long between selection and a beacon becoming active?
>> 10 blocks. That gives time for others to connect to beacon node.
>
> Beacons can be "active" as soon as you can route through them, and that's
> just a DHT lookup to determine, and then a matter of comparing fees to
> what the old beacons give you. So I think no artificial delay is needed,
> and the real question is just when you expire your routes to/from the
> old beacons?
No. Beacons will get saturated fast unless they have a chance to
prepare. In particular, the network will want to establish channels
with new beacons, and beacons may well want to bring offline funds
online to handle the anticipated capacity.
>> 3) How long before a beacon node is invalid?
>> No idea. Let's keep a day's worth for the moment?
>
> Sounds fine; also mostly a client side parameter. (Though if the routing
> DHT is non-trivial, old beacons should expire from there after some
> interval too to deal with nodes that disappear)
>
>> 5) How to update beacon routing?
>> Particularly for fee changes, this is important. Best effort,
>> with ratelimiting. I hope eventually we'll have reasonable traffic
>> models so a node can say "I'm going to ramp up/down my fees for
>> this long at this rate" and have a reasonable chance that it's true.
>
> I think this is reinventing DHTs, though maybe none of the existing ones
> work well enough for this use case?
What's the fascination with DHTs?
> I think rate limiting decreases in fees is always safe (it won't prevent
> any transactions going through, it will only prevent them being started).
>
> (I'm not sure a programmed ramp-up/down of fees makes sense; though
> maybe it would be a good way to perform price discovery)
>
>> PS. For the immediate term, we'll use a global comms mechanism like
>> IRC, but that's just a prototype hack.
>
> Hmm. Counterproposal: no beacons or routing DHT, just fees by gossip
> protocol (or IRC channel as prototype hack). Everyone has a complete
> (but possibly slightly out of date) database of node-node (but not
> node-wallet) channel fees, and changes are propogated by gossip. Back
> of the envelope maths:
>
> everyone uses lightning ==> 8B wallets (5B teens/adults, 3B businesses)
> every wallet has ~4 channels ==> 32B node-wallet channels
> 100k wallet channels per node on average ==> 320k nodes
Um, so each wallet isn't a node? That's a very different architecture,
which uses hosted wallets or something? I don't think that's very
interesting.
Cheers,
Rusty.
Published at
2023-06-09 12:44:29Event JSON
{
"id": "47e0558a4624fb987af8c0b2e7132de976cd0e3799be8e781abe91057dd9a8ea",
"pubkey": "13bd8c1c5e3b3508a07c92598647160b11ab0deef4c452098e223e443c1ca425",
"created_at": 1686314669,
"kind": 1,
"tags": [
[
"e",
"d508e26ae44d949f7c534399c4b1e4f82df043bc5ea4ea4a1d4d81571bfaec45",
"",
"root"
],
[
"e",
"b94017615df9d6b0ffd7cfb52cbeefcaca74b69fb88b982847fca122938558ba",
"",
"reply"
],
[
"p",
"f0feda6ad58ea9f486e469f87b3b9996494363a26982b864667c5d8acb0542ab"
]
],
"content": "📅 Original date posted:2015-09-22\n📝 Original message:\nAnthony Towns \u003caj at erisian.com.au\u003e writes:\n\u003e On Mon, Sep 21, 2015 at 11:46:13AM +0930, Rusty Russell wrote:\n\u003e\u003e We regularly choose a dozen \"beacon\" nodes at random (using proximity to\n\u003e\u003e the SHA of latest block hash or something). Everyone propagates the\n\u003e\u003e cheapest route to \u0026 from those nodes (which is pretty efficient, similar\n\u003e\u003e to your scheme).\n\u003e\n\u003e I think what you're implicitly assuming here is:\n\u003e\n\u003e a) global p2p network of lightning nodes; at a minimum each node has\n\u003e a connection to every node it has a channel open with\n\u003e\n\u003e b) consensus protocol for choosing an ordering of potential beacons\n\u003e\n\u003e c) potential beacons have to have committed to a beacon id prior to\n\u003e ordering being chosen (with spam/flooding protection)\n\u003e\n\u003e d) gossip protocol to announce potential beacons and compare against\n\u003e ordering, keeping the top few in memory.\n\u003e\n\u003e e) sharing routes to beacons with direct neighbours\n\u003e\n\u003e f) distributed hash to store/lookup route recommendations, keyed by\n\u003e beacon/endpoint\n\u003e\n\u003e g) distributed hash to lookup fees for hops keyed by hop ends\n\u003e\n\u003e\n\u003e I think (a) is trivial; and you already called out (b).\n\u003e\n\u003e For (c), not having a commitment means that people could generate a new\n\u003e node id that does well in the ordering algorithm after the fact; if it's\n\u003e SHA comparisons, that means miners would likely monopolise being a beacon.\n\u003e\n\u003e\u003e 4) How to avoid fake beacons?\n\u003e\u003e Require a signature attached to an unspent bitcoin TX from before\n\u003e\u003e beacon selection? That TXID is actually what competes to be close\n\u003e\u003e to the beacon selector.\n\u003e\n\u003e This might as well be the (an) anchor transaction. It's already in the\n\u003e blockchain, it's already associated with a channel. You couldn't just\n\u003e use the txid directly, because that wouldn't differentiate between\n\u003e endpoints though. This would give an advantage to nodes with lots of\n\u003e channels open; not sure whether that's desirable? Probably it is?\n\u003e\n\u003e For (d), once you've got the ordering, nodes tell each other about their\n\u003e 12 favourite beacons, and if they hear about better ones, they pass those\n\u003e on too. That needs to be global knowledge, but it doesn't matter too much\n\u003e if we have slightly different sets of 12 beacons at any point. 12 beacon\n\u003e ids is a fine amount of information to pass around globally, too.\n\u003e\n\u003e For (e), I don't think you want to gossip globally about routes --\n\u003e that's too much information to pass around if it's not necessary; but\n\u003e you still have to share your routes to beacons with your neighbours in\n\u003e order to figure anything out. Nodes announcing their best routes to their\n\u003e neighbours is basically just Dijkstra's algorithm in parallel I think.\n\nIndeed, it's trivial (and I've already implemented a simple simulator to\ndo it). The initial spamminess can be mitigated by waiting before\nbroadcasting depending on how likely you are a beacon.\n\n\u003e But just knowing your neighbours' routes isn't enough; you need to be\n\u003e able to lookup a route for anyone, and that (by definition I think)\n\u003e means you need (f) a DHT of routes-to-beacons. Note that looking up a\n\u003e route has privacy implications, in that it implies you're probably going\n\u003e to make a payment along that route!\n\nThat's why the recipient provides a set of routes from (some subset of)\nbeacons to them. You know routes to all beacons, so pathfinding solved.\n\n\u003e\u003e To receive a payment, B picks a few beacon nodes at random and sends\n\u003e\u003e those routes (beacons -\u003e B) to A. Presumably A knows its route to all\n\u003e\u003e the beacon nodes and thus can choose the best.\n\u003e\n\u003e A trivial DHT would be to have each node store its routes locally,\n\u003e and just make a TCP/IP connection to the node directly to ask for its\n\u003e routes. That seems like it'd be pretty bad for privacy though. I'm a\n\u003e fan of being able to route to/through nodes you can't reach via IP, and\n\u003e this would prevent that too.\n\nYes, that's a bad idea. And I'm not sure why you need this?\n\n\u003e Finally for (g), I don't think you want to store fees in the routes\n\u003e directly, since updating fees would require updating an unknown number\n\u003e of routes; but fees have to be queryable, so that's a separate DHT. This\n\u003e one doesn't need to be updated when new beacons are elected though. This\n\u003e DHT would want to be fairly high performance, because you're doing 2*B*L\n\u003e lookups everytime you want to find a route, and it has to accept and\n\u003e propogate updates fairly quickly if fees change.\n\nWell, propagating fee updates for (say) 1200 routes isn't too bad,\nas long as they're not changing too fast.\n\n\u003e\u003e There are some twisty details here:\n\u003e\u003e 1) How many beacon nodes?\n\u003e\u003e 12, and increase on a log scale with network size. That size can\n\u003e\u003e be derived from previous beacons.\n\u003e\n\u003e I think it's also something you could set per-node, like the\n\u003e minrelaytxfee.\n\nThat doesn't make sense, since we need to agree on who is a beacon.\n\n\u003e\u003e 2) How long between selection and a beacon becoming active?\n\u003e\u003e 10 blocks. That gives time for others to connect to beacon node.\n\u003e\n\u003e Beacons can be \"active\" as soon as you can route through them, and that's\n\u003e just a DHT lookup to determine, and then a matter of comparing fees to\n\u003e what the old beacons give you. So I think no artificial delay is needed,\n\u003e and the real question is just when you expire your routes to/from the\n\u003e old beacons?\n\nNo. Beacons will get saturated fast unless they have a chance to\nprepare. In particular, the network will want to establish channels\nwith new beacons, and beacons may well want to bring offline funds\nonline to handle the anticipated capacity.\n\n\u003e\u003e 3) How long before a beacon node is invalid?\n\u003e\u003e No idea. Let's keep a day's worth for the moment?\n\u003e\n\u003e Sounds fine; also mostly a client side parameter. (Though if the routing\n\u003e DHT is non-trivial, old beacons should expire from there after some\n\u003e interval too to deal with nodes that disappear)\n\u003e\n\u003e\u003e 5) How to update beacon routing?\n\u003e\u003e Particularly for fee changes, this is important. Best effort,\n\u003e\u003e with ratelimiting. I hope eventually we'll have reasonable traffic\n\u003e\u003e models so a node can say \"I'm going to ramp up/down my fees for\n\u003e\u003e this long at this rate\" and have a reasonable chance that it's true.\n\u003e\n\u003e I think this is reinventing DHTs, though maybe none of the existing ones\n\u003e work well enough for this use case?\n\nWhat's the fascination with DHTs?\n\n\u003e I think rate limiting decreases in fees is always safe (it won't prevent\n\u003e any transactions going through, it will only prevent them being started).\n\u003e\n\u003e (I'm not sure a programmed ramp-up/down of fees makes sense; though\n\u003e maybe it would be a good way to perform price discovery)\n\u003e\n\u003e\u003e PS. For the immediate term, we'll use a global comms mechanism like\n\u003e\u003e IRC, but that's just a prototype hack.\n\u003e\n\u003e Hmm. Counterproposal: no beacons or routing DHT, just fees by gossip\n\u003e protocol (or IRC channel as prototype hack). Everyone has a complete\n\u003e (but possibly slightly out of date) database of node-node (but not\n\u003e node-wallet) channel fees, and changes are propogated by gossip. Back\n\u003e of the envelope maths:\n\u003e\n\u003e everyone uses lightning ==\u003e 8B wallets (5B teens/adults, 3B businesses)\n\u003e every wallet has ~4 channels ==\u003e 32B node-wallet channels\n\u003e 100k wallet channels per node on average ==\u003e 320k nodes\n\nUm, so each wallet isn't a node? That's a very different architecture,\nwhich uses hosted wallets or something? I don't think that's very\ninteresting.\n\nCheers,\nRusty.",
"sig": "47b1efc40ed7450392a91b811c9e1ef10a503fcd7cbe817750314d5b9f64a7b3543e7018cb9070d3a12d0283f00b16680c5bda120134eb053b6584bdba3315fa"
}