💡 The Plain-English Definition
Onion routing is the privacy mechanism that Lightning Network uses to route payments through intermediate nodes: each node in the chain sees only its immediate neighbours, not the full path, the sender, or the final recipient — like peeling an onion layer by layer, each layer revealing only the next step.
🤔 But Why Though?
When you send a Lightning payment that travels through multiple intermediate nodes, you don’t want every node along the route to know where the payment started and where it’s going. That information could link your financial activity to your identity, enable surveillance of your transactions, or allow intermediate nodes to selectively censor payments from or to certain parties.
The onion routing solution wraps the payment instructions in layers of encryption, one for each node in the route. The sender knows the full path and creates the encrypted package. The first node decrypts its outer layer, learns only the next hop, and forwards what remains. The second node decrypts its layer, learns only its next hop. And so on until the final recipient. Each node sees only: the node that sent it the payment, and the node to send it to next. Nobody in the middle knows the full path, the sender, or the recipient. The name comes from the layered structure — like peeling an onion, each layer reveals only the next layer, never the centre. The standard used in Lightning is SPHINX, an onion encryption protocol specifically designed for payment routing. Lightning’s onion routing is distinct from Tor (software that routes internet traffic through multiple encrypted relays to hide IP addresses) — they operate at different layers, and using both together provides complementary privacy protections.
🌍 The Real-World Analogy
Think of a chain of sealed envelopes. The sender puts the final message in an envelope addressed to the last recipient, seals it inside another envelope addressed to the second-to-last recipient, seals that inside another addressed to the third-to-last, and so on. Each postal worker opens only the outermost envelope, sees only “pass this to the next address,” and passes the remaining package along. Nobody in the chain sees the final destination or the original sender — just the next link.
⚡ So What?
Onion routing is why Lightning payments don’t expose your identity to every node that handles them. Intermediate routing nodes earn fees without knowing whose payment they’re forwarding. This is significantly better than sending on-chain, where every transaction is public and permanent. The remaining gaps — timing correlation, amount visibility to intermediate nodes, channel graph analysis — mean Lightning isn’t anonymous, but onion routing makes it substantially more private than the Bitcoin base layer.
