DEV Community

Cover image for Aleo Node Guide
EgorMajj
EgorMajj

Posted on

Aleo Node Guide

Project Information

Aleo is a blockchain that uses Zero-Knowledge proof technology. The use of this technology allows for a high level of privacy when working with the network - non-disclosure of the sender's wallet and transaction amount.

Aleo supports the operation of smart contracts, and as a consequence, the possibility of creating DApps on it. The LEO application development language and its own development environment (IDE) were developed especially for this purpose.

Installing Node

Server requirements
Minimum (VDS/DS):
16 CPUs, 16 GB RAM, 128 GB SSD, Ubuntu 20.04

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

I use Hetzner
https://accounts.hetzner.com/login

Image description

Launch

Linux |Manual|
Refresh packets

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

Install the required packages

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

Install the Rust

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

Clone a repository with a node

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

Go to the snarkOS folder

cd snarkOS
Enter fullscreen mode Exit fullscreen mode

Build a 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

Check version

snarkos --version
Enter fullscreen mode Exit fullscreen mode

Already have a wallet

Place a file called account_aleo.txt, necessarily containing the line

 Address  aleo1___
Enter fullscreen mode Exit fullscreen mode

By path (the command displays the path)

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

No wallet yet.

Create a Wallet

snarkos experimental new_account > $HOME/account_aleo.txt
Enter fullscreen mode Exit fullscreen mode

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

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

Do not show your private key to anyone

Continued

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/account_aleo.txt`
Enter fullscreen mode Exit fullscreen mode

Check that the address was added to the system

echo $aleo_wallet_address
Enter fullscreen mode Exit fullscreen mode

If not, go back to the step with the wallet work

Open the ports in use

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

Create a service file

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

[Service]
User=$USER
ExecStart=`which snarkos` --miner $aleo_wallet_address --trial  --node 0.0.0.0:4132 --rpc 0.0.0.0:3032
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

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

Run the 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 miner's 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

Add a command to view information about the miner in the system as a variable

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n aleo_node_info -v ". <(wget -qO- https://raw.githubusercontent.com/SecorD0/Aleo/main/node_info.sh) -l RU 2> /dev/null" -a
Enter fullscreen mode Exit fullscreen mode

Wait a couple of minutes for the miner to start up

aleo_log
Enter fullscreen mode Exit fullscreen mode

Linux |automatic|
Run the script and wait for the installation to complete

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

To start the miner on an existing wallet, you need to put a file called account_aleo.txt, which must contain the line

      Address aleo1___
Enter fullscreen mode Exit fullscreen mode

Path (the command shows the path)

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

And run the script after that

Reset synchronization

Stop the miner

sudo systemctl stop aleod
Enter fullscreen mode Exit fullscreen mode

Uninstall the database

rm -rf $HOME/.aleo/storage/ledger-2
Enter fullscreen mode Exit fullscreen mode

Restart the miner

sudo systemctl restart aleod
Enter fullscreen mode Exit fullscreen mode

Information about the miner

Add a command to view information about the miner in the system as a variable

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n aleo_node_info -v ". <(wget -qO- https://raw.githubusercontent.com/SecorD0/Aleo/main/node_info.sh) -l RU 2> /dev/null" -a
Enter fullscreen mode Exit fullscreen mode

View information about the miner

aleo_node_info
Enter fullscreen mode Exit fullscreen mode

Update

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

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

Update the binary files

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

Run the service file

sudo systemctl restart aleod
Enter fullscreen mode Exit fullscreen mode

Semi-automatic
Run the script and wait for the update to complete

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/Aleo/main/multi_tool.sh) -u
Enter fullscreen mode Exit fullscreen mode

Automatic
Create a service file

printf "[Unit]
Description=Aleo auto-updater
After=network.target

[Service]
type=forking
User=$USER
Environment="HOME=$HOME"
WorkingDirectory=$HOME
ExecStartPre=`which wget` -qO $HOME/.aleo/multi_tool.sh https://raw.githubusercontent.com/SecorD0/Aleo/main/multi_tool.sh
ExecStartPre=`which chmod` +x $HOME/.aleo/multi_tool.sh
ExecStart=$HOME/.aleo/multi_tool.sh -u
Restart=always
RestartSec=1m

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

Run the service file

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

The script restarts every minute

To view the log of the auto update script

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

Useful Commands

Available variables (remove echo if used)

echo $aleo_wallet_address
Enter fullscreen mode Exit fullscreen mode

View log
Miner

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

View information about the miner

aleo_node_info
Enter fullscreen mode Exit fullscreen mode

Restart the miner

sudo systemctl restart aleod
Enter fullscreen mode Exit fullscreen mode

Top comments (0)