Skip to main content

CLI

The CLI provides more control over your setup but requires configuring additional ports for the separate node and farmer components.

Network Architecture

Required Ports

PortПротоколDirectionКомпонентНазначениеImpact if Blocked
30333TCPInbound/OutboundНодаConsensus P2PPoor block propagation, missed PoT slots
30433TCPInbound/OutboundНодаDSN communicationSlow piece retrieval, reduced cache efficiency
30533TCPInbound/OutboundФармерFarmer P2P networkMissed challenges, reduced rewards
9944TCPLocal onlyНодаRPC for farmer-node communication Never expose to internet
Security Warning

RPC port 9944 should NEVER be exposed to the internet. This port contains sensitive APIs that could compromise your node. It should only be accessible locally or within your secure network.

Complete Setup Guide

Step 1: Gather Network Information

# Get your public IP address
curl -s https://api.ipify.org
echo "Your public IP: $(curl -s https://api.ipify.org)"

# Get your local IP and gateway
# Linux/macOS:
ip route | grep default # Gateway
hostname -I | awk '{print $1}' # Local IP

# Windows PowerShell:
ipconfig | findstr "Default Gateway" # Gateway
ipconfig | findstr "IPv4 Address" # Local IP

Step 2: Router Port Forwarding

Access your router's admin panel and create these port forwarding rules:

Rule NameExternal PortInternal IPInternal PortПротокол
Autonomys-Node-Consensus30333Your PC IP30333TCP
Autonomys-Node-DSN30433Your PC IP30433TCP
Autonomys-Farmer30533Your PC IP30533TCP
Router Access
  • http://192.168.1.1
  • http://192.168.0.1

Default credentials are often on the router label.

Step 3: Firewall Configuration

PowerShell (Run as Administrator):

# Create firewall rules for CLI farming
New-NetFirewallRule -DisplayName "Autonomys Node Consensus" `
-Direction Inbound -Protocol TCP -LocalPort 30333 -Action Allow

New-NetFirewallRule -DisplayName "Autonomys Node DSN" `
-Direction Inbound -Protocol TCP -LocalPort 30433 -Action Allow

New-NetFirewallRule -DisplayName "Autonomys Farmer" `
-Direction Inbound -Protocol TCP -LocalPort 30533 -Action Allow

# RPC for local network only (adjust subnet as needed)
New-NetFirewallRule -DisplayName "Autonomys RPC Local" `
-Direction Inbound -Protocol TCP -LocalPort 9944 `
-RemoteAddress LocalSubnet -Action Allow

# Verify rules
Get-NetFirewallRule -DisplayName "Autonomys*" |
Format-Table DisplayName, Enabled, Direction, Action

Expected output:

DisplayName              Enabled Direction Action
----------- ------- --------- ------
Autonomys Node Consensus True Inbound Allow
Autonomys Node DSN True Inbound Allow
Autonomys Farmer True Inbound Allow
Autonomys RPC Local True Inbound Allow

Step 4: Start Node and Farmer

Start your node with explicit network configuration:

# Start node
./subspace-node run \
--chain mainnet \
--listen-on /ip4/0.0.0.0/tcp/30333 \
--dsn-listen-on /ip4/0.0.0.0/tcp/30433 \
--rpc-listen-on 127.0.0.1:9944

# Start farmer (in separate terminal)
./subspace-farmer farm \
--node-rpc-url ws://127.0.0.1:9944 \
--listen-on /ip4/0.0.0.0/tcp/30533 \
path=/path/to/farm,size=100GiB

Step 5: Verify Configuration

Node logs should show:

Subspace Node
Chain: Mainnet
Node name: YOUR_NODE_NAME
Listening on: /ip4/0.0.0.0/tcp/30333
DSN listening on: /ip4/0.0.0.0/tcp/30433
Discovered new peer: 12D3KooW...
Peers: 25

Farmer logs should show:

Subspace Farmer
Connected to node: ws://127.0.0.1:9944
Listening on: /ip4/0.0.0.0/tcp/30533
Farm size: 100.0 GB
Plotted sectors: 150/200
Farming peers: 18

Common Issues and Solutions

Issue: Low Peer Count

Symptoms:

  • Node shows < 40 peers
  • Slow synchronization

Diagnostic Steps:

# 1. Check if ports are actually open
sudo netstat -tuln | grep -E "30333|30433|30533"

# 2. Test from external source
curl -s https://api.ipify.org # Get your IP
# Have a friend run: nc -zv YOUR_IP 30333

# 3. Check firewall logs
# Linux: sudo journalctl -u ufw -n 50
# Windows: Get-WinEvent -FilterHashtable @{LogName="Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"; ID=2004}

Solutions:

  1. Verify router port forwarding saved correctly
  2. Check for double NAT (router behind router)
  3. Ensure firewall rules are active
  4. Try alternate ports if ISP blocks defaults

Issue: RPC Connection Failed

Error: "Cannot connect to node RPC"

Solutions:

# 1. Verify node is running and RPC is enabled
ps aux | grep subspace-node

# 2. Check RPC is listening
netstat -tuln | grep 9944

# 3. Test RPC locally
curl -H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method": "system_health"}' \
http://127.0.0.1:9944

# 4. If using Docker, ensure correct network
docker network ls
docker inspect subspace-node | grep NetworkMode

Issue: CGNAT / No Public IP

Identifying CGNAT:

# Check if behind CGNAT
curl -s https://api.ipify.org # Public IP
# Compare with router WAN IP
# If different = likely CGNAT

Solutions:

  1. Request public IP from ISP (may cost extra)
  2. Use IPv6 if available:
    --listen-on /ip6/::/tcp/30333
  3. VPN with port forwarding (impacts performance)
  4. Rent a VPS as public entry point

Advanced Configurations

Multiple Farmers, Single Node

# Node (Machine 1)
./subspace-node run \
--rpc-listen-on 0.0.0.0:9944 \
--rpc-cors all

# Farmer 1 (Machine 2)
./subspace-farmer farm \
--node-rpc-url ws://machine1:9944 \
--listen-on /ip4/0.0.0.0/tcp/30533

# Farmer 2 (Machine 3)
./subspace-farmer farm \
--node-rpc-url ws://machine1:9944 \
--listen-on /ip4/0.0.0.0/tcp/30534 # Different port!

Custom Port Configuration

If default ports are blocked:

# Node with custom ports
./subspace-node run \
--listen-on /ip4/0.0.0.0/tcp/31333 \
--dsn-listen-on /ip4/0.0.0.0/tcp/31433 \
--rpc-port 9955

# Farmer with custom port
./subspace-farmer farm \
--node-rpc-url ws://127.0.0.1:9955 \
--listen-on /ip4/0.0.0.0/tcp/31533

Remember to update router and firewall rules to match!

Лучшие практики безопасности

DO:

  • Keep RPC port (9944) local only
  • Use strong firewall rules
  • Monitor logs for suspicious activity
  • Regular software updates
  • Use fail2ban for SSH if exposed

DON'T:

  • Expose RPC to internet
  • Use --rpc-methods unsafe with public RPC
  • Disable firewall completely
  • Use DMZ for farming setup
  • Share node/farmer private keys