Skip to main content

Setting up Boot Nodes for Midnight

Boot nodes are a valuable part of the Midnight network, acting as initial connection points for nodes joining the network. While running a bootnode is optional for end users, doing so helps expand the list of available nodes.

Boot Node

A boot node is a specialized type of node that helps other nodes connect to the Midnight blockchain by providing a list of active peer addresses. Rather than being defined by a unique configuration, any node used to share connection information qualifies as a boot node.

Prerequisites

Before setting up your Midnight boot node, ensure you have the following:

Setting Up a Boot Node

Step 1: Configure PostgreSQL Database

Set up a PostgreSQL instance with the following parameters:

  • Host: PostgreSQL server address.
  • Port: Default 5432.
  • Username:* Database user.
  • Password: Database password.
  • Database Name: Name of the database (e.g., cexplorer).

Step 2: Run the Docker Command for a Boot Node

Use the following Docker command to set up your boot node:

docker run \
--name midnight-boot-node \
--platform linux/amd64 \
-p 30333:30333 \
-v midnight-data:/node \
-e MIDNIGHT_NODE_IMAGE="midnightnetwork/midnight-node:<VERSION>" \
-e BASE_PATH="./node/chain/" \
-e CFG_PRESET="testnet" \
midnightnetwork/midnight-node:<VERSION> \
--listen-addr /ip4/0.0.0.0/tcp/30333 \
--bootnodes \
/dns/boot-node-01.testnet-02.midnight.network/tcp/30333/ws/p2p/12D3KooWMjUq13USCvQR9Y6yFzYNYgTQBLNAcmc8psAuPx2UUdnB \
--no-private-ip

Replace <VERSION> with the required version of the node according to the release compatibility matrix.

Verifying the Node

Check Logs

Monitor the node's logs to ensure it syncs with the network:

docker logs -f <node-name>

Test Connectivity

Ensure the node's P2P port (default: 30333) is open and reachable for network communication. Use tools like telnet, netcat, or nmap to verify the port status and ensure the node is properly connected to the network.