Skip to main content

Super Node Guide

Run your own PC2 gateway infrastructure.

Advanced

Running a super node requires server administration experience and ongoing maintenance.

What is a Super Node?

Super nodes provide three infrastructure services:

  • Web Gateway -- HTTPS termination, subdomain routing
  • Boson DHT -- distributed hash table bootstrap
  • Active Proxy -- NAT traversal relay

Requirements

Hardware

SpecMinimumRecommended
CPU2 vCPU4+ vCPU
RAM4 GB8+ GB
Storage40 GB SSD100+ GB NVMe
Network100 Mbps1 Gbps
IPStatic public IPStatic + IPv6

Software

  • Ubuntu 22.04 LTS
  • Node.js 20+
  • Caddy (for SSL)
  • Domain with wildcard DNS

Installation

1. Server Setup

apt update && apt upgrade -y

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
apt install -y nodejs

apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update && apt install caddy

2. Clone Gateway Repository

git clone https://github.com/Elacity/pc2-supernode
cd pc2-supernode
npm install

3. Configure Gateway

Create config.json:

{
"gateway": {
"domain": "yourdomain.com",
"httpPort": 4100,
"httpsEnabled": true
},
"dht": {
"port": 39001,
"bootstrapNodes": [
"198.51.100.1:39001"
]
},
"proxy": {
"port": 8090,
"maxConnections": 1000
}
}

4. Configure Caddy

Edit /etc/caddy/Caddyfile:

*.yourdomain.com {
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
reverse_proxy localhost:4100
}

Wildcard SSL requires DNS validation. Caddy supports multiple DNS providers.

5. Configure DNS

RecordTypeValue
yourdomain.comAYOUR_SERVER_IP
*.yourdomain.comAYOUR_SERVER_IP

6. Create Services

cat > /etc/systemd/system/pc2-gateway.service << 'EOF'
[Unit]
Description=PC2 Super Node Gateway
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/pc2-supernode
ExecStart=/usr/bin/node dist/gateway.js
Restart=on-failure
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
EOF

cat > /etc/systemd/system/pc2-dht.service << 'EOF'
[Unit]
Description=PC2 Boson DHT
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/pc2-supernode
ExecStart=/usr/bin/node dist/dht.js
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

cat > /etc/systemd/system/pc2-proxy.service << 'EOF'
[Unit]
Description=PC2 Active Proxy
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/pc2-supernode
ExecStart=/usr/bin/node dist/proxy.js
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

7. Start Services

systemctl daemon-reload
systemctl enable pc2-gateway pc2-dht pc2-proxy caddy
systemctl start pc2-gateway pc2-dht pc2-proxy caddy

8. Configure Firewall

ufw allow 22        # SSH
ufw allow 80 # HTTP
ufw allow 443 # HTTPS
ufw allow 39001/udp # DHT
ufw allow 8090 # Active Proxy
ufw enable

Verification

systemctl status pc2-gateway
systemctl status pc2-dht
systemctl status pc2-proxy
systemctl status caddy

curl https://test.yourdomain.com/health

Registering with Network

Contact the Elacity team to add your super node to the official bootstrap list.

Email: hello@ela.city

Include: server IP, domain, location, contact info.

Monitoring

journalctl -u pc2-gateway -f
journalctl -u pc2-dht -f
journalctl -u pc2-proxy -f

The gateway exposes metrics at /metrics:

curl http://localhost:4100/metrics

Maintenance

Updates

cd /root/pc2-supernode
git pull
npm install
npm run build
systemctl restart pc2-gateway pc2-dht pc2-proxy

Backups

tar -czf dht-backup-$(date +%Y%m%d).tar.gz data/

Running a super node helps decentralize the PC2 network.