Onion routing is a technique for sending data across a network through a chain of relays, with the message wrapped in several layers of encryption. Each relay removes one layer, learns only the previous hop and the next hop, and passes the rest on. Because no single relay sees both the origin and the destination, observers find it hard to link a user to what they are doing.
The idea was developed at the US Naval Research Laboratory in the mid-1990s and is best known today through Tor, the free anonymity network. It is also built into the Bitcoin Lightning Network to hide who is paying whom. Onion routing is a privacy-enhancing technology: it hides who is talking to whom, which is different from hiding what they say, the job of ordinary data encryption.
Onion routing in plain terms
Imagine sending a letter inside three envelopes, each addressed to a different courier. The first courier opens the outer envelope and finds only the address of the second courier. The second opens the next envelope and finds the address of the third. Only the third courier sees the final address, but has no idea who first posted the letter.
That is onion routing. Each "courier" is a computer in the network, each envelope is a layer of encryption, and the layers come off one at a time like the skins of an onion. No courier can tell the whole story on its own.
How it works
The sender's software picks a path of relays and obtains a public key for each. It then encrypts the message in reverse order: first with the key of the last relay, then the middle relay, then the first. In Tor the usual path has three relays:
- Guard (entry) relay. It sees the user's internet address but only encrypted traffic.
- Middle relay. It sees only the guard and the exit, giving no view of either end.
- Exit relay. It sends traffic to the public website and sees the destination, but not the user.
Services can also run entirely inside the network as onion services, reached through addresses ending in ".onion", so neither side's location is exposed. The cryptography involved is standard; the privacy comes from how the layers and relays are arranged.
History
Researchers David Goldschlag, Michael Reed and Paul Syverson at the US Naval Research Laboratory published the first onion routing designs in 1996, aiming to protect government communications. The second-generation design, Tor, was released in 2002 and the nonprofit Tor Project was founded in 2006. Today Tor is used by journalists, activists, researchers and ordinary users in countries with censorship, and also by criminal marketplaces, which is why it appears in discussions of financial surveillance and data privacy. Related designs include I2P's "garlic routing", which bundles several messages together.
Onion routing in payments and crypto
Onion routing appears in finance in three main ways:
- Lightning payments. The Lightning Network uses an onion format called Sphinx so that each node forwarding a payment knows only its neighbours on the route, not the sender or final recipient.
- Wallet and node privacy. Many Bitcoin nodes and wallets can connect over Tor to hide their IP address from peers; see Tor integration.
- Privacy coins. Projects such as Monero have worked on network-layer privacy alongside on-chain tools like ring signatures.
Onion routing hides network metadata only. It does not make a transaction on a public blockchain anonymous, because amounts and addresses remain visible to blockchain analytics firms.
Compliance view
Using onion routing is legal in most countries. For regulated firms, however, traffic arriving from Tor exit relays is a risk signal. Exchanges and banks may block it or require extra checks, because it can mask the user's location and defeat geolocation-based sanctions screening. Investigators also note that combining Tor with mixing services, covered under Tor integration and crypto mixers, is a common pattern in money laundering cases involving crypto. Firms applying a risk-based approach generally treat onion-routed access as one factor among many rather than proof of wrongdoing.
Limitations
Onion routing adds delay, because each message travels through several relays around the world. It does not protect against an adversary who can watch both the entry and exit of the network and match traffic timing, nor against a user who reveals their identity by logging in to a personal account. Exit relays can also read unencrypted traffic, so sensitive data still needs end-to-end encryption. Some websites and payment providers also block or challenge Tor users outright, which can make ordinary tasks slower.