Skip to main content

Staking and Snarking

You can interact with the Mina network by participating in consensus to produce a cryptographic proof for the data by generating zk-SNARKs. By operating a node that helps secure the network, you can receive MINA for your efforts. See Staking Rewards on Mina.

Participating in Consensus

The Mina network is secured by proof of stake (PoS) consensus. With this model of consensus, you don't need to have complex equipment like in Bitcoin mining. By simply having MINA in your wallet, you can choose to stake your MINA or delegate it to another node.

Mina is a public and decentralized blockchain that is open for anyone in the world to participate in actively or passively. You can help increase the security of the network by becoming nodes or block producers, or you can help lower the cost of transactions by becoming SNARK producers, or you can be both.

Staking MINA

You can earn block rewards by participating in block production through staking.

  • Your new stake delegation comes into effect after a latency period of a 2-4 weeks.
  • You can undelegate at any time with no penalty. Submit a delegation transaction with the new staking service or back to yourself if you want to be a block producer. Updates are made after a delay of 1-2 epochs.

Requirements

To properly remain synced to the network and participate in consensus, your server must run a clock synchronization protocol.

Network Time Protocol (NTP) is the most common method for synchronizing computer clocks over a network.

To synchronize your server software clock with internet time servers, be sure to set up NTP. Many popular Linux distributions include NTP as a default service.

Set or change the block producer key

Use the mina client delegate-stake subcommand to set or change the delegation of the block producer key. See Delegating MINA.

Alternatively, to stake with your own node, start the daemon with the -block-producer-pubkey flag:

args={["-block-producer-pubkey $MINA_PUBLIC_KEY"]} />

To check which accounts you are staking with:

mina client status

The expected output is like:

Mina daemon status
-----------------------------------

Global number of accounts: 372
Block height: 20
Max observed block length: 20
Local uptime: 1m48s
Ledger Merkle root: ...
Protocol state hash: ...
Staged Hash: ...
Git SHA-1: ...
Configuration directory: ...
Peers: 5 (...)
User_commands sent: 0
SNARK worker: None
SNARK work fee: 1
Sync status: Synced
Block producers running: 1 (...)
Best tip consensus time: epoch=0, slot=133
Next proposal: None this epoch… checking at in 5.284h
Consensus time now: epoch=0, slot=134
Consensus mechanism: proof_of_stake
Consensus configuration: ...
Addresses and ports: ...
Libp2p PeerID: ...

where:

  • The Block producers running field returns the number of accounts currently staking, with the associated key.

When you are staking independently with funds in a account, you must remain connected to the network at all times to successfully produce blocks. If you need to go offline frequently, it might be better to delegate your stake to another node operator.

If you want to send your coinbase to an account other than the one that is staking, use the -coinbase-receiver flag when you start your daemon. You can even point the coinbase at a cold wallet.

Delegating MINA

Delegating MINA has the benefit of not having to maintain a node that is always connected to the network. See Mina Foundation Delegation Program.

First, make sure you've unlocked your account:

mina account unlock --public-key $MINA_PUBLIC_KEY

To delegate your stake:

mina client delegate-stake \
--receiver <DELEGATE-PUBLIC-KEY> \
--sender $MINA_PUBLIC_KEY \
--fee 0.1

where:

  • receiver is the public key of the receiver of your stake delegation
  • sender is the public key of the account you want to delegate from
  • fee is the cost to send your transaction, the fee is paid to the network’s block producers

There is no amount parameter. Your full MINA balance is delegated automatically.

This command looks like a payment transaction, because a stake delegation is also a transaction, which is why you have to pay a small transaction fee.

Delegating your stake might be useful if you're interested in:

  • Running your own staking node that uses funds from a cold wallet
  • Delegating to a staking pool that periodically provides token payouts

You might decide to stake your MINA if you don't have enough MINA tokens to make managing a block producer full-time worthwhile.

Compressing data in the Mina network

The Mina protocol is unique because nodes are not required to maintain the full history of the blockchain like other cryptocurrency protocols. By recursively using cryptographic proofs, the Mina protocol effectively compresses the blockchain to constant size. This compression reduces terabytes of data to a few kilobytes.

However, this isn't data encoding or compression in the traditional sense. Mina nodes compress data in the network by generating cryptographic proofs. Node operators play a crucial role in this process by designating themselves as SNARK-workers that generate zk-SNARKs for transactions that have been added to blocks.

To start a SNARK-worker, run these commands:

mina client set-snark-work-fee <FEE>
mina client set-snark-worker --address $MINA_PUBLIC_KEY

If your daemon is already running, restart the daemon with these flags:

args={["-run-snark-worker $MINA_PUBLIC_KEY", "-snark-worker-fee <fee>"]}

As a SNARK-worker, you get to share some of the block rewards for each block that include your compressed transactions. The block producer is responsible for gathering compressed transactions before including them into a block and is incentivized by the protocol to reward SNARK-workers.

SNARK-workers can be fairly compute intensive. If you need to limit their CPU usage, specify the number of threads that SNARK-workers use with the -snark-worker-parallelism flag. This can be especially useful if you're trying to run a block producer and SNARK-worker on the same machine and having issues producing blocks in time.

The roles and responsibilities of a Mina node operator offer you incentives to participate in block production through staking or delegation. Mina is a permissionless peer-to-peer network, so everything is managed and run in a decentralized manner by nodes all over the world.

Configure your mina daemon in daemon.json

By creating a file at ~/.mina-config/daemon.json, you can configure your mina daemon without providing options on the command line. This can be useful for running mina as a service and to avoiding repetitive typing.

Most of the options that can be passed to mina daemon on the command line can also be provided as options in the config file. See mina daemon -help for more details.

The following example file includes usage of the configuration parameters:

{
"daemon": {
"client-port": 1000,
"external-port": 1001,
"rest-port": 1002,
"block-producer-key": "/path/to/privkey-file",
"block-producer-password": "mypassword",
"block-producer-pubkey": "<MY PUBLICKEY>",
"coinbase-receiver": "<MY PUBLICKEY>",
"log-block-creation": false,
"log-received-blocks": false,
"log-snark-work-gossip": false,
"log-txn-pool-gossip": false,
"peers": ["seed-one.o1test.net", "seed-two.o1test.net"],
"run-snark-worker": "<MY PUBLICKEY>",
"snark-worker-fee": 10,
"snark-worker-parallelism": 1,
"work-reassignment-wait": 420000,
"work-selection": "seq"
}
}

In the ~/.mina-config/daemon.json file, include only the options you want to change.