I understand that the .onion address is a public key of sorts, but not much more than that (I can vaguely guess, though).

When nobody knows the IP of the .onion address, how do requests reach it? Are they bounced between nodes in the P2P network till someone decrypts it with the corresponding private key?


1 Answer 1


Up to at least October 2013 the hidden services work like this:

  1. A hidden service calculates its key pair (private and public key, asymmetric encryption).
  2. Then the hidden service picks some relays as its introduction points.
  3. It tells its public key to those introduction points over Tor circuits.
  4. After that the hidden-service creates a hidden service descriptor, containing its public key and what its introduction points are.
  5. The hidden service signs the hidden service descriptor with its private key.
  6. It then uploads the hidden service descriptor to a distributed hash table (DHT).
  7. Clients learn the .onion address from a hidden service out-of-band. (e.g. public website) (A $hash.onion is a 16 character name derived from the service's public key.)
  8. After retrieving the .onion address the client connects to the DHT and asks for that $hash.
  9. If it exists the client learns about the hidden service's public key and its introduction points.
  10. The client picks a relay at random to build a circuit to it, to tell it a one-time secret. The picked relay acts as rendezvous point.

  11. The client creates a introduce message, containing the address of the rendezvous point and the one-time secret, before encrypting the message with the hidden service's public key.

  12. The client sends its message over a Tor circuit to one of the introduction points, demanding it to be forwarded to the hidden service.
  13. The hidden service decrypts the introduce message with its private key to learn about the rendezvous point and the one-time secret.
  14. The hidden service creates a rendezvous message, containing the one-time secret and sends it over a circuit to the rendezvous point.
  15. The rendezvous point tells the client that a connection was established.
  16. Client and hidden service talk to each other over this rendezvous point. All traffic is end-to-end encrypted and the rendezvous point just relays it back and forth. Note that each of them, client and hidden service, build a circuit to the rendezvous point; at three hops per circuit this makes six hops in total.
  • Are you sure about the HSDir flag? I was under the impression it was only used for selecting hidden service directories, not introduction points.
    – user194
    Commented Oct 27, 2013 at 13:21
  • 1
    How exactly does the introduce message get from the introduction points to the hidden service?
    – svick
    Commented Oct 28, 2013 at 22:01
  • 1
    The hidden service maintains a circuit to the introduction points to receive introduction messages
    – IceyEC
    Commented Oct 29, 2013 at 12:56
  • 1
    If there are n clients, thus n RP, are there n exit nodes of HS or single exit node with multiple TCP connection to each RP ? Commented Jun 15, 2017 at 4:38
  • 1
    This answer should be updated for the newer versions of onion addresses… it's a little outdated. See community.torproject.org/onion-services/overview for a modern overview.
    – rugk
    Commented Jun 30, 2021 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .