Because many people run smartnode and Bitcoin Confidential cold staking on Ubuntu VPS so today i will make the guide to Run BC Tor hidden service on Ubuntu VPS
1. Install Tor
sudo apt-get update sudo apt-get install -y tor
2. This sets up a manual hidden service controlled by the tor daemon. The hidden service address (xxxx.onion) will stay the same until you delete your key file. Someone tracking you can't necessarily associate the xxxx.onion with you, but they will know it is run by the same person or entity.
Add these lines to your torrc:
HiddenServiceDir /var/lib/tor/bitcoinc-service/ HiddenServicePort 9789 127.0.0.1:9789
Restart Tor. As root, run cat /var/lib/tor/bitcoinc-service/hostname. Your onion address will be reported. If it didn't work, then probably your distro's version of Tor doesn't actually use /var/lib/tor for this purpose. You should try to figure out the correct HiddenServiceDir location.
In the following steps, replace ONION_ADDR with the onion address reported above.
If you don't care about anonymity and are only looking to help the network, add the following lines to bitcoinc.conf:
onion=127.0.0.1:9050 listen=1 externalip=ONION_ADDR discover=1
This will allow you to accept connections both via your onion address and your IP address (if you have port 9789 forwarded), and Tor will only be used for connections to and from Tor hidden services.
If you care about anonymity, instead of the above, add the following lines to bitcoinc.conf to use Tor for everything:
proxy=127.0.0.1:9050 listen=1 bind=127.0.0.1 externalip=ONION_ADDR
If you additionally want BitcoinC Core to only connect out to Tor hidden services, also add this line (not particularly recommended):
Now restart BitcoinC Core. You should eventually get incoming connections via your hidden service.
cd ~/bitcoinc-18.104.22.168/bin/ ./bitcoinc-cli stop ./bitcoincd -daemon
The file private_key contains the private key needed to generate your unique XXXXXXX.onion address. KEEP THIS SAFE. If someone copies this file they can run a server with your .onion address. Also, if you delete this file, the next time Tor loads it will generate a new key file and xxxxxxxx.onion address. Note that while a malicious party cannot necessarily associate the server with you as a person, as long as your server has the same xxxx.onion address they will know it is run by the same person. For absolute security delete private_key at each reboot or some frequent interval.
They are locate here