1 *** Warning: Do not assume Tor support does the correct thing in Zcash; better Tor support is a future feature goal. ***
6 It is possible to run Zcash as a Tor hidden service, and connect to such services.
8 The following directions assume you have a Tor proxy running on port 9050. Many distributions default to having a SOCKS proxy listening on port 9050, but others may not. In particular, the Tor Browser Bundle defaults to listening on port 9150. See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort) for how to properly
12 1. Run Zcash behind a Tor proxy
13 -------------------------------
15 The first step is running Zcash behind a Tor proxy. This will already make all
16 outgoing connections be anonymized, but more is possible.
18 -proxy=ip:port Set the proxy server. If SOCKS5 is selected (default), this proxy
19 server will be used to try to reach .onion addresses as well.
21 -onion=ip:port Set the proxy server to use for Tor hidden services. You do not
22 need to set this if it's the same as -proxy. You can use -noonion
23 to explicitly disable access to hidden service.
25 -listen When using -proxy, listening is disabled by default. If you want
26 to run a hidden service (see next section), you'll need to enable
29 -connect=X When behind a Tor proxy, you can specify .onion addresses instead
30 -addnode=X of IP addresses or hostnames in these parameters. It requires
31 -seednode=X SOCKS5. In Tor mode, such addresses can also be exchanged with
34 In a typical situation, this suffices to run behind a Tor proxy:
36 ./zcashd -proxy=127.0.0.1:9050
39 2. Run a Zcash hidden server
40 ----------------------------
42 If you configure your Tor system accordingly, it is possible to make your node also
43 reachable from the Tor network. Add these lines to your /etc/tor/torrc (or equivalent
46 HiddenServiceDir /var/lib/tor/zcash-service/
47 HiddenServicePort 8233 127.0.0.1:8233
48 HiddenServicePort 18233 127.0.0.1:18233
50 The directory can be different of course, but (both) port numbers should be equal to
51 your zcashd's P2P listen port (8233 by default).
53 -externalip=X You can tell Zcash about its publicly reachable address using
54 this option, and this can be a .onion address. Given the above
55 configuration, you can find your onion address in
56 /var/lib/tor/zcash-service/hostname. Onion addresses are given
57 preference for your node to advertize itself with, for connections
58 coming from unroutable addresses (such as 127.0.0.1, where the
59 Tor proxy typically runs).
61 -listen You'll need to enable listening for incoming connections, as this
62 is off by default behind a proxy.
64 -discover When -externalip is specified, no attempt is made to discover local
65 IPv4 or IPv6 addresses. If you want to run a dual stack, reachable
66 from both Tor and IPv4 (or IPv6), you'll need to either pass your
67 other addresses using -externalip, or explicitly enable -discover.
68 Note that both addresses of a dual-stack system may be easily
69 linkable using traffic analysis.
71 In a typical situation, where you're only reachable via Tor, this should suffice:
73 ./zcashd -proxy=127.0.0.1:9050 -externalip=zctestseie6wxgio.onion -listen
75 (obviously, replace the Onion address with your own). It should be noted that you still
76 listen on all devices and another node could establish a clearnet connection, when knowing
77 your address. To mitigate this, additionally bind the address of your Tor proxy:
79 ./zcashd ... -bind=127.0.0.1
81 If you don't care too much about hiding your node, and want to be reachable on IPv4
82 as well, use `discover` instead:
84 ./zcashd ... -discover
86 and open port 8233 on your firewall (or use -upnp).
88 If you only want to use Tor to reach onion addresses, but not use it as a proxy
89 for normal IPv4/IPv6 communication, use:
91 ./zcashd -onion=127.0.0.1:9050 -externalip=zctestseie6wxgio.onion -discover
94 3. Automatically listen on Tor
95 --------------------------------
97 Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
98 API, to create and destroy 'ephemeral' hidden services programmatically.
99 Zcash has been updated to make use of this.
101 This means that if Tor is running (and proper authentication has been configured),
102 Zcash automatically creates a hidden service to listen on. Zcash will also use Tor
103 automatically to connect to other .onion nodes if the control socket can be
104 successfully opened. This will positively affect the number of available .onion
105 nodes and their usage.
107 This new feature is enabled by default if Zcash is listening (`-listen`), and
108 requires a Tor connection to work. It can be explicitly disabled with `-listenonion=0`
109 and, if not disabled, configured using the `-torcontrol` and `-torpassword` settings.
110 To show verbose debugging information, pass `-debug=tor`.
112 Connecting to Tor's control socket API requires one of two authentication methods to be
113 configured. For cookie authentication the user running zcashd must have write access
114 to the `CookieAuthFile` specified in Tor configuration. In some cases this is
115 preconfigured and the creation of a hidden service is automatic. If permission problems
116 are seen with `-debug=tor` they can be resolved by adding both the user running tor and
117 the user running zcashd to the same group and setting permissions appropriately. On
118 Debian-based systems the user running zcashd can be added to the debian-tor group,
119 which has the appropriate permissions. An alternative authentication method is the use
120 of the `-torpassword` flag and a `hash-password` which can be enabled and specified in
124 4. Connect to a Zcash hidden server
125 -----------------------------------
127 To test your set-up, you might want to try connecting via Tor on a different computer to just a
128 a single Zcash hidden server. Launch zcashd as follows:
130 ./zcashd -onion=127.0.0.1:9050 -connect=zctestseie6wxgio.onion
132 Now use zcash-cli to verify there is only a single peer connection.
134 zcash-cli getpeerinfo
139 "addr" : "zctestseie6wxgio.onion:18233",
142 "subver" : "/MagicBean:1.0.0/",
147 To connect to multiple Tor nodes, use:
149 ./zcashd -onion=127.0.0.1:9050 -addnode=zctestseie6wxgio.onion -dnsseed=0 -onlynet=onion