Configure Your Node as a Relay

Configure Your Node as a Relay

A benefit of our decentralized network implementation is that a relay is effectively the same as any other node. The distinction currently is made by configuring a node to actively listen for connections from other nodes and having itself advertised using SRV records available through DNS. As a precaution, it is not recommended that relay nodes interact with accounts or participate in consensus. The primary reason for this recommendation is because the relay address is publicly known and more likely to be subject to malicious attacks. If you want to run a relay and a normal node, just install the normal node on a different machine without a publicly advertised IP address. Additionally, relay nodes store the entire blockchain, which requires substantially more disk space than normal nodes.

Relays are critical to the effective operation of the network.  We will be monitoring the performance of the network and will remove any relay found to be negatively impacting performance.  We will do our best to work with you to address any issues that arise.

Create Instance

Create instance (we recommend EC2 c5.4xlarge or equivalent); we use Ubuntu 18.04 LTS

Open ports: SSH (for your own access), 4161, 9100

Port 9100 is for Metrics - we strongly recommend configuring your firewall to only allow connections from localhost and external Source IP: 18.215.132.11/32

Start Instance

Configure Environment

Provision storage if necessary so algod can be installed on large, fast storage device (EBS is not sufficient)

Install Algorand

Grab the installation bootstrapper from here and copy it to the new machine.

# From local machine
scp /path/to/installer/install_master_linux-amd64.tar.gz [email protected]:/tmp 

Connect to instance again and install algod. Note we follow a naming convention of ~/algorand/<network>/data/<nodetype> for our installations; you can follow whatever convention works for you, but make sure to do the appropriate substitutions. In this case, <network> is testnet and <nodetype> is relay.

Note: The relay node default instance is for TestNet.

cd ~/
tar -xf /tmp/install_master_linux-amd64.tar.gz
./update.sh -i -c stable -p ~/algorand/testnet -d ~/algorand/testnet/data/relay -n
cp ~/algorand/testnet/data/relay/config.json.example ~/algorand/testnet/data/relay/config.json
# Edit config.json and update NetAddress to ":4161" 

Enable Telemetry and Metrics

diagcfg telemetry is similar to goal logging enable

cd ~/algorand/testnet

./diagcfg telemetry name -n

# e.g. ./diagcfg telemetry name -n r1.algorand.network
# should be the full name like r1.algorand.network
./diagcfg metric enable -e -d data/relay 

note: You'll get an error similar to "Cloudflare credentials are missing...".  You can ignore this - we'll handle the registration with Cloudflare, our DNS provider.

Install and Run as a Service

# Edit ~/algorand/testnet/[email protected], if necessary
# Specify the correct user account in these commands – ubuntu is default on ubuntu instances (ec2-user on AWS linux)
sudo ./systemd-setup.sh ubuntu ubuntu
sudo systemctl enable [email protected]$(systemd-escape /home/ubuntu/algorand/testnet/data/relay)
sudo systemctl start [email protected]$(systemd-escape /home/ubuntu/algorand/testnet/data/relay)

Configure for Automatic Updates

crontab -e
# Check at every 30 minute mark:
30 * * * * /home/ubuntu/algorand/testnet/update.sh -d /home/ubuntu/algorand/testnet/data/relay >/home/ubuntu/algorand/testnet/update.log 2>&1

Run algod

goal node start -d ~/algorand/testnet/data/relay

Send DNS Name and Port to Algorand

Email the DNS Name and Port for your relay (e.g. r1.algorand.network:4161) to [email protected]. We will evaluate your request and add your relay to the official list at our discretion.