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.

Ubuntu 20.04 and Debian 10, 11, 12

To install the latest Mainnet Stable Release 1.4.0, use the Installation steps for your environment.

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 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 to run the following command to view the logs:

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

Docker

When running your daemon using Docker, ensure 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, 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.4.0-c980ba8-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 maximum 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 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.