<p>Depending on the version of Bitcoin Core and Tor you are using, there is the possibility that your installation was actually making use of Tor control and not actually using the configuration from your <code>torrc</code>. Have a look in the <code>/.bitcoin/</code> folder for <code>onion_private_key</code> and try exiting Bitcoin Core, putting that file back in place from your old HDD and, restart Bitcoin Core.</p>

<p>I do not know if you will also need to do the same for the Tor auth cookie <code>/run/tor/control.authcookie</code>?</p>

<p>There is an updated setup guide for running Bitcoin Core and Tor on Bitcoin.SE right <a href="https://bitcoin.stackexchange.com/questions/70069/how-can-i-setup-bitcoin-to-be-anonymous-with-tor">here</a>.</p>

CC BY-SA 3.0
2018-02-10T07:48:11.970Z
2018-02-10T08:00:25.377Z
2018-02-10T08:00:25.377Z
Willtech
<p>My bitcoin Tor node recently suffered a hard disk failure. After changing the hardware, re-installing Linux and <code>bitcoind</code>, setting up Tor for a hidden service, I realized (obviously !) that my external onion address had to change. So my question is: <strong>what do I need to do to ensure I keep the same onion address the next time my node suffers unrecoverable failure?</strong> Looking at the directory <code>/var/lib/tor/bitcoin_service</code>, I can see two files <code>hostname</code> and <code>private_key</code> where the former does contain my onion address (which I think is related to my private key). So I am guessing all I need to do is back up these files and restore them in my new system (while setting up <code>/etc/tor/torrc</code> and <code>bitcoin.conf</code> appropriately of course, as explained <a href="https://bitcoin.stackexchange.com/questions/50304/running-full-node-over-tor">here</a>). Do I need more?</p>

<p><strong>EDIT</strong>: it seems that simply importing the files <code>hostname</code> and <code>private_key</code> into a new system (having properly defined <code>/etc/tor/torrc</code> and <code>bitcoin.conf</code>) does not work (the node fails to connect to Tor network). So Tor probably maintains additional state apart from these two files. So the question remains open: how to set up a new system so as to keep existing onion address. </p>

<bitcoind><network><tor>
Maintaining Tor hidden service onion address over new hardware
Sven Williamson
# Maintaining Tor hidden service onion address over new hardware

(Asked by: username_0 on 2017-04-04)

My bitcoin Tor node recently suffered a hard disk failure. After changing the hardware, re-installing Linux and `bitcoind`, setting up Tor for a hidden service, I realized (obviously !) that my external onion address had to change. So my question is: **what do I need to do to ensure I keep the same onion address the next time my node suffers unrecoverable failure?** Looking at the directory `/var/lib/tor/bitcoin_service`, I can see two files `hostname` and `private_key` where the former does contain my onion address (which I think is related to my private key). So I am guessing all I need to do is back up these files and restore them in my new system (while setting up `/etc/tor/torrc` and `bitcoin.conf` appropriately of course, as explained [here](https://bitcoin.stackexchange.com/questions/50304/running-full-node-over-tor)). Do I need more?

**EDIT**: it seems that simply importing the files `hostname` and `private_key` into a new system (having properly defined `/etc/tor/torrc` and `bitcoin.conf`) does not work (the node fails to connect to Tor network). So Tor probably maintains additional state apart from these two files. So the question remains open: how to set up a new system so as to keep existing onion address.

**Tags:** bitcoind, network, tor


---

## 1 answers

### Answer by username_1 on 2018-02-10. Score: 1 | Accepted answer

Depending on the version of Bitcoin Core and Tor you are using, there is the possibility that your installation was actually making use of Tor control and not actually using the configuration from your `torrc`. Have a look in the `/.bitcoin/` folder for `onion_private_key` and try exiting Bitcoin Core, putting that file back in place from your old HDD and, restart Bitcoin Core.

I do not know if you will also need to do the same for the Tor auth cookie `/run/tor/control.authcookie`?

There is an updated setup guide for running Bitcoin Core and Tor on Bitcoin.SE right [here](https://bitcoin.stackexchange.com/questions/70069/how-can-i-setup-bitcoin-to-be-anonymous-with-tor).


---

