DEV Community

EgorMajj
EgorMajj

Posted on

Aleo Testnet 3 Tutorial Updated

Server requirements

Minimum (VDS/DS):
16 CPU, 16 GB RAM, 128 GB SSD, Ubuntu 20.04

Recommended (VDS/DS):
32 CPU, 32 GB RAM, 128 GB SSD, Ubuntu 20.04

You can also use GPU for increased farming soon.

Installation

Update packages

sudo apt update && sudo apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

Install required packages

sudo apt install wget jq git build-essential pkg-config libssl-dev -y
Enter fullscreen mode Exit fullscreen mode

Instal Rust

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/rust.sh)
Enter fullscreen mode Exit fullscreen mode

Rust version must be at least1.65.0

rustc --version
Enter fullscreen mode Exit fullscreen mode

If not, then uninstall with the command below and install again

.  < ( wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/rust.sh )  \ 
-un
Enter fullscreen mode Exit fullscreen mode

Clone the repository with the node

cd; git clone https://github.com/AleoHQ/snarkOS.git --depth 1
Enter fullscreen mode Exit fullscreen mode

Go to the folder with snarkOS

cd snarkOS
Enter fullscreen mode Exit fullscreen mode

Build the snarkOS binary

cargo build --release

Enter fullscreen mode Exit fullscreen mode

Copy the binary file to the standard binary storage

mv $HOME/snarkOS/target/release/snarkos /usr/bin

Enter fullscreen mode Exit fullscreen mode

Already have a wallet

Place a file called aleo_account.txt, necessarily containing the string

      Private key  APrivateKey1___
Enter fullscreen mode Exit fullscreen mode

On the path (the command displays the path)

echo $HOME/aleo_account.txt
Enter fullscreen mode Exit fullscreen mode

No wallet yet

Create a wallet

snarkos account new > $HOME/aleo_account.txt
Enter fullscreen mode Exit fullscreen mode

Make a backup copy of the wallet data file, saving it in a safe place (the command displays the path)

echo $HOME/aleo_account.txt
Enter fullscreen mode Exit fullscreen mode

Do not show private key to anyone

Continuation

Add the wallet address to the system as a variable

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n aleo_wallet_address -v `grep -oPm1 "(?<=Address  )([^%]+)(?=$)" $HOME/aleo_account.txt`
Enter fullscreen mode Exit fullscreen mode

Add the private key of the wallet to the system as a variable

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n aleo_private_key -v `grep -oPm1 "(?<=Private Key  )([^%]+)(?=$)" $HOME/aleo_account.txt`
Enter fullscreen mode Exit fullscreen mode

Check adding variables to the system

echo $aleo_wallet_address $aleo_private_key
Enter fullscreen mode Exit fullscreen mode

If one of them is missing, then they will return to the step with working with the wallet .

Open used ports

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/ports_opening.sh) 3033 4133
Enter fullscreen mode Exit fullscreen mode

Create service file

printf "[Unit]
Description=Aleo Prover
After=network-online.target

[Service]
User=$USER
ExecStart=`which snarkos` start --nodisplay --prover $aleo_private_key
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target" > /etc/systemd/system/aleod.service
Enter fullscreen mode Exit fullscreen mode

Run service file

sudo systemctl daemon-reload
sudo systemctl enable aleod
sudo systemctl restart aleod
Enter fullscreen mode Exit fullscreen mode

Add a command to view the node log to the system as a variable

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n aleo_log -v "sudo journalctl -fn 100 -u aleod" -a
Enter fullscreen mode Exit fullscreen mode

Make sure the node is running

aleo_log
Enter fullscreen mode Exit fullscreen mode

Update

Manual
If the GitHub repository with the node (folder snarkOS) is not downloaded, then clone it

cd; git clone https://github.com/AleoHQ/snarkOS.git --depth 1
Enter fullscreen mode Exit fullscreen mode

Update binaries

cd $HOME/snarkOS && \
git stash; \
git pull; \
cargo clean; \
cargo build --release; \
mv $HOME/snarkOS/target/release/snarkos /usr/bin; \
cd
Enter fullscreen mode Exit fullscreen mode

Restart service file

sudo systemctl restart aleod
Enter fullscreen mode Exit fullscreen mode

Removal

Don't stop

sudo systemctl stop aleod
Enter fullscreen mode Exit fullscreen mode

Delete service file

sudo systemctl disable aleod
rm -rf /etc/systemd/system/aleod.service
sudo systemctl daemon-reload
Enter fullscreen mode Exit fullscreen mode

Delete the project folder and the binary file

rm -rf $HOME/snarkOS /usr/bin/snarkos
Enter fullscreen mode Exit fullscreen mode

Useful Commands

Available variables (remove echo when using)

echo $aleo_wallet_address
echo $aleo_private_key
Enter fullscreen mode Exit fullscreen mode

View log

Prover

aleo_log sudo journalctl -fn 100 -u aleod 
Enter fullscreen mode Exit fullscreen mode

Automatic update script

sudo journalctl -fn 100 -u aleou
Enter fullscreen mode Exit fullscreen mode

Restart the node

sudo systemctl restart aleod

Enter fullscreen mode Exit fullscreen mode

Stop auto update script

sudo systemctl stop aleou

Enter fullscreen mode Exit fullscreen mode

Top comments (0)