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?

up vote 46 down vote accepted

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 Oct 27 '13 at 13:21
  • @user194, thank you for reading over. I removed that part. I was under the impression that the flag would be also considered by hidden services. – bastik Oct 27 '13 at 13:28
  • How exactly does the introduce message get from the introduction points to the hidden service? – svick Oct 28 '13 at 22:01
  • The hidden service maintains a circuit to the introduction points to receive introduction messages – IceyEC Oct 29 '13 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 ? – Reader.Spec Jun 15 '17 at 4:38

protected by Community Jul 2 at 21:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.