Set Up A Bootnode

Bootnodes are essential for helping subnet nodes discover peers and join the network. When a node starts, it needs to find other nodes, and bootnodes provide an initial point of contact. Once connected, a node can expand its peer connections and play its role in the network, like participating as a validator.

Each subnet must have bootnodes for other peers to connect to and should be on its own isolated servers.

Prerequisites

A bootnode can be run only by a registered peer to pass the proof-of-stake mechanism.

When registering a node, you must include a bootnode peer ID. You can also update the bootnode peer ID at any time.

Run A Bootnode

We suggest using a terminal multiplexer of your choosing, such a tmux.

subnet-dht-api \
--host_maddrs /ip4/0.0.0.0/tcp/31330 /ip4/0.0.0.0/udp/31330/quic \
--announce_maddrs /ip4/YOUR IP HERE/tcp/31330 /ip4/YOUR IP HERE/udp/31330/quic \
--identity_path bootnode.id \
--subnet_id 1

This will output logs:

[INFO] Running a DHT instance. To connect other peers to this one, use --initial_peers /ip4/IP/tcp/31330/p2p/QmSjcNmhbRvek3YDQAAQ3rV8GKR8WByfW8LC4aMxk6gj7v /ip4/IP/udp/31330/quic/p2p/QmSjcNmhbRvek3YDQAAQ3rV8GKR8WByfW8LC4aMxk6gj7v

Last updated