I'm writing some code to play around with and test some hidden service things.
I need to be able to emulate hidden service directory selection.
HSDirs are calculated by selecting the three closest onion-routers whose identity hash is larger than the hidden service descriptor's descriptor-id, and who also have the HSDir flag.
Which network status document is used to find the HSDirs of a hidden service? Is it correct to use the "cached-microdesc-consensus"?
Additionally how could you get such a document if it wasn't already cached on your computer from Tor? I found this script, however it requires a file, ``cached-consensus'', that I don't have.
The Stem interpreter (which can be accessed using the command tor-prompt) can be used to download consensus documents. For instance with the command: GETINFO ns/all.
Additionally, if HSDirs are selected correctly you should be able to check by making the following HTTP GET request:
I have not yet been able to replicate HSDir selection using this data, however. Either the documents aren't the correct ones or there's some nuance to HSDir selection that isn't obvious.