Aleo Testnet 3 Tutorial Updated
Published: 2022-12-15 22:38:09

## 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

```javascript
sudo apt update && sudo apt upgrade -y
```
Install required packages

```javascript
sudo apt install wget jq git build-essential pkg-config libssl-dev -y
```

Instal Rust

```javascript
. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/rust.sh)
```


> Rust version must be at least1.65.0

```javascript
rustc --version
```

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

```javascript
.  < ( wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/rust.sh )  \ 
-un
```

Clone the repository with the node

```javascript
cd; git clone https://github.com/AleoHQ/snarkOS.git --depth 1
```
Go to the folder with snarkOS

```javascript
cd snarkOS
```
Build the snarkOS binary

```javascript
cargo build --release

```
Copy the binary file to the standard binary storage

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

```
**Already have a wallet**

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

```javascript
      Private key  APrivateKey1___
```
On the path (the command displays the path)

```javascript
echo $HOME/aleo_account.txt
```
**No wallet yet**

Create a wallet

```javascript
snarkos account new > $HOME/aleo_account.txt
```

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

```javascript
echo $HOME/aleo_account.txt
```

> **Do not show private key to anyone**

**Continuation**

Add the wallet address to the system as a variable

```javascript
. <(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`
```

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

```javascript
. <(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`
```

Check adding variables to the system

```javascript
echo $aleo_wallet_address $aleo_private_key
```
If one of them is missing, then they will return to the step with **working with the wallet** .

Open used ports

```javascript
. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/ports_opening.sh) 3033 4133
```

Create service file

```javascript
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
```
Run service file

```javascript
sudo systemctl daemon-reload
sudo systemctl enable aleod
sudo systemctl restart aleod
```
Add a command to view the node log to the system as a variable

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

Make sure the node is running

```javascript
aleo_log
```

## Update

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

```javascript
cd; git clone https://github.com/AleoHQ/snarkOS.git --depth 1
```
Update binaries

```javascript
cd $HOME/snarkOS && \
git stash; \
git pull; \
cargo clean; \
cargo build --release; \
mv $HOME/snarkOS/target/release/snarkos /usr/bin; \
cd
```
Restart service file

```javascript
sudo systemctl restart aleod
```

## Removal

Don't stop

```javascript
sudo systemctl stop aleod
```
Delete service file

```javascript
sudo systemctl disable aleod
rm -rf /etc/systemd/system/aleod.service
sudo systemctl daemon-reload
```
Delete the project folder and the binary file

```javascript
rm -rf $HOME/snarkOS /usr/bin/snarkos
```

## Useful Commands


Available variables (remove echo when using)

```javascript
echo $aleo_wallet_address
echo $aleo_private_key
```
View log

**Prover** 

```javascript
aleo_log sudo journalctl -fn 100 -u aleod 
```
**Automatic update script**

```javascript
sudo journalctl -fn 100 -u aleou
```

Restart the node

```javascript
sudo systemctl restart aleod

```
Stop auto update script

```javascript
sudo systemctl stop aleou

```