SendingNetwork
Search
K

Delegation Node Deployment

Edge nodes construct the underlying P2P messaging network. They play the role of relaying messages, providing verifiable storage, supporting video streaming, and serving as network entries for client applications.
Delegation nodes provide an alternative approach, offering improved performance and scalability to accommodate larger groups of users. While delegation nodes enhance performance, it is important to acknowledge that complete decentralization is not achieved in this mode. Organizations considering delegation nodes should factor in the trade-off between performance and the level of decentralization desired.
The edge node communication meets the requirements of the libp2p specification, supporting protocols like TCP, UDP, WS, WSS, etc. We offer diverse options for configuring your node.

System Requirements

  • OS: Ubuntu 20.04 LTS
  • CPU: Intel Core i3 or equivalent
  • Storage: 200 GB internal storage drive
  • Memory: 8 GB RAM
  • Internet Speed: 10 Mbps
  • A public IP address is needed

Install Dependencies

Install PostgreSQL

For detailed database installation info, please refer to this blog.

Install Docker Engine

Please install the docker engine following the instructions here.

Install and Run

1. Get the docker image

docker pull jack0818/delegation-node:latest

2. Run PostgreSQL (optional)

docker run -p 5432:5432 -v /YOUR/POSTGRES/DATA/DIR:/var/lib/postgresql/data --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

Step 3. Run delegation node application

sudo docker run -d -p 8012:8012 -p 8013:8013 \
-v /delegation/run/radix:/delegation/run/radix \
-e port=8012 -e listenWs=8013 \
-e ipfs=false -e public=true \
-e peer=/ip4/54.251.110.107/tcp/8082/ws/p2p/12D3KooWESGJGtydLPQ9ki6ikchMDGBrCyGHSKjhTAqiWGRhjbzG,/ip4/44.195.250.124/tcp/8082/ws/p2p/12D3KooWAC2FgzLwi6b2zyRkE6aCPY7f6H2Cn5RLYbkDsLuTcp2d \
-e mainNet=true -e domain=YOUR.NETWORK.DOMAIN \
-e nodeIP=NODE_EXTERNAL_IP \
-e connString=postgresql://postgres:mysecretpassword@POSTGRES_NODE_IP:5432/postgres?sslmode=disable \
jack0818/delegation-node:v0.2.0

Parameter Description

connString: Database connection information when using an external PostgreSQL database. If connString is empty, the internal SQLite database will be used.
listenWs: Specify the WebSocket listen port if you want to use the WS protocol; otherwise, set it to -1. Make sure you set at least one of the -listen or -listen.
listen: Specify the port used for TCP and UDP if these protocols are in use; otherwise, set it to -1. Make sure you set at least one of the -listenWs or -listen.
port: Specify the port for receiving API requests. Set to -1 in most cases since the edge node is seldom used as a client.
ipfs: Set true to support the IPFS feature.
public: Set true if the server has a public IP address and port; otherwise, set false.
mainNet: Set true if the server join the main network; otherwise, set false.
domain: Use your server domain.
nodeIP: Specify the server public ip address.

Step 3. Install Nginx

  1. 1.
    Prepare a domain name.
  2. 2.
    Configure a proxy to verify the certificate, convert the https protocol and forward it to the delegation node listen port.
    You can find more about Nginx proxy configurations here.
    You can apply for a certificate with Cerbot, detailed configuration can be found here.
Below is a sample Nginx configuration:
server {
server_name YOUR.NETWORK.DOMAIN;
listen 80;
listen [::]:80;
location / {
proxy_pass http://127.0.0.1:8012;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 50M;
}
}
server {
server_name YOUR.NETWORK.DOMAIN;
listen 443 ssl http2;
listen [::]:443 ssl http2;
# Your ssl configuration.
#listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/YOUR.NETWORK.DOMAIN/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/YOUR.NETWORK.DOMAIN/privkey.pem; # managed by Certbot
location / {
proxy_pass http://127.0.0.1:8012;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 200M;
}
}