Skip to main content

Seed Peers Getting Started

Seed peers are our helpful allies that make it easy for the rest of us to connect to the network. Most nodes connect to the Mina network using seed peers that are run explicitly as seed nodes.

Running a Seed Node

The two important things about seed nodes:

  1. Their address should be static
  2. They need high uptime and be able to support many connections -- thus they should avoid doing as much as possible other than "seeding"

Enforcing and publishing a static address

First of all, you need a static host where you'll be running your node. Preferably, you can use DNS and host your seed node at, for example: seed.o1test.net. Alternatively, you can also set up a static ipv4 address such as 82.230.217.200.

Secondly, you'll need to select the port that your node is running on. By default, it's on 8302.

Thirdly, you'll want to pregenerate your libp2p keypair -- this is used to identify you on the gossip network. To do so:

mina libp2p generate-keypair -privkey-path <path-to-the-key-file>

This will generate a libp2p keypair on your machine. And run your daemon with the --libp2p-keypair <path-to-the-key-file> and --seed flags:

Finally you'd publish your DNS address like so:

/dns4/seed.o1test.net/tcp/8302/p2p/12D3KooWGDHtsPUS8dZk3x3FUgsXCWwpnSJ6W7EwkWZKBZXczkwC

Or a static IP one in this manner:

/ip4/82.230.217.200/tcp/8302/p2p/12D3KooWCE97fGwuDCicVNK3ZWF8fVzfNezp3uGjmSc8VrRFem6a

This address string can be used for folks to connect to you.

Tuning your node for uptime and high connections

Firstly, don't run block production or SNARK working on this node. Full stop. By doing neither of these things, the surface area for logic executing on this node reduces drastically.

It would be preferable to run with a larger --max-connection flag. At least 100. You'll still be able to seed with more than 100 nodes in total, it's just that you'll only be able to maintain connections with 100 at once.

Example Configuration

~/.mina-env

Create a file called ~/.mina-env to store your private configuration, passwords, etc.

MINA_LIBP2P_PASS="My_V3ry_S3cure_Password"
LOG_LEVEL=Info
FILE_LOG_LEVEL=Debug
EXTRA_FLAGS=" --libp2p-keypair <path-to-the-key-file> --seed --max-connection 100"
PEERS_LIST_URL=https://storage.googleapis.com/mina-seed-lists/mainnet_seeds.txt

Please note that <path-to-the-key-file> could change in value depending on where you stored your libp2p keypair from the previous steps. In docker, the keypath will always be /keys/filename due to where volumes are mounted.

Then follow along as normal with systemctl to start the mina service.

Docker

If you're using Docker, then here is a similar example:

cd ~
docker run --name mina-seed-node -d \
--restart always \
-p 8302:8302 \
-v "$(pwd)/keys:/root/keys:ro" \
-v "$(pwd)/.mina-config:/root/.mina-config" \
-v "$(pwd)/.mina-env:/entrypoint.d/mina-env:ro" \
minaprotocol/mina-daemon:3.0.2-4aac388-bullseye-mainnet \
daemon

Make sure to create ~/.mina-env as described above so that it can be mounted into the docker container.

Peers List

There will be a peers list hosted with a handful of o1Labs nodes and another much larger handful of addresses from folks unaffiliated with o1Labs. This list is curated for nodes that should be great seed peers and will try their best to keep the list up-to-date as well.

Alternate Peer Lists

We have a decentralized network after all -- we encourage other members in the community to host seed lists. To create a list, please talk to those you trust and use their addresses as seed peers.

To consume such alternate lists, you can swap the parameter --peer-list-file or --peer-list-url to point to another one.