If you think of Bitcoin as a blockchain data structure, the Lighting Network is a directed graph data structure, one that's constantly changing. And the fun part for any routing algorithm that has to traverse from A to B?

B might not be in A's internal graph structure!

Okay okay backup. What are hophints? You may have seen hophints in the AddInvoice grpc call. The docs have this to say:

Route hints that can each be individually used to assist in reaching the invoice's destination.

Sounds magical right? Little breadcrumbs to help the poor little routing algo figure it's way to B. Except no, it's nothing like that.

hophints are nothing more than extra edges to your directed graph! As of LND 0.14, they're not even special extra edges. I've seen it be called a “blackbox” or some synonym of “magic as fuck”, but all it does is attempt to stuff as many viable channel/peer pairs (up to 20) into an invoice, the invoice that is returned by AddInvoice. It doesn't add other private nodes or channels with unreliable peers. You want to create an invoice with this option (or the --private option which autogens routehints instead of feeding them into an invoice like --route_hints does) when your node is private, that is only has private channels with it's peers.

That's it. It's not that complex.

... ... ...

But like, what if it could be? This is really a workaround for private nodes not advertising certain channels to the rest of the network (the equivalent of giving someone a written note of the last street your house is on instead of adding your street to google maps for everyone to possibly route through).

Right now, LND will take the invoice and add any routehints to it's internal graph, and then proceed to attempt to route. LND might find a better route (for example through a higher ranked routing node) and it may disregard your routehints entirely. What if LND was forced to route through your routehints, after all it's the way you want to be paid. You could specify routing through channels which may be low on outgoing liquidity!

Another complexity worth munching on – since this is currently a free way to advertise routes without the network knowing it was you — it's entirely possible to doxx a competitor's private channel you may somehow know about. You could even mess with their channels if you upset their liquidity balances, and the best part? In some LND clients there's a bug where they can't disable routing through a channel, even when the channel is disabled. I patched this in 0.14.

Anyway, I hope this gave you something to think about. Routehints are dead simple, not even a little complex. But the machinations involved can be pretty fun to dig into!

signed, Harsha, sometimes known as arshbot PGP: E97A 1AB6 C77A 1D2B 72F5 0A6F 90E0 0CCB 1C74 C611

for more me,