Tutorial: Setup a Private Lightning Node Over Tor
Excellent tutorial on how to setup a lightning node using Blockstream’s c-lightning over Tor on a Linux system.
Quick Summary
1. Generating your Tor .onion address
- Install tor daemon, it can be done on Debian with the following commands:
$ sudo apt install tor
- Edit the
/etc/tor/torrc
config file to configure tor to pass traffic to thec-lightning
node and generate an.onion
address. Add these lines totorrc
:
HiddenServiceDir /var/lib/tor/lightningd-service_v2/
HiddenServicePort 1234 127.0.0.1:9735
- This will create a tor version 2
.onion
address. For a version 3 address use the following:
HiddenServiceDir /var/lib/tor/lightningd-service_v3/
HiddenServiceVersion 3
HiddenServicePort 1234 127.0.0.1:9735
- Version 3 addresses has many advantages over the v2. You can create both and have more peers connect to either one.
- Better crypto (replaced SHA1/DH/RSA1024 with SHA3/ed25519/curve25519)
- Improved directory protocol, leaking much less information to directory servers.
- Improved directory protocol, with smaller surface for targeted attacks.
- Better onion address security against impersonation.
- More extensible introduction/rendezvous protocol.
- A cleaner and more modular codebase.
- You can now enable/restart the tor service:
sudo systemctl enable tor
sudo systemctl restart tor
- You caw see the generated tor addressed at
/var/lib/tor/lightningd-service_v2/hostname
and/var/lib/tor/lightningd-service_v3/hostname
2. Configure c-lightning:
- You can run
c-lightning
over tor with the following command:
$ ./lightningd --mainnet --bind-addr=127.0.0.1:9735 --announce-addr=<your v2 .onion> \
--announce-addr=<your v3 .onion> --proxy=127.0.0.1:9050
Support us and the authors of this article by donating to the following address:
3MK1PtCwj1MQJLhqvuLTCF3zvvsPfsYUcQ
Comments powered by Talkyard.