Staking and Snarking Mina in Docker

Mai 15, 2021
Mina is the first cryptocurrency protocol with a succinct blockchain. Current cryptocurrencies like Bitcoin and Ethereum store hundreds of gigabytes of data, and as time goes on, their blockchains will only increase in size. With Mina however, no matter how much the usage grows, the blockchain always stays the same size - about 22kb. This means participants can quickly sync and verify the network. This breakthrough is made possible due to zk-SNARKs - a type of succinct cryptographic proof. Each time a Mina node produces a new block, it also generates a SNARK proof verifying that the block was valid. All nodes can then store the small proof, as opposed to the entire chain. By not having to worry about block size, the Mina protocol enables a blockchain that is decentralized at scale.
official documentation: https://docs.minaprotocol.com/en

Generating a Keypair

Adding Mina Repo

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

Installing Mina

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

Generating Keys

mkdir ~/keys && chmod 700 ~/keys
mina-generate-keypair -privkey-path ~/keys/my-wallet && chmod 600 ~/keys/my-wallet 
mina-validate-keypair -privkey-path ~/keys/my-wallet

Starting node in Docker Container

mkdir ~/.mina-config

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" \

-e CODA_PRIVKEY_PASS="PASSWORD" \

minaprotocol/mina-daemon-baked:1.1.5-a42bdee \

daemon \

--block-producer-key /keys/my-wallet \

--insecure-rest-server \

--file-log-level Debug \

--log-level Info \

--peer-list-url https://storage.googleapis.com/mina-seed-lists/mainnet_seeds.txt



Checking connectivity

docker exec -it mina mina client status

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.

Check your account

Import keys

docker exec -it mina mina accounts import -privkey-path ~/keys/my-wallet 

Check account balance

docker exec -it mina mina client get-balance -public-key PUBLIC_KEY

Mining (snarking)

mina client set-snark-work-fee 0.000001 

mina client set-snark-worker -address $MINA_PUBLIC_KEY

Snark-work-fee has to be adjusted supply and demand

Mina Coin is partnered with CoinList and will be available for sale on: https://coinlist.co/