|
| 1 | +# Route Blinding |
| 2 | + |
| 3 | +## Table of Contents |
| 4 | + |
| 5 | +* [Proposal](#proposal) |
| 6 | + * [Introduction](#introduction) |
| 7 | + * [Overview](#overview) |
| 8 | + * [Notations](#notations) |
| 9 | + * [Requirements](#requirements) |
| 10 | + * [Encrypted blob](#encrypted-blob) |
| 11 | + * [Creating a blinded route](#creating-a-blinded-route) |
| 12 | + * [Sending to a blinded route](#sending-to-a-blinded-route) |
| 13 | + * [Receiving from a blinded route](#receiving-from-a-blinded-route) |
| 14 | + * [Unblinding channels via fee probing](#unblinding-channels-via-fee-probing) |
| 15 | +* [Tips and Tricks](#tips-and-tricks) |
| 16 | + * [Dummy hops](#dummy-hops) |
| 17 | + * [Wallets and unannounced channels](#wallets-and-unannounced-channels) |
| 18 | + * [Blinded trampoline route](#blinded-trampoline-route) |
| 19 | +* [FAQ](#faq) |
| 20 | + * [Why not use rendezvous](#why-not-use-rendezvous) |
| 21 | + * [Why not use HORNET](#why-not-use-hornet) |
| 22 | + |
| 23 | +## Proposal |
| 24 | + |
| 25 | +### Introduction |
| 26 | + |
| 27 | +Route blinding is a lightweight technique to provide recipient anonymity by blinding an arbitrary |
| 28 | +amount of hops at the end of an onion path. It's more flexible than rendezvous because it lets |
| 29 | +senders arbitrarily update amounts and lock times, and reuse a blinded route multiple times (which |
| 30 | +is useful when retrying a failed route or using multi-part payments). |
| 31 | + |
| 32 | +The downside compared to rendezvous is that senders have more leeway to probe by changing various |
| 33 | +variables, so the scheme needs to explicitly defend against probing attacks and may be less private. |
| 34 | + |
| 35 | +Some use-cases where route blinding is useful include: |
| 36 | + |
| 37 | +* Recipient anonymity when receiving payments |
| 38 | +* Using unannounced channels in invoices without revealing them |
| 39 | +* Forcing a payment to go through a specific set of intermediaries that can witness the payment |
| 40 | +* Providing anonymous reply paths for onion messages (offers, stuckless payments, etc) |
| 41 | + |
| 42 | +### Overview |
| 43 | + |
| 44 | +At a high level, route blinding works by having the recipient choose a route to himself, and then |
| 45 | +blind each node and channel along the path with ECDH. The recipient then includes the blinded route |
| 46 | +and a secret in the invoice, which allows each node in the blinded route to incrementally unblind |
| 47 | +the payloads. |
| 48 | + |
| 49 | +This scheme requires all the nodes in the blinded route and the sender to activate support for the |
| 50 | +feature. It only becomes effective once a big enough share of the network supports it. |
| 51 | + |
| 52 | +### Notations |
| 53 | + |
| 54 | +* A node `N(i)`'s `node_id` is defined as: `P(i) = k(i) * G`. |
| 55 | +* Blinded `node_id`s are defined as: `B(i) = b(i) * G`. |
| 56 | +* Ephemeral public keys are defined as: `E(i) = e(i) * G`. |
| 57 | + |
| 58 | +### Requirements |
| 59 | + |
| 60 | +A node `N(r)` wants to provide a blinded route `N(r) <- ... <- N(1) <- N(0)` that must be used |
| 61 | +to receive onion messages. |
| 62 | + |
| 63 | +* The channels used along that route may be either announced or unannounced. |
| 64 | +* When used for payments, intermediate nodes in the blinded route MUST NOT learn `payment_secret`. |
| 65 | +* Intermediate nodes in the blinded route MUST NOT learn the `node_id` or `scid` of other |
| 66 | + intermediate nodes except for their immediate predecessor or successor. |
| 67 | +* Intermediate nodes in the blinded route MUST NOT learn their distance to the recipient `N(r)`. |
| 68 | +* Senders MUST NOT learn the real `node_id`s and `scid`s of the blinded intermediate hops after the |
| 69 | + introduction point `N(0)`. |
| 70 | +* If `N(r)` creates multiple blinded routes to herself, senders MUST NOT be able to tell that these |
| 71 | + routes lead to the same recipient (unless this information is leaked by higher layers of the |
| 72 | + protocol, such as using the same `payment_hash`). |
| 73 | + |
| 74 | +### Encrypted blob |
| 75 | + |
| 76 | +Route blinding introduces a new TLV field to the onion `tlv_payload`: the `encrypted_blob`. |
| 77 | +This blob is used to carry the blinded `scid` to use when forwarding the message and may be |
| 78 | +extended with additional data in the future. It uses ChaCha20-Poly1305 as AEAD scheme. |
| 79 | + |
| 80 | +1. type: 10 (`enctlv`) |
| 81 | +2. data: |
| 82 | + * [`...*byte`:`enctlv`] |
| 83 | + |
| 84 | +Once decrypted, the content of this encrypted blob is itself a TLV stream that may contain any |
| 85 | +tlv record defined in Bolt 4 (onion TLV namespace). |
| 86 | + |
| 87 | +### Creating a blinded route |
| 88 | + |
| 89 | +`N(r)` performs the following steps to create a blinded route: |
| 90 | + |
| 91 | +```text |
| 92 | +Initialization: |
| 93 | +
|
| 94 | + e(0) <- {0;1}^256 |
| 95 | + E(0) = e(0) * G |
| 96 | +
|
| 97 | +Blinding: |
| 98 | +
|
| 99 | + For i = 0 to r-1: |
| 100 | + ss(i) = H(e(i) * P(i)) = H(k(i) * E(i)) // shared secret known only by N(r) and N(i) |
| 101 | + B(i) = HMAC256("blinded_node_id", ss(i)) * P(i) // Blinded node_id for N(i), private key known only by N(i) |
| 102 | + rho(i) = HMAC256("rho", ss(i)) // Key used to encrypt payload for N(i) by N(r) |
| 103 | + e(i+1) = H(E(i) || ss(i)) * e(i) // Ephemeral private key, only known by N(r) |
| 104 | + E(i+1) = H(E(i) || ss(i)) * E(i) // NB: N(i) must not learn e(i) |
| 105 | +
|
| 106 | +Blinded route: |
| 107 | + |
| 108 | + (P(0),fees(0),cltv(0),encrypted_blob(0)) |
| 109 | + (B(1),fees(1),cltv(1),encrypted_blob(1)) |
| 110 | + ... |
| 111 | + (B(r-1),fees(r-1),cltv(r-1),encrypted_blob(r-1)) |
| 112 | +``` |
| 113 | + |
| 114 | +Note that this is exactly the same construction as Sphinx, but at each hop we use the shared secret |
| 115 | +to derive a blinded `node_id` for `N(i)` for which the private key will only be known by `N(i)`. |
| 116 | + |
| 117 | +The recipient needs to provide `E(0)` and the blinded route to potential senders. |
| 118 | +The `encrypted_blob(i)` is encrypted with ChaCha20-Poly1305 using the `rho(i)` key, and contains |
| 119 | +the real `short_channel_id` to forward to (and potentially other fields). `E(i)` is included as |
| 120 | +additional authenticated data to detect probing attempts by the sender. |
| 121 | + |
| 122 | +Note that the introduction point uses the real `node_id`, not the blinded one, because the sender |
| 123 | +needs to be able to locate this introduction point and find a route to it. But the sender will send |
| 124 | +`E(0)`, which will allow the introduction point to compute the shared secret and correctly forward. |
| 125 | + |
| 126 | +Note that in the specific case of payments, the recipient can sign the invoice with `e(0)`. |
| 127 | +The sender will recover `E(0)` from the signature so no extra field needs to be added to Bolt 11. |
| 128 | +And this ensures the recipient doesn't reveal his real `node_id` through the invoice signature. |
| 129 | + |
| 130 | +### Sending to a blinded route |
| 131 | + |
| 132 | +The sender finds a route to the introduction point `N(0)`, and extends it with the blinded route. |
| 133 | +It then creates an onion for that route, and includes `E(0)` and `encrypted_blob(0)` in the onion |
| 134 | +payload for `N(0)`. |
| 135 | + |
| 136 | +When `N(0)` receives the onion and decrypts it, it finds `E(0)` in the payload and is able to |
| 137 | +compute the following: |
| 138 | + |
| 139 | +```text |
| 140 | + ss(0) = H(k(0) * E(0)) |
| 141 | + rho(0) = HMAC256("rho", ss(0)) |
| 142 | + E(1) = H(E(0) || ss(0)) * E(0) |
| 143 | +``` |
| 144 | + |
| 145 | +It uses `rho(0)` to decrypt the `encrypted_blob(0)` and discover the `scid` to forward to. |
| 146 | +It forwards the onion to the next node and includes `E(1)` in a TLV field in the message |
| 147 | +extension. |
| 148 | + |
| 149 | +All the following intermediate nodes `N(i)` do the following steps: |
| 150 | + |
| 151 | +```text |
| 152 | + E(i) <- extracted from TLV extension |
| 153 | + ss(i) = H(k(i) * E(i)) |
| 154 | + b(i) = HMAC256("blinded_node_id", ss(i)) * k(i) |
| 155 | + Use b(i) to decrypt the incoming onion |
| 156 | + rho(i) = HMAC256("rho", ss(i)) |
| 157 | + Use rho(i) to decrypt the `encrypted_blob` inside the onion and discover the next node |
| 158 | + E(i+1) = H(E(i) || ss(i)) * E(i) |
| 159 | + Forward the onion to the next node and include E(i+1) in a TLV field in the message extension |
| 160 | +``` |
| 161 | + |
| 162 | +### Receiving from a blinded route |
| 163 | + |
| 164 | +When `N(r)` receives the onion message and `E(r)` in the TLV extension, she does the same |
| 165 | +unwrapping as intermediate nodes. The difference is that the onion will be a final onion. |
| 166 | + |
| 167 | +### Unblinding channels via fee probing |
| 168 | + |
| 169 | +The fees and cltv for the blinded route can be abused by the sender to try to unblind the real |
| 170 | +nodes and channels used. The sender can create onions with increased fees/cltv for the first |
| 171 | +blinded hop, starting with very low values. While the fee/cltv is below the real fee of the first |
| 172 | +hop, the sender will get an error from `N(0)`. Once the fee/cltv proposed actually satisfies the |
| 173 | +first hop's requirements, the error will come from another node `N(i)` inside the blinded path. |
| 174 | + |
| 175 | +The sender can then unblind channels one-by-one by discovering their real fees/cltv and matching |
| 176 | +those to existing channels in the graph. |
| 177 | + |
| 178 | +To mitigate this, when nodes along the blinded path are offered an invalid HTLC, they should: |
| 179 | + |
| 180 | +* return a dummy error encrypted with a throw-away key: the sender will receive an error she can't |
| 181 | + decrypt and doesn't know which node generated it |
| 182 | +* hold the HTLC for a random amount of time before sending the error (otherwise the sender can |
| 183 | + still use timing to guess what node errored out) |
| 184 | + |
| 185 | +Even with such mitigations the sender can discover the real fees/cltv of one of the blinded |
| 186 | +channels. To do so she uses the correct fees and cltv for all but one channel, and for that target |
| 187 | +channel she tries fees/cltv until the payment succeeds. Once the payment succeeds she knows the |
| 188 | +approximate fees/cltv of the target channel (but since the payment succeeded, she can't continue |
| 189 | +probing). |
| 190 | + |
| 191 | +Maybe nodes along the blinded path could use slightly different fees/cltv than what they publicly |
| 192 | +advertize? Or the recipient could add some fuzzing to it to blind them more? |
| 193 | + |
| 194 | +Are those mitigations enough? Or can a clever attacker still work around them? |
| 195 | + |
| 196 | +## Tips and Tricks |
| 197 | + |
| 198 | +### Dummy hops |
| 199 | + |
| 200 | +The sender knows an upper bound on the distance between the recipient and `N(0)`. If the recipient |
| 201 | +is close to `N(0)`, this might not be ideal. In such cases, the recipient may add any number of |
| 202 | +dummy hops at the beginning of the blinded route by using `N(j) = N(r)`. The sender will not be |
| 203 | +able to distinguish those from normal blinded hops. |
| 204 | + |
| 205 | +Note that the recipient needs to fully validate each dummy hop to detect tampering. |
| 206 | + |
| 207 | +### Wallets and unannounced channels |
| 208 | + |
| 209 | +Route blinding is particularly useful for wallets that are connected to nodes via unannounced |
| 210 | +channels. Such wallets would use a single blinded hop, which effectively hides their `node_id` |
| 211 | +and `scid` from the sender. It obviously reveals to the blinded node that the next node is the |
| 212 | +final recipient, but a wallet that's not online all the time with a stable IP will never be able |
| 213 | +to hide that information from the nodes it connects to anyway (even with rendezvous). |
| 214 | + |
| 215 | +### Blinded trampoline route |
| 216 | + |
| 217 | +Route blinding can also be used with trampoline very easily. Instead of encrypting the |
| 218 | +`outgoing_channel_id`, we simply need to encrypt the `outgoing_node_id`. |
| 219 | + |
| 220 | +Each trampoline node can then decrypt the `node_id` of the next node and compute `E(i)` for the |
| 221 | +next trampoline node. That `E(i)` can then be sent in the outer onion payload instead of using the |
| 222 | +message's TLV extensions, which is even cleaner. |
| 223 | + |
| 224 | +## FAQ |
| 225 | + |
| 226 | +### Why not use rendezvous |
| 227 | + |
| 228 | +While rendezvous is more private, it's also less flexible: it doesn't support reusing the partial |
| 229 | +onion nor retrying with updated fees on intermediate node failure. Route blinding has different |
| 230 | +trade-offs, which makes it useful for slightly different use-cases than rendezvous. |
| 231 | + |
| 232 | +### Why not use HORNET |
| 233 | + |
| 234 | +HORNET requires a slow session setup before it can provide useful speedups. In cases where you |
| 235 | +expect to send a single message per session (which is the case for most payments), HORNET actually |
| 236 | +performs worse than Sphinx in latency, bandwidth and privacy. |
| 237 | + |
| 238 | +## Open Questions |
| 239 | + |
| 240 | +* Should we include feature bits in the blinded path? It's yet another probing vector so we'd need |
| 241 | + to "sanitize" them to avoid reducing the node's anonymity set... |
| 242 | +* Should we include cltv and feerates in the enctlv? |
0 commit comments