Staketab Docs
Staketab.comMina ExplorerTwitterDiscord
  • Welcome to Staketab Docs
  • ACADEMY
    • MINA
      • Mina Glossary
      • Mina Domain Model
      • Mina Block Production
      • Mina Accounts
      • Mina Staking Process
      • Mina Delegations Explained
      • Mina Reward Calculation
      • Account Balance: Locked and Unlocked Tokens
      • ZK-proof mechanism and ZK-snarks
      • ZKapps
      • Scan State
    • AXELAR
      • What is Axelar project?
  • HOW TO STAKE
    • BITCANNA
      • How to stake BitCanna
    • DESMOS
      • How to stake Desmos using Keplr
      • How to stake Desmos using Cosmostation
    • HYDRADX
      • How to buy HydraDX (HDX)
      • How to install Polkadot.js wallet
      • How to claim HydraDX (HDX) coins
      • How to stake HydraDX (HDX)
    • MEDIBLOC
      • How to stake Medibloc
    • MINA
      • How to buy Mina
        • How to buy Mina on OKX centralized exchange
        • How to buy Mina on CoinEx centralized exchange
        • How to buy Mina on BKEX centralized exchange
      • How to stake Mina
        • How to stake Mina from own Mina node (using command line)
        • How to stake Mina using third party wallet
          • How to stake Mina using Clorio browser and desktop wallet
          • How to stake Mina using Auro browser and mobile wallet
          • How to stake Mina using Staking-Power mobile wallet
        • How to stake Mina using Ledger
          • How to install Mina Ledger app on Ubuntu
          • How to install Mina Ledger app on Windows
          • How to stake Mina from Clorio browser and desktop wallet using Ledger
          • How to stake Mina from Auro browser and mobile wallet using Ledger
    • OSMOSIS
      • How to install Keplr wallet
      • How to buy ATOM on centralized exchange
        • How to buy ATOM on OKX centralized exchange
      • How to buy Osmosis coins on Osmosis decentralized exchange
      • How to stake Osmosis using Keplr wallet
    • SIFCHAIN
      • How to stake Sifchain
    • SOLANA
      • How to buy Solana on centralized exchange
        • How to buy Solana on OKX centralized exchange
      • How to stake Solana
        • How to stake Solana using SolFlare browser wallet
        • How to stake Solana using Ledger and SolFlare browser wallet
    • STARGAZE
      • How to claim Stargaze airdrop
      • How to stake Stargaze using Keplr
      • How to stake Stargaze using Cosmostation
      • How to vote on stargaze.zone
Powered by GitBook
On this page
  • How to install Linux?
  • How to stake Mina?
  • Launch terminal
  • Create private key
  • Generate the key:
  • Set necessary permissions:
  • Check private key
  • Launch a node with Docker
  • Install Docker
  • Firewall configuration
  • Run a node
  • Viewing logs with docker
  • Launch a node with Service
  • Firewall configuration
  • Node configuring
  • Start the service
  • Importing keys
  • Unlock the account
  • Stake tokens
  • Resources

Was this helpful?

  1. HOW TO STAKE
  2. MINA
  3. How to stake Mina

How to stake Mina from own Mina node (using command line)

Last updated 2 years ago

Was this helpful?

How to install Linux?

To stake Mina from your command line without any intermediary entity, we recommend to install Ubuntu as one of the most user-friendly Linux distributions. You can find guides how to install Ubuntu here:

If you prefer some another Linux distribution to use for Mina staking, the steps below are similar.

How to stake Mina?

Launch terminal

Click Ctrl+Alt+T.

Linux terminal is opened. You can find a short guide of terminal commands for beginners .

Create private key

At first, enter the following commands to install necessary packages:

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.5-a42bdee

Then install the key generator with the command:

sudo apt-get install mina-generate-keypair=0.2.12-718eba4

Generate the key:

When creating keys, you will be asked to create a password.

Option 1 with a package:

mina-generate-keypair -privkey-path ~/keys/my-wallet

Option 2 using docker:

sudo docker run  --interactive --tty --rm --volume $(pwd)/keys:/keys minaprotocol/generate-keypair:0.2.12-718eba4 -privkey-path /keys/my-wallet

Set necessary permissions:

chmod 700 $HOME/keys
chmod 600 $HOME/keys/my-wallet

Check private key

When checking the key, you will be asked to enter the password from it.

Option 1 with a package:

mina-validate-keypair -privkey-path ~/keys/my-wallet

Option 2 using docker:

sudo docker run --interactive --tty --rm --entrypoint=mina-validate-keypair --volume $(pwd)/keys:/keys minaprotocol/generate-keypair:0.2.12-718eba4 -privkey-path /keys/my-wallet

In both cases, if everything is ok with your keys, you will receive a message:

Verified a transaction using specified keypair

It means your keys have been verified.

Now let's write your public key to the server in the .bashrc file so that we don't export them again next time.

echo 'export KEYPATH=$HOME/keys/my-wallet' >> $HOME/.bashrc
echo 'export MINA_PUBLIC_KEY=$(cat $HOME/keys/my-wallet.pub)' >> $HOME/.bashrc
source ~/.bashrc

Launch a node with Docker

Install Docker

Install and activate Docker:

sudo apt install docker.io curl -y \
&& sudo systemctl start docker \
&& sudo systemctl enable docker

Firewall configuration

If your VPS server has a built-in Firewall, then you should open ports 8302 and 8303 there.

If not, then follow the commands below:

Open ports 8302 and 8303:

sudo iptables -A INPUT -p tcp --dport 8302:8303 -j ACCEPT

Run a node

Variables description: --name mina - you can use any name for the container, or leave it as it is; -block-producer-password "YOUR PASS" - instead YOUR PASS enter the password for your key. $KEYPATH - path to the file with the private key my-wallet.

Optional: --coinbase-receiver B62qp... - flag to redirect block reward to another address.

sudo docker run --name mina -d \
--restart always \
-p 8302:8302 \
-p 127.0.0.1:3085:3085 \
-v $(pwd)/keys:$HOME/keys:ro \
-v $(pwd)/.mina-config:$HOME/.mina-config \
--env CODA_PRIVKEY_PASS='YOUR_PASS' \
minaprotocol/mina-daemon-baked:1.1.5-a42bdee daemon \
-block-producer-key $KEYPATH \
--peer-list-url https://storage.googleapis.com/mina-seed-lists/mainnet_seeds.txt \
--insecure-rest-server \
--open-limited-graphql-port \
--limited-graphql-port 3095 \
--file-log-level Debug \
-log-level Info

Viewing logs with docker

View running containers:

sudo docker ps -a

Node container logs:

sudo docker logs --follow mina -f --tail 1000

Node status:

sudo docker exec -it mina mina client status

Wait for the node to synchronize. The Sync status: field should say Synced (see the screenshot below). If the status says Catched, then you need to wait a little longer. After this you can start importing your keys.

Launch a node with Service

Firewall configuration

Open ports 22, 8302 and 8303 and activate the Firewall:

sudo ufw allow 22 \
&& sudo ufw allow 8302 \
&& sudo ufw allow 8303 \
&& sudo ufw enable

We check the status of open ports with the command:

sudo ufw status

If you do not have UFW installed on your server, install it using the command sudo apt install ufw

Node configuring

Downloading package Mina:

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.5-a42bdee

Download the file with peers:

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

Setting up the mina-env file:

nano .mina-env

We copy and paste the variables into the file after entering your password from the key instead of YOUR PASS FOR KEYS:

CODA_PRIVKEY_PASS="YOUR PASS FOR KEYS"
EXTRA_FLAGS=" -file-log-level Debug"

Save ans exit: CTRL+S and CTRL+X

Start the service

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

Viewing logs:

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

Importing keys

We import an account with a key with the following command:

With Service:

mina accounts import -privkey-path $HOME/keys/my-wallet

With Docker:

sudo docker exec -it mina mina accounts import -privkey-path $HOME/keys/my-wallet

The list of your accounts can be viewed with the command below:

mina accounts list

Unlock the account

First, let's export the Public Key:

export MINA_PUBLIC_KEY=$(cat $HOME/keys/my-wallet.pub)

Let's unlock the account so that you can move tokens:

With Service:

mina accounts unlock -public-key $MINA_PUBLIC_KEY

With Docker:

sudo docker exec -it mina mina accounts unlock -public-key $MINA_PUBLIC_KEY

In the password input field, write your password from the key and press ENTER.

Stake tokens

Use the following command template:

mina client delegate-stake \
-sender "PASTE YOUR MINA WALLET ADDRESS HERE" \
-receiver "PASTE VALIDATOR'S ADDRESS HERE" \
-fee "PASTE FEE HERE"

Example of the command above:

With Service:

mina client delegate-stake \
-sender B62qnJHBeVJqWamtDhWDPwrX7Y5jiXKcMKTuvug9LQ8ictwNTWN7YvJ \
-receiver B62qqV16g8s744GHM6Dph1uhW4fggYwyvtDnVSoRUyYqNvTir3Rqqzx \
-fee 0.03

With Docker:

sudo docker exec -it mina mina client delegate-stake \
-sender B62qnJHBeVJqWamtDhWDPwrX7Y5jiXKcMKTuvug9LQ8ictwNTWN7YvJ \
-receiver B62qqV16g8s744GHM6Dph1uhW4fggYwyvtDnVSoRUyYqNvTir3Rqqzx \
-fee 0.03

Specify the following Mina fee amount depending on transaction speed you want:

  • Moderate speed is 0.01

  • Fast speed is 0.05

  • Very fast speed is 0.1

Tokens are on the journey to stake and will be used by the staking provider soon. Just wait for your Mina rewards from now. Don't be scared that your tokens are still visible on your balance. Physically Mina tokens are not moved to the staking provider from your wallet.

The whole balance of your address will be delegated into stake to a Mina validator.

After delegation, you can stop your node running. There is no need for that after successful delegation.

Resources

The command above sends your Mina funds to staking provider. If you want to stake Mina with another provider, you can select one on the .

There are much more options to stake Mina from your own node. For example, you can use Docker, set up TMUX and Snark stopper or update your node. For details, please see the .

How to install Ubuntu?
How to install Ubuntu alongside Windows?
How to install Ubuntu on virtual machine?
here
StakeTab
Mina block explorer
How to stake Mina using own delegating node detailed guide