Redgold Documentation

Redgold Documentation

Node Setup

How to setup a node on the Redgold network. It is currently recommended that you follow either the GUI or manual CLI deployment process, if you are an advanced user or otherwise want a more complex setup, please reference the provided dockerfile and docker-compose.yml files in the repository. It can also be installed with cargo install, but the GUI is the easiest and most tested.

Required specs

It is recommended to use a VPS with at least 4GB of RAM and 2 CPUs for one process. Most of the tests are run with 4vCPUs / 16GB ram machine as the minimum spec, those are typically running one process for each environment (main, test, staging, dev). Each process does not use a large amount of resources.

Right now, minimum disk space is extremely minimal, but that will grow over time. You can use one of the default VPS disk sizes (~100GB or so is likely enough for the long term.) In long term, due to XOR partitioning there won't be a very large 'minimum' node size, but it is still recommended to have >100GB for indexes.

Hetzner is the most reliable and cost effective provider in general. It has very cheap bandwidth.

Digital Ocean is a more expensive alternative, but has greater popularity as a discount version of AWS.

Hostnoc has good deals on larger machines, google for TechCrunch discount codes or deals. It's pretty reliable overall, but has much higher latency spikes than the others.

Interserver is similar profile to Hostnoc but slightly more expensive.

AWS the most expensive option, but also the easiest and most reliable.

If running a node locally, you will need to open ports / enable port forwarding on your router, or otherwise setup a proper tunnelling solution. In the future automatic port forwarding will be supported, but for now it's required to have a forwarded port, DMZ, or direct IP access.

Environment / Security Setup

Before opening the GUI, please set up an environment variable for a reference to a 'secured' data backup path, where you can store your salt mixing mnemonic, as well as your list of servers. Cryptomator can be used to create an encrypted folder for this purpose. Alternatively, use gocryptfs if on Linux as most recommended.

export REDGOLD_SECURE_PATH="/path/to/your/decrypted/volume"

Generate a purely random mnemonic seed for storage either by going the Keys -> Generate tab in the GUI or with the cli

redgold generate-mnemonic --random-seed-backup

Save this mnemonic in $REDGOLD_SECURE_PATH/.rg/all/mnemonic

Generate a server configuration CSV such as this:

name,host,index,peer_id_index,network_environment,username,ipv4,node_name,external_host,reward_address
name1,some_host,0,0,all,root,1.1.1.1,rando,asdf.com,
name2,20.1.2.1,1,0,main,ubuntu,2.2.2.2,wow,omg.com,
name3,yours.com,2,0,dev,admin,3.3.3.3,yep,n1.itsawebsite.com,

The "network_environment" field controls which process to deploy. Leave as 'main' if you are resource constrained, use all to run all environments.

And save it to $REDGOLD_SECURE_PATH/.rg/all/servers

This is the easiest way to set up a node as it'll be preloaded in the GUI. You can also load the CSV in the GUI directly.

Ensure your SSH keys are available to the user running the GUI, and that you have passwordless sudo access to the remote machine if relying on apt install script.

Port Forwarding:

The default port offsets by environment are:

16180 - Main

16280 - Test

16380 - Staging

16480 - Dev

You can change these in the GUI or CLI, but it's recommended to keep them as is for now.

For mainnet, it is recommended you open up

16179 - Metrics

16181 - Public REST API

16180 - P2P API

For each corresponding environment, open the same relative port with the new offset.

CLI Deployment

The GUI should route through the same code as the CLI command, but it's a bit easier to use the GUI for now. The same options are available through:

redgold deploy --help

But this may require additional steps related to generating a node transaction / peer id which is easier to do through the GUI.

But it's still recommended to use the GUI for now until a deploy wizard is completed for CLI.

Manual Deployment

If you wish to deploy the process manually, please consult the repository for appropriate Dockerfiles and docker compose files. An example docker-compose.yml is provided in the resources for redgold-only.yml which is automatically created during the GUI/CLI deploy. It is provided here below for reference:

version: "3.7"
services:
  redgold:
    user: root
    image: redgoldio/redgold:${REDGOLD_NETWORK:-dev}
    container_name: redgold-${REDGOLD_NETWORK:-dev}
    restart: unless-stopped
    logging:
      options:
        max-size: "50m"
        max-file: "3"
    env_file:
      - ./var.env
    volumes:
      - ~/.rg:/root/.rg
      - /var/lib/docker/containers:/var/lib/docker/containers
      - /var/run/docker.sock:/var/run/docker.sock
    network_mode: host
    command: ["--network", "${REDGOLD_NETWORK:-dev}", "node"]
    labels:
      - "com.centurylinklabs.watchtower.scope=redgold-${REDGOLD_NETWORK:-dev}"
  watchtower:
    image: containrrr/watchtower
    container_name: watchtower-${REDGOLD_NETWORK:-dev}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: --interval 120 --scope redgold-${REDGOLD_NETWORK:-dev} --cleanup
    labels:
      - "com.centurylinklabs.watchtower.scope=redgold-${REDGOLD_NETWORK:-dev}"

The environment variables allowed by this docker-compose file are:

REDGOLD_NETWORK=main
REDGOLD_ALIAS=sphere
RUST_BACKTRACE=full
REDGOLD_CONTROL_PORT=16182
REDGOLD_P2P_PORT=16180
REDGOLD_METRICS_PORT=16179
REDGOLD_PUBLIC_PORT=16181

If you are doing manual setup you will need to ensure that the ~/.rg directory is created. If you do not supply a mnemonic, it will generate one for you (along with a corresponding peer transaction.)

Please look at the src/resources/infra folder for additional observability examples for viewing logs and metrics.