Running Cardano node as a relay

Within the Cardano environment, there are two types of nodes: Block-producing nodes, and relay nodes, which are nodes with no operational certificates.

Relay nodes do not have any keys, so they cannot produce blocks. Instead, relays act as proxies between the core network nodes and the internet, establishing a security perimeter around the core, block-producing network nodes. Since external nodes cannot communicate with block-producing nodes directly, relay nodes ensure that the integrity of the core nodes and the blockchain remains intact, even if one or more relays become compromised.

Each node should run on a dedicated server, and the firewall on the block-producing node's server should be configured to only allow incoming connections from its relays.

If a relay node becomes compromised, you can simply switch it off and use a different one.

Configuring your node communication

Nodes (both block-producing and relay nodes), are configured in the topology.json file, which defines the network nodes with which your node can communicate.

The topology.json file must specify at least three parameters:

  • addr - the IP address of the node that your node should talk to.
  • port - the port that you wish that communication to go through.
  • valency - defines how many open connections your node should have. This parameter only affects dns addresses. If a dns address is provided, valency determines the number of resolved IP addresses that the node should maintain an active connection with. For IP addresses, valency is a boolean value where 0 means that the address should be ignored.

Configuring a relay node via the Cardano CLI

This procedure assumes the availability of working config.yaml, topology.json, and genesis.json files.

To create a relay node, follow these steps:

  1. Create a folder for the node and copy the configuration files.
cd cardano-node
mkdir relay
cp config.yaml genesis.json topology.json block-producing/
cp config.yaml genesis.json topology.json relay/
  1. Specify the port that the relay node will use for communicating with other nodes. For example, the relay node is configured to communicate with an external node with the URL: relays-new.cardano-mainnet.iohk.io,through port 8081, with valency value of 1 (only one active connection).


"addr": "relays-new.cardano-mainnet.iohk.io",
"port": 8081,
"valency": 1
  1. Start the node on the AWS instance, using a terminal multiplexer like tmux. Using tmux enables the aperture of different panes in a single terminal window.

Install tmux using sudo yum install tmux -y and start it with tmux new.

  1. Start the relay node with this code:
cardano-node run \
--topology relay/topology.json \
--database-path relay/db \
--socket-path relay/db/node.socket \
--host-addr \
--port 8081 \
--config relay/config.yaml

© IOHK 2015 - 2022

Cardano is an open-source project.

Cardano is a software platform ONLY and does not conduct any independent diligence on, or substantive review of, any blockchain asset, digital currency, cryptocurrency or associated funds. You are fully and solely responsible for evaluating your investments, for determining whether you will exchange blockchain assets based on your own judgement, and for all your decisions as to whether to exchange blockchain assets with Cardano. In many cases, blockchain assets you exchange on the basis of your research may not increase in value, and may decrease in value. Similarly, blockchain assets you exchange on the basis of your research may fall or rise in value after your exchange.

Past performance is not indicative of future results. Any investment in blockchain assets involves the risk of loss of part or all of your investment. The value of the blockchain assets you exchange is subject to market and other investment risks