Documentation

English
• English
• Russian
Mina Overview

# Connect to the Network

In this section, we'll connect to the Mainnet network and send our first transaction. Let's first start up the node so that we can begin issuing commands.

The first step in connecting to Mainnet is installing the latest daemon version. Follow the instructions for your operating system below.

### Ubuntu 18.04 / Debian 9

First remove any previously installed version of the daemon to prevent any errors when upgrading to the latest version. Then you can install the latest version as follows:

sudo apt-get remove -y mina-testnet-postake-medium-curves
echo "deb [trusted=yes] http://packages.o1test.net release main" | sudo tee /etc/apt/sources.list.d/mina.list
sudo apt-get update
sudo apt-get install -y curl unzip mina-mainnet=1.1.8-b10c0e3


Check that daemon installed correctly by running mina version. The output should read Commit b10c0e3db9112a2a8aebc3eec7c6d2570fcc4044 on branch master.

## Start up a node

Since this technology is still relatively new, there are a few rare situations where your node can run into some issues. We don't want for your nodes to break and you not realize! So we've made some officially supported auto-restart flows for you. We'll be iterating on these in future releases.

However, first we'll want to make sure everything works by running it manually before starting with the auto-restart flows.

Note: If you are using the Hetzner hosting provider, we are currently experiencing an issue where Hetzner believes our software is being malicious. See the Networking section of the troubleshooting page to learn how to mitigate this before starting a node.

Run the following command to start up a Mina node instance and connect to the live network:

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


If you have a key with stake and would like to produce blocks, also provide --block-producer-key ~/keys/my-wallet, replacing ~/keys/my-wallet with the path to your private key if not the default.

The -peer-list argument specified above refer to the seed peer address - this is the initial peer we will connect to on the network. Since Mina is a peer-to-peer protocol, there is no single centralized server we rely on.

See here for common issues when first running a node.

You're not done yet! Now that you've confirmed things are okay by running the standalone process, it is important we start Mina in a manner that will auto-restart itself when it dies.

First kill the existing mina daemon process with Ctrl-C, and then keep reading:

### Ubuntu 18.04 / Debian 9

Ensure your private-key that you've registered with is located at ~/keys/my-wallet.

Add a file ~/.mina-env containing the following:

CODA_PRIVKEY_PASS="private key password"
EXTRA_FLAGS=" --file-log-level Debug"


You can add extra flags later to EXTRA_FLAGS as you see fit.

Mina will be looking for its peers in a file called ~/peers.txt, so run the following command to create it:

curl https://storage.googleapis.com/mina-seed-lists/mainnet_seeds.txt > ~/peers.txt


Then run the following commands to start up a Mina node instance and connect to the live network:

systemctl --user daemon-reload
systemctl --user start mina
systemctl --user enable mina


These commands will allow the node to continue running after you logout, and restart automatically when the machine reboots.

By default, the node connects to the network using the default external-port of 8302. This can be changed using the -external-port flag, just add that to EXTRA_FLAGS.

You can also look into the mina process itself that's running in the background and auto-restarting.

This command will let you know if mina had any trouble getting started.

systemctl --user status mina


You can stop mina gracefully, and stop automatically-restarting the service:

systemctl --user stop mina


Manually Restart it:

systemctl --user restart mina


And look at logs:

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


In some cases in order to view logs you need to run the following command instead:

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


That command will show you the last 1000 lines and follow from there.

### 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


Now simply run the image with your keys and ~/.mina-config mounted:

docker run --name mina -d \
-p 8302:8302 \
--restart=always \
--mount "type=bind,source=pwd/keys,dst=/keys,readonly" \
--mount "type=bind,source=pwd/.mina-config,dst=/root/.mina-config" \
gcr.io/o1labs-192920/mina-daemon-baked:1.1.8-b10c0e3-mainnet \
daemon \
--block-producer-key /keys/my-wallet \
--insecure-rest-server \
--file-log-level Debug \
--log-level Info \


Run docker logs -f mina to follow the logs, and if it crashes save the log output to a file with docker logs mina > mina-log.txt and post the output to the #mentor-nodes channel or attach the full ~/.mina-config/mina.log to a github issue and link the issue in discord.

Run docker exec -it mina mina client status to monitor connectivity to the network, you should quickly find at least 10 peers and watch the block height / max observed block height climb.

note

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

## Checking connectivity

Now that we've started up a node and are running the Mina daemon, open up another shell and run the following command:

mina client status


note

It may take up to a minute before mina client status connects to the daemon when first starting up. So if you see Error: daemon not running. See mina daemon, just a wait a bit and try again.

If you are using the GetSandbox Nodeing, due to a quirk in the way we communicate for the mina client status command, you will need to run mina client status inside the container itself:

docker exec -it mina bash

Most likely we will see a response that include the fields below:

...
Peers:                                         Total: 4 (...)
...
Sync Status:                                   Bootstrap


If you see Sync Status: Bootstrap, this means that the node is bootstrapping and needs to sync with the rest of the network. You may need to be patient here as this step might take some time for the node to get all the data it needs.

After a while, your node should connect to more peers and then should move into Sync Status: Catchup, which means we're gathering the most recent blocks and state trying to catch up the the highest block.

When sync status reaches Synced and the node is connected to 1 or more peers, we will have successfully connected to the network. We will also see a corresponding daemon log once we've synced: [Info] Mina daemon is now synced.

If you the Bootstrap state persists for more than an hour, there may be an issue with your port configuration.