Relay

The relay node mainly comprises of 2 programs

  • Relay
  • Blockchain

Build

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

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

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

Run

To set up the relay node, run the blockchain executable and then the relay executable:

# Blockchain
$ ./chain --datadir /path/to/datadir/
# Relay
$ ./relay/eth_relay "<internal_beacon_private_ip>:9002" "<internal_beacon_private_ip>:9003,<external_beacon_public_ip>:8003" "/path/to/datadir/" --address "0x<address>

A few things to note here:

  • The internal beacon is used for discovery
  • Both the internal and external beacons are used for heartbeat since we want both internal and external nodes to discover us
  • The private IP of the internal beacon is used to ensure the private IP of the relay is registered with it
  • The public IP of the external beacon is used to ensure the public IP of the relay is registered with it

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).

Security considerations

Expose for public access

  • Pubsub port of relay
  • Discovery port of relay
  • Ports needed by the blockchain node