Skip to content
minanodeBeta release

Block producer

With a block producer key, the node checks each slot for a win and produces a block in each slot it wins. The more stake the key has, the more slots it wins.

The commands on this page use the release binary. In Docker, see the Docker page's block producer section.

The key

The key needs stake on devnet: its own balance, plus what others delegate to it. The node counts the stake in the current epoch's staking ledger.

To make a new key, choose a password, then write the key file. mina wallet generate reads the password from MINA_PRIVKEY_PASS and stops if it is unset or empty. The command prints the public key and saves it next to the file, in producer-key.pub.

mkdir -p -m 700 ~/keys
printf "Key password: " && IFS= read -rs MINA_PRIVKEY_PASS && echo &&
  export MINA_PRIVKEY_PASS
mina wallet generate --output ~/keys/producer-key
Keep the key file safe

The file holds your private key, encrypted with the password. Keep a copy somewhere safe, and keep it and the password off shared machines and out of bug reports.

Key file permissions

An encrypted key file must be accessible by its owner only, as the OCaml node requires. Use mode 0600; 0400 also works. The node and the wallet commands refuse a producer, libp2p or wallet key file that group or other users have any access to. The error gives the file's mode.

To fix it, run chmod 600 on the key file. Key files that mina writes, such as the one from mina wallet generate, already have mode 0600.

Key passwords

Key passwords are read from the environment, never from the command line. MINA_PRIVKEY_PASS holds the password for producer and wallet keys. MINA_LIBP2P_PASS holds the password for a libp2p key file given with --libp2p-keypair. A password given on the command line is refused at startup, with a message naming the variable. mina wallet delegate also asks for the password on a terminal when MINA_PRIVKEY_PASS is not set. The CLI reference lists the wallet commands and their options.

Start producing

printf "Key password: " && IFS= read -rs MINA_PRIVKEY_PASS && echo &&
  export MINA_PRIVKEY_PASS
mina node --network devnet \
  --producer-key ~/keys/producer-key

MINA_PRIVKEY_PASS holds the key file's password. Reading it with read -s keeps it off the screen and out of your shell history.

Block rewards go to the producer key. To send them to another key, add --coinbase-receiver B62q.... The CLI reference lists the other block production options.

A block producer keeps proofs in memory, not in the proof cache. --proof-cache turns the cache on.

Under the user service

If the node runs as the user service, don't start a second one in a terminal. Give the service the producer flags instead, with a drop-in file that replaces its start command, and keep the password in a file only you can read:

systemctl --user stop minanode.service
(umask 077 && printf "Key password: " && IFS= read -rs P && echo &&
  printf "MINA_PRIVKEY_PASS='%s'\n" "$P" > ~/keys/producer.env)
mkdir -p ~/.config/systemd/user/minanode.service.d
cat > ~/.config/systemd/user/minanode.service.d/producer.conf <<'EOF'
[Service]
EnvironmentFile=%h/keys/producer.env
ExecStart=
ExecStart=%h/.local/bin/mina node --network devnet \
  --disable-filesystem-logging --producer-key %h/keys/producer-key
EOF
systemctl --user daemon-reload
systemctl --user start minanode.service

To go back to a plain full node, delete ~/.config/systemd/user/minanode.service.d/producer.conf, then run systemctl --user daemon-reload and restart the service.

Saved slot checks

The node checks every slot of the epoch for a win and saves the results in vrf-evaluation/ in its work directory, so a restart doesn't check them again. The files hold no private key, but they do reveal your future winning slots, so the node makes them readable by you only (mode 0600).

To make it check again, stop the node, delete vrf-evaluation/ and start it.

The producer page

The dashboard's Block producer page is read-only. It shows the producer key, this epoch's slot checks and the won slots ahead.

For each past won slot, the page shows its outcome: canonical, orphaned, lost the tie to another block for the same slot, or missed, with the reason. It also shows when the block was built, proved, applied and sent, against the 90 s slot.

A summary for the epoch, and since the start, counts the outcomes, gives the median and worst proof times and the coinbase earned. It also sets the wins found against the wins the key's stake should bring.

The node keeps its newest 512 won slots and 16 epochs of slot checks in block-production.json in its work directory, readable by you only, so the page keeps them across a restart.

A restart shortly before a won slot may miss the slot, so check the page before restarting the node.

Delegation program uptime

0.20.0 doesn't send uptime reports to the uptime service of the Mina Foundation delegation program. Support is coming soon. If you need delegation program uptime, keep an OCaml node running for it for now. The Mina docs describe the uptime tracking system (opens in a new tab).