A sender in the Lightning network can choose a path with up to 20 intermediaries (BOLT4).

Tor is another network that uses onion routing for anonymity. However, in Tor all paths have 3 intermediaries, and longer paths are explicitly advised against (source 1, source 2). The sources make a point that attacks mostly rely on compromising the first and the last nodes, and increasing the number of nodes in between doesn't improve anonymity, but increases latency.

Do similar arguments apply to Lightning (maybe for path of slightly higher lengths but still under 20 hops)? Where does the number 20 come from? Would it be a good idea to decrease it?

2 Answers 2


The onion routing in Lightning is based on the Sphinx Mix Format described in this paper. The situation is different from Tor

  • We don't have entry and exit nodes in Lightning as all nodes are inside the Network.
  • In Tor a new connection along the path is as easy as creating a TCP socket between the tor routing nodes. In Lightning a payment channel with enough liquidity would have to be available and can't be spawn instantaneously.

The latter argument already calls for longer paths as nodes cannot just ask routing nodes to make certain hops. (That might change though if the trampoline network is coming to Lightning with which your Tor argument might hold.) Let us additionally assume I would always have paths of length 3 in Lightning. A routing node would basically see who paid whom as there are the incoming and outgoing HTLCs.

The main reasons for the Sphinx packet to be 20 hops are - as far as I understand - the following:

  1. The per hop data is 65 Byte and with 20 hops it will always fit into a small TCP/IP package giving no clues for traffic analysis and timing attacks.
  2. We assume that the Lightning Network will still somehow be a small world network with a rather small diameter, so 20 hops should be sufficient.

It is worth to point out that depending on the implementations of the nodes in the route, the path lenght limit could be lower than 20. This is due to the cltv_expiry_delta reduction at each hop that could become negative before the 20 hops.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.