Tor and Bitcoin
Running a node behind Tor to hide its IP, at the cost of slower and sometimes flakier connections.
Basically
In plain words, using the Tor anonymity network to hide a Bitcoin node's IP address, improving privacy but introducing potential attack vectors.
Key Takeaways
- Bitcoin Core has built-in Tor support: nodes can route all peer connections through Tor and automatically create.onion addresses for inbound connections, hiding the operator's IP from the network and their ISP.
- Running Tor-only introduces risks: because Tor addresses are free to create, attackers can cheaply spin up thousands of fake peers to launch Sybil and eclipse attacks against isolated nodes.
- A dual-stack approach (clearnet + Tor, or adding I2P) is the recommended configuration: it preserves privacy benefits while forcing attackers to control nodes across multiple networks to isolate a victim.
What Is Tor and Bitcoin?
Tor (The Onion Router) is a privacy network that routes internet traffic through multiple encrypted relays, concealing the user's IP address from the destination and from network observers. When applied to Bitcoin, Tor allows a Bitcoin node to communicate with peers without revealing its real IP address, and to host a.onion hidden service so other nodes can connect to it anonymously.
Without Tor, every peer your node connects to can see your IP address. Since ISPs maintain records linking IPs to real identities, this creates a chain from Bitcoin transactions back to real-world identity. Tor breaks this chain by routing connections through at least three encrypted hops, ensuring that no single relay knows both the origin and the destination.
Bitcoin Core has included native Tor support for years. Version 0.21.0 (January 2021) added Tor v3 onion address support, and version 22.0 (September 2021) dropped Tor v2 entirely. Today, a significant portion of reachable Bitcoin nodes advertise.onion addresses.
How It Works
Bitcoin Core integrates with Tor at two levels: outbound connections (routing traffic through Tor's SOCKS proxy) and inbound connections (creating a Tor onion service so peers can reach you without knowing your IP).
Configuration
The Tor daemon requires control port access. A minimal /etc/tor/torrc configuration:
Bitcoin Core accepts several flags for Tor integration. The most important ones:
A typical Tor-enabled configuration in bitcoin.conf:
Why It Matters
Running a Bitcoin node over Tor provides several layers of privacy protection that are relevant to anyone operating node infrastructure:
For Lightning Network nodes, Tor is especially popular. The majority of Lightning nodes use Tor or other darknet transports, primarily because onion services solve the NAT traversal problem for home setups. Implementations like LND support automatic Tor v3 onion service creation and stream isolation (using separate Tor circuits per connection) for enhanced privacy. For a deeper look at how Lightning handles privacy, see the research on Lightning Network privacy and onion routing on Lightning.
Risks and Attack Vectors
While Tor improves privacy, it introduces a distinct set of security tradeoffs. Nodes running Tor-only are particularly exposed to attacks that exploit the low cost of creating Tor identities.
Sybil Attacks via Free Tor Addresses
Tor.onion addresses can be generated at zero cost, unlike IPv4 addresses which require real infrastructure. An attacker can create thousands of fake Bitcoin peers with.onion addresses and flood the network's address tables. This asymmetry makes Sybil attacks cheaper on Tor than on the clearnet.
A 2015 paper by Biryukov and Pustogarov ("Bitcoin over Tor isn't a Good Idea," IEEE S&P) demonstrated a complete man-in-the-middle attack against Bitcoin nodes using Tor. The attack deployed approximately 1,000 to 1,500 malicious Bitcoin peers, operated Tor exit relays with restricted exit policies, and banned legitimate Tor exit nodes by sending malformed messages through them to trigger Bitcoin's DoS protection. The total cost was estimated at under $2,500 per month. Many of the specific vulnerabilities exploited in this paper have since been mitigated in subsequent Bitcoin Core releases.
Eclipse Attacks
If a node uses -onlynet=onion and an attacker controls enough onion-addressed Bitcoin peers, they can eclipse the node: isolating it from the honest network entirely. An eclipsed node sees only the attacker's fabricated view of the blockchain, making double-spend attacks possible and potentially blocking time-sensitive transactions like Lightning penalty transactions.
This risk also intersects with BGP hijacking: an AS-level adversary (such as a malicious ISP) can execute stealthy eclipse attacks by manipulating internet routing at the network layer. Bitcoin Core 20.0 introduced the ASMap feature to mitigate this by selecting peers based on Autonomous System number rather than IP address.
Latency and Performance
Tor circuits add significant latency overhead, with each hop introducing additional delay. This has practical consequences:
Exit Node Manipulation
While Bitcoin's peer-to-peer protocol validates blocks and transactions cryptographically (preventing content tampering), malicious Tor relays have been documented performing attacks on other cryptocurrency services. The KAX17 threat actor operated over 900 malicious Tor relays between 2017 and 2021, performing SSL stripping attacks targeting cryptocurrency traffic. For Bitcoin nodes communicating peer-to-peer, the v2 transport protocol (BIP324, enabled by default since Bitcoin Core 27.0) adds an additional layer of encryption that complements Tor.
Countermeasures in Bitcoin Core
Bitcoin Core has implemented several protections against Tor-specific attack vectors over the years:
I2P and the Dual-Stack Approach
Bitcoin Core 22.0 (September 2021) added support for I2P (Invisible Internet Project), a fully encrypted peer-to-peer network that uses garlic routing instead of Tor's onion routing. I2P connects via the SAM v3.1 protocol:
The recommended configuration for privacy-conscious node operators is running a dual-stack or multi-network setup rather than relying on any single anonymity network. This means connecting to peers on both clearnet and Tor (and optionally I2P or CJDNS, added in Bitcoin Core 23.0). The benefits of this approach:
One caveat: running on multiple networks simultaneously can allow an adversary with visibility into several networks to correlate your identities across them. If unlinkability is your primary requirement, a single-network setup may be preferable despite the higher eclipse risk.
For a comparison of different node configurations and their tradeoffs, see the research on Bitcoin node implementation comparison.
Lightning Network and Tor
Tor is widely used in the Lightning Network, where it serves a dual purpose: privacy and connectivity. Lightning implementations provide built-in Tor support:
However, Tor-only Lightning nodes face practical limitations. Clearnet Lightning nodes hold significantly more channel capacity than Tor-only nodes, reflecting the performance tradeoff. Routing reliability is lower over Tor due to added latency, which can cause HTLC timeouts on multi-hop routes. Many node operators run hybrid configurations to balance privacy with routing performance.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.