Skip to main content
note

A new version of Mina Docs is coming soon! This page will be rewritten.

Connect to the Mina Network

Steps to install mina, connect to the Mina Mainnet network, and test connectivity.

High-Level Overview

  1. Install or update your node to the latest mina daemon.
  2. Start a standalone mina node.
  3. Stop the standalone node.
  4. Configure the node as a block producer, or customize, with the ~/.mina-env file.
  5. Start a mina node with auto-restart workflows.
  6. Check your connectivity.
  7. Monitor the mina client status.

Update your mina daemon

The first step to connecting to Mainnet is to install the latest daemon version.

Follow the steps for your operating system.

Ubuntu 18.04, 20.04 and Debian 9, 10, 11

Install the latest Stable Mina Release 1.3.1.2 or visit the GitHub Releases Page to install pre-release (Beta) builds.

To set up the new stable package repository and install the latest version:

echo "deb [trusted=yes] http://packages.o1test.net $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/mina.list
sudo apt-get install --yes apt-transport-https
sudo apt-get update
sudo apt-get install --yes curl unzip mina-mainnet=1.3.1.2-25388a0

To verify the daemon is correctly installed:

mina version

The expected output is:

Commit 25388a0fed9695e8e9d04f75f50c2bae1c9c80db on branch master

Start a standalone mina node

Note: A known issue exists with the Hetzner hosting provider. If you are using Hetzner, follow the Networking troubleshooting guidance before you start a node.

Auto-restart flows are in place to ensure your nodes perform optimally.

  1. Start a standalone mina node to make sure everything works.

    To start a Mina node instance and connect to the live network:

    mina daemon --peer-list-url https://storage.googleapis.com/seed-lists/mainnet_seeds.txt

    The --peer-list argument specifies the the source file of seed peer addresses for the initial peer to connect to on the network. Mina is a peer-to-peer protocol, so there is no dependence on a single centralized server.

    If you have a key with MINA stake and want to produce blocks:

    mina daemon --peer-list-url https://storage.googleapis.com/seed-lists/mainnet_seeds.txt \
    --block-producer-key ~/keys/my-wallet

    where ~/keys/my-wallet is the path to your private key, if not the default.

For help solving common issues when first running a node, see Node Operators Troubleshooting.

Stop the standlone node

  • Kill the existing mina daemon process:

    Press Ctrl+C.

Start a mina node with auto-restart flows

Now that you've confirmed things are okay by running the standalone process, start mina with auto-restart workflows that allow the node to continue running after you log out and restart automatically when the machine restarts.

Create and customize the .mina-env

To produce blocks or otherwise customize the configuration for the mina daemon:

  1. Create the ~/.mina-env file.

  2. To produce blocks, add the required configuration:

    MINA_PRIVKEY_PASS="My_V3ry_S3cure_Password"
    LOG_LEVEL=Info
    FILE_LOG_LEVEL=Debug
    EXTRA_FLAGS=" --block-producer-key <BLOCK_PRODUCER_KEY_PATH>"

    Replace <BLOCK_PRODUCER_KEY_PATH> with the full path to your block producer private key. For example, /home/ubuntu/keys/my-wallet.

    If you do not want to produce blocks then you can keep ~/.mina-env empty for now.

  3. To change how mina is configured, specify flags to the mina daemon process with space-separated arguments between the quotes in EXTRA_FLAGS="".

    You can change the default values with EXTRA_FLAGS:

  4. After your .mina-env file is ready, start a Mina node instance and connect to the live network:

    systemctl --user daemon-reload
    systemctl --user start mina
    systemctl --user enable mina
    sudo loginctl enable-linger

    These commands allow the node to continue running after you log out and restart automatically when the machine reboots.

Check your connectivity

Monitor the mina process that's running in the background and auto-restarting.

Check if mina had any trouble getting started:

systemctl --user status mina

Stop mina gracefully and stop automatically restarting the service:

systemctl --user stop mina

Manually restart the mina process:

systemctl --user restart mina

Look at logs that show the last 1000 lines, and follow from there:

journalctl --user -u mina -n 1000 -f

In some cases, you might need run the following command to view the logs:

journalctl --user-unit mina -n 1000 -f

Docker

When running your daemon using Docker, first ensure that your private key has the correct permissions.

cd ~
chmod 700 ~/keys
chmod 600 ~/keys/my-wallet
mkdir ~/.mina-config

To produce blocks or otherwise customize the configuration for the mina daemon, create a ~/.mina-env files with the following:

export MINA_PRIVKEY_PASS="My_V3ry_S3cure_Password"
LOG_LEVEL=Info
FILE_LOG_LEVEL=Debug
EXTRA_FLAGS=" --block-producer-key <BLOCK_PRODUCER_KEY_PATH>"
PEER_LIST_URL=https://storage.googleapis.com/seed-lists/mainnet_seeds.txt

Replace <BLOCK_PRODUCER_KEY_PATH> with the full path to your block producer private key. For example, /home/ubuntu/keys/my-wallet.

If you do not want to produce blocks, then provide only the PEER_LIST_URL.

Now, run the image with your ~/.mina-config and ~/.mina-env files mounted into the container:

docker run --name mina -d \
-p 8302:8302 \
--restart=always \
--mount "type=bind,source=$(pwd)/.mina-env,dst=/entrypoint.d/mina-env,readonly" \
--mount "type=bind,source=$(pwd)/keys,dst=/keys,readonly" \
--mount "type=bind,source=$(pwd)/.mina-config,dst=/root/.mina-config" \
minaprotocol/mina-daemon:1.3.1.2-25388a0-bullseye-mainnet \
daemon

Checking connectivity

Follow the logs:

docker logs -f mina

If the node crashes, save the log output to a file:

docker logs mina > mina-log.txt

Post the output to the #mentor-nodes channel on Mina Protocol Discord or attach the full ~/.mina-config/mina.log to a GitHub issue and link the issue in Discord.

Monitor connectivity to the network:

docker exec -it mina mina client status

At least 10 peers are expected. Watch the block height and the max observed block height climb.

tip

If you encounter [Warn] Shutdown before Mina instance was created, not saving a visualization when you attempt to run your Docker container, increase the resources that the Docker container is allowed to use.

Monitor the mina client status

Monitor the mina client status in a different terminal window.

Now that a node is started and running the Mina daemon, run:

mina client status

When first starting up a node, it can take up to a minute before mina client status connects to the daemon. If you see Error: daemon not running. See mina daemon, just a wait a bit and try again.

The expected response includes these fields:

...
Peers: Total: 4 (...)
...
Sync Status: Bootstrap
  • Sync Status: Bootstrap means that the node is bootstrapping and needs to sync with the rest of the network. Be patient here as this step might take some time for the node to get all the data it needs.

  • After a while, the node connects to more peers and then moves into Sync Status: Catchup which gathers the most recent blocks and state while catching up to the the highest block.

  • When sync status reaches Synced and the node is connected to 1 or more peers, the node is successfully connected to the network. A corresponding daemon log shows the sync status: [Info] Mina daemon is now synced.

  • An issue with your port configuration can causethe Bootstrap state to persist for more than an hour.

Step up your game

Now that you have a fully synced node, learn about some of the more advanced features of the daemon such as Sending a payment and Staking & Delegating.

To earn MINA tokens, check out the Mina Foundation Delegation Program.