Skip to content

Grin over I2P User Guide

chisana edited this page Jun 30, 2019 · 1 revision

Requirements

  • i2pd dependencies, i2pd source (or i2pd binary)
  • C++ build environment sufficient for building i2pd (see build docs)
  • Grin w/ I2P support
  • Rust build environment sufficient for building Grin (see build docs)

Introduction

This document, as well as I2P support itself, are works in progress. Changes will be made as work continues, and feedback is very appreciated.

To connect Grin nodes over I2P, one needs to have an i2pd router installed, and available on the system path.

This can be achieved by building from source (recommended), or downloading an i2pd binary.

Ensure that the i2pd config is set to enable the SAM API and HTTP web interface (enabled by default), and check the SAM listening port (7656 by default). The SAM port will be needed for Grin configuration.

Building and Configuring Grin I2P Seed Node

Build Grin in the usual way, either debug or release, depending on preference.

This guide uses Floonet for configuration. To configure over Mainnet, omit --floonet flags, and replace paths including floo with main.

Once Grin is built, generate a Floonet config in the Grin directory:

mkdir ~/.grin/floo
cd ~/.grin/floo
grin --floonet server config

By default, I2P support is disabled, so the first step is to enable it. Open the config with a text editor:

cd ~/.grin/floo
text-editor grin-server.toml

# Configure seeding type
seeding_type = "None"/"DNSSeed"  # to setup a node that seeds no peers, or TCP peers

[...]

# Enable I2P support (needed for all nodes running I2P)
[server.p2p_config.i2p_mode]
mode = "Enabled"  # change from "Disabled"

# Add I2P configuration
[server.p2p_config.i2p_mode.i2p_config]
autostart = true  # start i2pd automatically on Grin start
exclusive = true/false  # connect exclusively over I2P (currently ineffective, WIP)
addr = "127.0.0.1:7656"  # SAM listening port configured for i2pd

Getting the Grin Node's B32 I2P Address

It's now time to get the B32 I2P address from i2pd.

To get the address, start Grin, wait for the node to fully start, and open the i2pd web interface in a browser.

grin --floonet

# Wait a few moments for the TUI to appear, or the logs to indicate Grin has fully started

Open i2pd web interface in a browser
http://127.0.0.1:7070

Navigate to the "SAM sessions" menu item
One item should be listed with a trailing `i2p-rs`, click it
The B32 address displayed is the node's address
Save the address, and the port listed in the `acceptor` section

Use the saved B32 address and listening port for the seed peer address in any node seeding from this one.

Configuring an I2P Seed List

On a separate Grin node, we can now configure the seed node we just setup as our seeding peer.

Follow the same initial steps for generating a config, but instead edit the config as follows:

seeding_type = "List"  # to connect to an I2P seed node

# Configuration for connecting to an I2P seed
# This configuration is unneeded on the seed node itself
[[server.p2p_config.seeds]]
peer_type = "I2p"

# This port is just an example, actual port needs to be read from i2pd web interface
# Read the port from the `acceptor` section of the seed's "SAM sessions" display
[server.p2p_config.seeds.peer_addr]
port = 3414

# Configure the Grin seed node's address saved from the previous section
# This example is just a dummy address, not a live seed node
[server.p2p_config.seeds.peer_addr.dest]
inner = "4jcuryak7cabdqrv72ytqonf4xnk3jcryfkzqz43wo67dqwlh2xa.b32.i2p"

[...]

# Enable I2P support (needed for all nodes running I2P)
[server.p2p_config.i2p_mode]
mode = "Enabled"  # change from "Disabled"

# Add I2P configuration
[server.p2p_config.i2p_mode.i2p_config]
autostart = true  # start i2pd automatically on Grin start
exclusive = true/false  # connect exclusively over I2P (currently ineffective, WIP)
addr = "127.0.0.1:7656"  # SAM listening port configured for i2pd

Now run Grin, wait for the node to fully start, and get the B32 address of our seeding node.

Save the address to check for a successful connection on the seed node.

Note: currently, no I2P peers are displayed in the TUI (WIP).

If the seed node had already begun syncing from the network, the seeding node should start syncing.

To test synced blocks are actually coming from the I2P seed node, sync the seed node from DNS seeds.

After blocks have synced, disable seeding on the seed node.

On the seeding node, configure the seed node as an exclusive peer:

[[server.p2p_config.peers_allow]]
peer_type = "I2p"

# This port is just an example, actual port needs to be read from i2pd web interface
# Read the port from the `acceptor` section of the seed's "SAM sessions" display
[server.p2p_config.peers_allow.peer_addr]
port = 3414

# Configure the Grin seed node's address saved from i2pd web interface
# This example is just a dummy address, not a live seed node
[server.p2p_config.peers_allow.peer_addr.dest]
inner = "4jcuryak7cabdqrv72ytqonf4xnk3jcryfkzqz43wo67dqwlh2xa.b32.i2p"

Restart the seed and seeding node, and blocks should begin syncing on the seeding node.

Note: currently, no I2P peers are displayed in the TUI (WIP).

Checking for a Successful Connection

On the seed node's i2pd web interface, click on the B32 address in the "SAM sessions" display.

Navigate to the section "Incoming", there should be one incoming connection, with the B32 address of the seeding peer.

If the seed node has TCP peers and blocks, the seeding node should now also have a list of TCP peers, and be syncing blocks.

Clone this wiki locally