Lightning Onion Routing (Sphinx) Lightning uses Sphinx — an anonymity-set-of-N onion routing protocol. Each hop knows only the previous and next hops, not source/destination. Packet structure (BOLT 4) Total: 1366 bytes. Up to 20 hops at 65 bytes/hop in legacy mode, or 27 hops in TLV mode. Per-hop derivation For each hop : Used for: - (ChaCha20) — encrypt forward stream. - (HMAC-SHA256) — verify HMAC. - (XOR) — decrypt failure messages on backward path. Per-hop payload (TLV mode) For non-final hops: says which channel to forward on. For final hop: omit , include . Onion construction (sender) R…