TeachMeBitcoin

Network Privacy: Tor, I2P, and the Shadow Network

From TeachMeBitcoin, the free encyclopedia Reading time: 4 min

17. Network Privacy: Tor, I2P, and the Shadow Network

In our next 1,100 words, we perform an audit of the Sovereign's Invisibility. For Bitcoin to be truly free, it must be possible to run a node without revealing your "Physical Location" (your IP address) to the world. We are building a "Shadow Network" of nodes that communicate through encrypted tunnels like Tor and I2P.

The Physics of the Hidden Tunnel

When you connect to the internet normally, your IP address is like a "Return Address" on an envelope. Anyone who sees the envelope knows where you live. Tor and I2P are like a "Global Network of Trusted Couriers" who pass your envelope through so many hands that the final recipient has no idea where it started.

Tor (The Onion Router) and I2P (Invisible Internet Project) are the primary tools Bitcoin Core uses to achieve this. By integrating these protocols directly into the node, we ensure that privacy is not an "Add-on," but a fundamental feature of the machine. The node can now "Listen" for connections on a hidden address (.onion or .b32.i2p) and "Speak" to other nodes without ever touching the public internet.

Analyzing the Invisibility: The src/i2p.cpp Audit

/**
 * PEDAGOGICAL ANALYSIS: THE HIDDEN SESSION
 * This logic (from src/i2p.cpp) shows how the node 
 * creates a "Private Tunnel" into the I2P network.
 */
namespace i2p {
namespace sam {

void Session::CreateIfNotCreatedAlready()
{
    // 1. Check if the "Control Connection" is alive.
    // We talk to the I2P router through a local "SAM" bridge.
    if (m_control_sock && m_control_sock->IsConnected(errmsg)) return;

    // 2. Create a "Persistent" or "Transient" session.
    // A persistent session keeps the same I2P address 
    // even after the node restarts.
    const auto session_type = m_transient ? "transient" : "persistent";
    const auto session_id = GetRandHash().GetHex().substr(0, 10);

    // 3. Request a "STREAM" session from the I2P router.
    // We specify our signature type (EdDSA) and our 
    // desired tunnel quantity (inbound/outbound).
    const Reply& reply = SendRequestAndGetReply(
        *sock,
        strprintf("SESSION CREATE STYLE=STREAM ID=%s DESTINATION=%s "
                  "SIGNATURE_TYPE=7 inbound.quantity=3 outbound.quantity=3",
                  session_id, private_key_b64));

    // 4. The node now has a ".b32.i2p" address.
    // It can now "Listen" for other Bitcoin nodes 
    // in total anonymity.
    m_my_addr = CService(DestBinToAddr(MyDestination()), I2P_SAM31_PORT);
    m_session_id = session_id;
}

} // namespace sam
} // namespace i2p

Explaining the Invisibility: The Purity of the Mesh

The Philosophy of the Invisibility

As a Sovereign Architect, you know that "Privacy is the power to selectively reveal oneself to the world." Network Privacy is the node's way of "Choosing its own Visibility." It is the understanding that for money to be "Unstoppable," it must be "Untraceable."

We are building a "Digital Fog" that protects the participants of the economy. By making it easy and standard to run nodes over Tor and I2P, we ensure that the "Smallest Individual" has the same protection as the "Largest Institution." You are not just running a node; you are Commanding a Ghost in the Global Mesh.


☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!