Relay

The relay node is responsible for message propagation. It mainly comprises of 2 programs:

  • Relay
  • Abci

Using marlinctl

Usage

$ sudo ./marlinctl relay create --help
NAME:
   marlinctl relay create - create a new relay

USAGE:
   marlinctl relay create [command options] [arguments...]

OPTIONS:
   --chain value            --chain "<CHAIN>"
   --discovery-addrs value  --discovery-addrs "<IP1:PORT1>,<IP2:PORT2>,..." (default: "127.0.0.1:8002")
   --heartbeat-addrs value  --heartbeat-addrs "<IP1:PORT1>,<IP2:PORT2>,..." (default: "127.0.0.1:8003")
   --datadir value          --datadir "/path/to/datadir" (default: "~/.ethereum/")
   --discovery-port value   --discovery-port <PORT> (default: 0)
   --pubsub-port value      --pubsub-port <PORT> (default: 0)
   --address value          --address "0x..."
   --name value             --name "<NAME>"
   --version value          --version <NUMBER> (default: "latest")
   --abci-version value     --abci-version <NUMBER> (default: "latest")
   --help, -h               show help (default: false)

Run

$ sudo ./marlinctl relay create --chain "eth"

The abci is automatically created.

Manually

Build

The relay executable is built as part of OpenWeaver. See the README for build instructions.

The abci is available here. Use only the "Building from source" instructions (not Installation).

Usage

$ ./relay/eth_relay --help

USAGE: eth_relay [OPTIONS] discovery_addrs heartbeat_addrs datadir

OPTIONS:
    -p, --pubsub-port <pubsub_port>
    -d, --discovery-port <discovery_port>
    -a, --address <address>
    -h, --help <help>
    -v, --version <version>

ARGS:
    discovery_addrs
    heartbeat_addrs
    datadir

Run

# Blockchain
$ ./geth --datadir /path/to/datadir/ --syncmode=light

# Relay
$ ./relay/eth_relay "127.0.0.1:8002" "127.0.0.1:8003" "/path/to/datadir/"

Discussion

The relay executable takes 3 arguments:

  • discovery-addrs - Comma separated string of beacon addresses to initiate discovery
  • heartbeat-addrs - Comma separated string of beacon addresses to register with
  • datadir - Path to the data directory of the blockchain node

The relay executable also supports three optional command-line arguments:

  • --pubsub-port - To set the local port used for the message relay (default: 5000)
  • --discovery-port - To set the local port used to initiate discovery (default: 5002)
  • --address - To set the reward address for the incentivized testnet

Why is the blockchain node needed?

The blockchain node is needed to detect spam. For supporting block propagation, the blockchain node can be a light client but to support transaction propagation, it needs to be a full node.

This is a temporary requirement and will eventually be replaced (or at the very least, decoupled) with better spam prevention measures (e.g. an onchain light client).