Skip to content

blip-0073: Path Queries#73

Open
brh28 wants to merge 1 commit into
lightning:masterfrom
brh28:path-queries
Open

blip-0073: Path Queries#73
brh28 wants to merge 1 commit into
lightning:masterfrom
brh28:path-queries

Conversation

@brh28

@brh28 brh28 commented Jul 15, 2026

Copy link
Copy Markdown

Path queries are three optional peer messages (query_path, reply_path, reject_query_path) that let nodes cooperatively construct payment paths. Responses apply a node's first-hand knowledge of its own channel balances. This reduces node dependence on the gossiped graph, provides an alternative to probing, and lets routing nodes price payment flows per query, free of gossip's currency and expressivity limits.

This is the second version of the proposal, migrated from its original draft against lightning/bolts. Path queries are optional and pairwise. Since adoption can be partial and strategies are locally decided, the proposal does not require universality and is better suited as a bLIP. The revision also reworks the wire format (TLV streams, MPP path parts, query_id correlation, required expiry_ms in both directions) and substantially expands the rationale, privacy, and DoS analyses.

Reserves message types 32769/32771/32773 and feature bits 264/265 via bLIP 2.

Path queries are three optional peer messages (query_path, reply_path,
reject_query_path) that let nodes cooperatively construct payment
paths: a sender asks a peer for a path to a destination, and the
responder answers from first-hand knowledge of its own channels. This
reduces a sender's dependence on the gossiped graph, converts probing's
involuntary balance extraction into voluntary, policy-governed
disclosure, and lets routing nodes quote policy per query, free of
gossip's currency and expressivity limits.

This is the second version of the proposal, migrated from its original
draft against lightning/bolts. Path queries are optional and pairwise —
adoption can be partial and strategies are locally decided — so the
proposal does not require universality and is better suited as a bLIP.
The revision also reworks the wire format (TLV streams, MPP path parts,
query_id correlation, required expiry_ms in both directions) and
substantially expands the rationale, privacy, and DoS analyses.

Reserves message types 32769/32771/32773 and feature bits 264/265 via
bLIP 2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@brh28

brh28 commented Jul 15, 2026

Copy link
Copy Markdown
Author

Some open design decisions that I'd like to cover in review discussion:

  1. Machine readable error codes for the reject_query_path, indicating things like insufficient liquidity, too many attempts, etc
  2. amount_range is included in the Additional Fields section, but should arguably be included in the base TLV as a required field
  3. part is a fixed struct with no TLV stream, but should likely include a length-prefixed

@brh28
brh28 marked this pull request as draft July 15, 2026 21:57
@brh28 brh28 changed the title Add Path Queries bLIP blip-0073: Path Queries Jul 15, 2026
@brh28
brh28 marked this pull request as ready for review July 15, 2026 21:59
@TheBlueMatt

Copy link
Copy Markdown
Contributor

Isn't the old FoF balance (quantile) query somewhat more privacy-preserving than this? Isn't it preferable for the edge node with limited balances to query their LSP for information and then compute paths from that themselves rather than asking for a whole path?

@brh28

brh28 commented Jul 16, 2026

Copy link
Copy Markdown
Author

To my understanding, even though both are query-based and are intended to improve payment reliability, it's really comparing apples and oranges. Foaf is a liquidity management tool; nodes share balance information in their locale, so that they can rebalance with each other. Path queries are a path finding mechanism for payment senders and policy distribution for routing nodes.

Regarding privacy, are you referring to the payment details (e.g a downstream node, amount)? If so, I'm curious what queries you have in mind, but generally yes, the more targeted the query, the more it reveals about itself. That said:

  1. Privacy cuts both ways - sharing more liquidity state is less private for routing nodes.
  2. As mentioned in Privacy of payment details, the querying node is in control of what it reveals. It can blur amounts, query for sub-paths, split payments, or go nuclear and opt out of the feature.

@TheBlueMatt

Copy link
Copy Markdown
Contributor

No, foaf balance information is exactly the useful information you want to do pathfinding better if your peers have more channels/liquidity than you do (which is common).

@brh28

brh28 commented Jul 16, 2026

Copy link
Copy Markdown
Author

My read of the PR is that foaf is designed to improve reliability by changing network state, rather than supplying payment senders with path knowledge. Perhaps you can point me to a more up-to-date document that describes payment senders using it to discover feasible paths?

Either way, foaf replies are explicitly designed not to compose ("MUST NOT be gossiped and forwarded to other peers") and therefore do not have the same reach as path queries. Foaf messages also do not carry routing policy.

If you think this deserves a section in Related Work, let me know.

@TheBlueMatt

Copy link
Copy Markdown
Contributor

You can use it for either, its just a general query.

As for the question of asking a random node far away for a path, that's not gonna work as well as you think it will. The only reason to ask someone else for a path is (a) if they're also in your "neighborhood" and (b) (1) they send more payments/probes than you do, and thus have more up-to-date information or (2) they're your LSP and you just want to know the state of their channels. (a) means there's no real reason to send these too far, and (b)(2) is accomplished by foaf. (b)(1) means this isn't as useful as you think in general, I fear.

@brh28

brh28 commented Jul 17, 2026

Copy link
Copy Markdown
Author

Anonymous queries definitely require more thought, which is why I left them in the Expanding the protocol section with only a brief introduction. There are some scattered references to this section which provide examples of how it can be used, but may make sense to include them directly in the section.

That said, I disagree on (a) and while both counts of (b) are true to an extent, I would add some context that leads me to a different conclusion:

(a) one of the examples (referenced in the privacy section) is to partition a payment into sub-paths, so that no routing node sees both the source and destination of the full route. In this case, the downstream sub-path(s) is likely outside of your neighborhood. For example:

i. Select a remote node with path query support (T2)
ii. Query channel peer (T1) for a path to T2.
iii. Using an anonymous query, query T2 for a path from T2 to final destination (D).
iv. Send payment using aggregate route: S -> T1 -> ... -> T2 -> ... -> D

(b) (1) Path queries are designed to bridge this information asymmetry between nodes. The queried node always has direct knowledge of its channels, which is always superior to inferred knowledge from payment results/probes. Beyond its own channels, the queried node can also query (i.e recursion). Yes, large nodes with more inferred knowledge still have an advantage, but cooperation gives nodes the ability to close the gap.

(2) Definitely a valid use case, but more likely accomplished with a regular query. I'd also distinguish; your not asking for channel state, your asking for a pathfinding evaluation, which uses the channel state as input.


Personally, my concerns with anonymous queries are:

  1. The dependence on onion messages. Reading the delving conversation, it seems rate limiting is already difficult for the relays.
  2. The UX. What does it look like to pay for a query response? I'd say this is an implementation detail, but still interesting to consider.

@TheBlueMatt

Copy link
Copy Markdown
Contributor

If your goal is to partition a payment into subpaths you should use trampoline, not path queries. If your goal is to share knowledge, you should share that knowledge, not make a path query. A path query is a really lazy and bad way to share knowledge rather than just sharing the knowledge built up from probing/payments and letting the client do its own pathfinding with that data.

@brh28

brh28 commented Jul 21, 2026

Copy link
Copy Markdown
Author

If your goal is to partition a payment into subpaths you should use trampoline, not path queries.

As described in the Trampoline section, there are trade-offs between path queries and trampoline. To summarize, the payment sender is in the driver's seat; they select the route, the fees, how to handle errors, etc. Can you explain why that control is never worth having?

If your goal is to share knowledge, you should share that knowledge, not make a path query.

The goal is to send a payment. A payment needs a path. A path is the most targeted information a node can ask for, and the least information a responder must reveal to answer it.

rather than just sharing the knowledge built up from probing/payments and letting the client do its own pathfinding with that data.

If I'm following this logic correctly, you're saying nodes should share with their peers, not only their own channel balances, but also the balances they've discovered from others using probes. Feel free to correct.

@TheBlueMatt

Copy link
Copy Markdown
Contributor

To summarize, the payment sender is in the driver's seat; they select the route, the fees, how to handle errors, etc. Can you explain why that control is never worth having?

Because you want the trampoline hop to be able to retry for you.

If I'm following this logic correctly, you're saying nodes should share with their peers, not only their own channel balances, but also the balances they've discovered from others using probes. Feel free to correct.

Yes. Lightning nodes designed to operate for payers which don't send/probe a lot already have APIs for this (or use trampoline) - https://docs.rs/lightning/latest/lightning/routing/scoring/struct.CombinedScorer.html#method.merge

@brh28

brh28 commented Jul 21, 2026

Copy link
Copy Markdown
Author

Because you want the trampoline hop to be able to retry for you.

Yes, that is an argument for trampoline that's explicitly stated in the proposal. I'm asking for critiques on the other side of the argument. Do fees not matter? Is HTLC duration not a cost? Or do path queries fail to deliver on either?

Yes. Lightning nodes designed to operate for payers which don't send/probe a lot already have APIs

Interesting, I didn't know nodes were doing this.

So, it seems we agree that liquidity knowledge is a gap for the payment sender. As for approach, while I can see some value here, merging two global views of the network to perform a single pathfinding operation strikes me as inefficient. Similar to asking Google Maps for the entire map of the US with real-time traffic data just to get directions to your grandma's house. Except in this case, the "real-time traffic data" is someone else's private balance.

I'll also note CombinedScorer::merge only covers ChannelLiquidities but not routing policy, which is half of the Motivation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants