Rent server onSponsored
1. Keys set-up
First of all we need to create directories for keys. To do it enter the following:
mkdir ~/keys
After this we will need a link to download our keys – this link can be found in your email (in case you are eligable to participate in the testnet). In order to download keys, enter the following:
wget -O ~/keys/keys.zip %url_from_email%
Result should be the following:
wget -O ~/keys/keys.zip https://storage.googleapis.com/testworldkeys/asloidfo3129021hfs8982j.zip
Then we need to unzip keys, to do this enter the following:
apt install unzipcd ~/keysunzip keys.zip
As a result 2 files should appear in the folder, names should be in the following format:
extra_fish_account_%number%extra_fish_account_%number%.pub
Let’s rename them for our convenience:
To do it, type the following:
mv extra_fish_account_%number% mina-walletmv extra_fish_account_%number%.pub mina-wallet.pubcd
Now let’s set access rights for our keys:
chmod 700 $HOME/keyschmod 600 $HOME/keys/mina-wallet
Now let’s set variables KEYPATH and MINA_PUBLIC_KEY. For the convenience let’s set them in .bashrc.
echo 'export KEYPATH=$HOME/keys/mina-wallet' >> $HOME/.bashrcecho 'export MINA_PUBLIC_KEY=$(cat $HOME/keys/mina-wallet.pub)' >> $HOME/.bashrcsource ~/.bashrc
After that we need to download the list of peers:
wget -O ~/peers.txt https://raw.githubusercontent.com/MinaProtocol/coda-automation/bug-bounty-net/terraform/testnets/testworld/peers.txt
Attention! Update peers once in 3 hours using @AkiAfroo script, to do this execute the following:
wget https://raw.githubusercontent.com/AkiAfroo/minacheckpeers/main/checkpeerschmod +x checkpeersbash checkpeers
In the pop-up enter 'Y' (in case you have new peers), click Enter
Once in 3 hours you need to execute bash checkpeers command.
2. Node Set-up with Ubuntu 18.04
As the first step here we need to open server’ ports. Usually they are already opened, but let’s double check:
sudo apt install ufwsudo ufw allow 22sudo ufw allow 8302sudo ufw allow 8303sudo ufw enable
Then let’s set-up the node itself:
sudo apt-get remove -y mina-testnet-postake-medium-curvesmkdir .coda-configsudo apt-get updatesudo apt-get install -y apt-transport-https ca-certificatesecho "deb [trusted=yes] http://packages.o1test.net release main" | sudo tee /etc/apt/sources.list.d/mina.listsudo apt-get updatesudo apt-get install -y curl mina-testnet-postake-medium-curves=0.3.3-3ef8663 --allow-downgrades
Let’s check the node version using coda version command, the version should be
[DIRTY]3ef86631e3a38150b5092faec47da144b0a46020
, in case it differs either:
- This guide is outdated, the actual version you can always check in the official project docs
- You perform some of the previous steps incorreclty, retry from the sudo apt-get remove -y mina-testnet-postake-medium-curves step.
Congatz! You sucessfully set-up a MINA node.
3. Mining Preparations
Before the start we need to do the following steps: import account and unlock the key:
coda accounts import -privkey-path $KEYPATH
In the pop-up enter your private key (from the email you got before), and set the password for the account – remember this password, you will need it to unlock your account further.
In case everything went well you’ll get “Successful” message.
4. Node Launch
In order to launch the node, enter the following commands:
sudo apt install screenscreen -S mina_node
Next:
CODA_PRIVKEY_PASS=%password_from_email% coda daemon -peer-list-file ~/peers.txt \-block-producer-key ~/keys/mina-wallet -generate-genesis-proof true -file-log-level Info \-run-snark-worker $MINA_PUBLIC_KEY -super-catchup
Ctrl + A, then D
Check node status:
coda client status
or
watch -n 30 "coda client status | grep -v 'ip4/'"
In this case it will be checked every 30 secs and update automatically
* In order to get back to the node window (restart or just to check) enter the following: screen -rd mina_node
Wait for the ‘Synced’ status in the ‘Sync status’ lane.
Congratulations, your node is working!
5. Snark Stopper set-up (optional)
Snark stopper is for those who set Block Producer and Snark worker on the same server.
Snark worker uses all processing resources available, but this script stops snark worker in case we are close to block producing and resumes it when block producing is over.
Install:
screen -S mina-snark-stoppersudo apt install jq git python3-venvgit clone https://github.com/c29r3/mina-snark-stopper.gitcd mina-snark-stopperpython3 -m venv venvsource ./venv/bin/activatepip3 install -r requirements.txt
Now let’s setup:
nano $HOME/mina-snark-stopper/config.yml
Change attributes WORKER_PUB_KEY and WORKER_FEE:
WORKER_PUB_KEY: YOUR_PUBLIC_KEY replace YOUR_PUBLIC_KEY with$MINA_PUBLIC_KEYWORKER_FEE: 1 replace 1 with 0.4-0.5
Launch:
venv/bin/python3 snark-stopper.pyCtrl + A, then D
Now let’s check the script status:
screen -rd mina-snark-stopper
In case of any errors check the following:
-
- You have the latest Snark Stopper version installed
-
- In order to do this enter the following:
cd ~/mina-snark-stopper git pull
- If it downloaded nothing, then the version you have the latest version, itherwise enter the following:
venv/bin/python3 snark-stopper.py
After this your script should work properly.
-
- Your Snark Worker is working. In order to check it, enter the following:
- You have the latest Snark Stopper version installed
coda client status
In case it’s not there, execute the following:
coda client set-snark-worker -address $MINA_PUBLIC_KEY
After this your script should work correctly, otherwise please consult the development team.
Exit the view:
Ctrl + A, then D
If you have:
- Node status ‘Synced’
- The latest node version (type coda version command, it should be the same as in the header of this guide and/or official project documentation)
- Snark Stopper is working (in case you have it)
You have a working Mina node, congratulations!
Addendum: Several Snark Workers Set-up
Requirements:
- Several servers with the following configuration:
- CPU: min. 4
- RAM: min 8Gb
In order to set-up a Snark worker one don’t need to set-up a full node, we just need to make several changes to your main node (this node will work as a coordinator for the rest servers).
We need to add the following flags to the current node:
- -run-snark-coordinator $MINA_PUBLIC_KEY
- -snark-worker-fee 0.5
- -bind-ip %this_server_ip%
As a result your main node run command will look like this:
CODA_PRIVKEY_PASS=%your_key_from_email% coda daemon -peer-list-file ~/peers.txt \-block-producer-key ~/keys/mina-wallet -generate-genesis-proof true -file-log-level Info \-run-snark-worker $MINA_PUBLIC_KEY -run-snark-coordinator $MINA_PUBLIC_KEY -snark-worker-fee 0.5 \-bind-ip %current_node_ip% -super-catchup
Also we would need to white list our servers (this needs to be done every time you start the node):
coda advanced client-trustlist add -ip-address %snark_worker_server_ip%/32
You’ll need to repeat this command for every Snark worker server.
For servers which will be Snark workers we need to execute the following:
mkdir .coda-configsudo apt-get updatesudo apt-get install -y apt-transport-https ca-certificatesecho "deb [trusted=yes] http://packages.o1test.net release main" | sudo tee /etc/apt/sources.list.d/mina.listsudo apt-get updatesudo apt-get install -y curl mina-testnet-postake-medium-curves=0.3.3-3ef8663 --allow-downgrades
As a next step we’ll need to connect to our Snark coordinator (our main node):
screen -S snark_nodecoda internal snark-worker -daemon-address %snark_worker_IP_address%:8301 -proof-level full -shutdown-on-disconnect false
After this the Snark worker will start and the necessary files will be downloaded (for the first launch, in the next launches you’ll see general messages about Snark worker like "SNARK work $work_ids received from $address").
Addendum: Several Block Producer Set-up
Requirements are the same as for the general node:
- Server requirements:
- CPU: min. 8 CPU(vCPU)
- RAM: min. 16 Gb
32 Gb recommended - Ubuntu 18.04
- Testworld invitation email
We need to do steps 1 to 4 but on another server.
In this case (there are 2 or more block producers with the same key), your block producing servers will produce the block simultaneously, and that will significantly increase the chances of successful block producing.
Useful additional information:
Links
Mina explorer – minaexplorer.com
Official documentation – minaprotocol.com
Mina Snark Stopper – github.com
Mina Peers Checker – github.com
Commands:
Block producing:
coda client set-staking -public-key $MINA_PUBLIC_KEY – set block producing to the address $MINA_PUBLIC_KEY
Snark producing:
coda client set-snark-worker -address $MINA_PUBLIC_KEY – set Snark Worker to work for the address $MINA_PUBLIC_KEY
coda client set-snark-work-fee 0.5 – set Snark fee as 0.5 (recommended commission is 0.4-0.5)
Send transactions:
coda client send-payment -amount 0.01 -receiver receiver_address -fee 100 -sender $MINA_PUBLIC_KEY – send transaction of 0.01 with the fee of 100 to the address
receiver_address (in order to send the account should be unlocked with coda accounts unlock -public-key $MINA_PUBLIC_KEY)