Installation

This section will cover the basic installation of a SafeCoin Validator. The setup instructions are the same regardless of whether you plan to run a Pruned or a Full History node. The validator start up command determines the validator running mode.

I’d like to remind you of the Official Installation Guide here.

Assumptions

At this stage I am assuming you have terminal/SSH access to your VPS or dedicated server and you have root privileges.

Also check your server meets the Hardware Requirements.

Create a non-root User

We should always run our SafeCoin Validator as a non-root user, it’s a good security practice. So let’s create a user, you can choose any name however for this installation i’m going to use safecoin.

adduser safecoin

Set your desired password when requested. Now let’s add root privileges to your new user.

usermod -aG sudo safecoin

Update Ubuntu Repositories

Now let’s update all the Ubuntu packages and repository data.

apt update

apt upgrade -y

Increase Default File Descriptor Limits

The default Ubuntu 20.04 limits need to be increased for your validator to run successfully.

sudo bash -c "cat >/etc/security/limits.d/90-solana-nofiles.conf <<EOF
# Increase process file descriptor count limit
* - nofile 1000000
EOF"

sudo bash -c "cat >/etc/sysctl.d/20-solana-mmaps.conf <<EOF
# Increase memory mapped files limit
vm.max_map_count = 1000000
EOF"

sudo sysctl -p /etc/sysctl.d/20-solana-mmaps.conf

sudo bash -c "cat >/etc/sysctl.d/20-solana-udp-buffers.conf <<EOF
# Increase UDP buffer size
net.core.rmem_default = 134217728
net.core.rmem_max = 134217728
net.core.wmem_default = 134217728
net.core.wmem_max = 134217728
EOF"

sudo sysctl -p /etc/sysctl.d/20-solana-udp-buffers.conf

Configure UFW Firewall

We need to allow specific ports for your validator to be able to connect to the rest of the validator network.

sudo ufw allow 8328:8329/tcp
sudo ufw allow 8328:8329/udp
sudo ufw allow 10000:12000/tcp
sudo ufw allow 10000:12000/udp

Reboot your System

Reboot so that all of our changes take effect.

reboot now

Login with you non-root Username

When your system has restarted proceed to login with your non-root username and then proceed with the installation.

Install Dependencies and Modules

curl https://sh.rustup.rs -sSf | sh

source $HOME/.cargo/env

rustup component add rustfmt

rustup update

sudo apt-get install libssl-dev libudev-dev \
pkg-config zlib1g-dev llvm clang make git screen -y

Clone SafeCoin GitHub Repository

This will download the latest source files from SafeCoin git repository, we will then proceed to build the binaries.

git clone https://github.com/Fair-Exchange/Safecoin.git

cd Safecoin

cargo build --release

./fetch-perf-libs.sh

cd

Creating the Ledger Folder and Keypairs

The ledger folder can have any name but for our purposes we will use the ~/ledger folder as per the official guide. We will then proceed to create the keypairs required for the validator to function.

mkdir ~/ledger

Create the unique validator identity keypair. Make a note of the seed words and keep them in a safe place. In the event of a complete failre the keypairs can be recovered using the seed words. You do not need to set passwords on the keypairs.

First we create the validator identity keypair

~/Safecoin/target/release/safecoin-keygen new --word-count 24 -o ~/ledger/validator-identity.json

Next we create the validator vote account keypair

~/Safecoin/target/release/safecoin-keygen new --word-count 24 -o ~/ledger/validator-vote-account.json

Next we create the authorized withdrawer keypair

~/Safecoin/target/release/safecoin-keygen new --word-count 24 -o ~/ledger/authorized-withdrawer.json

Finally we set the default keypair as the validator identity

~/Safecoin/target/release/safecoin config set --keypair ~/ledger/validator-identity.json

You validator will need some funds so that it can take part in the voting process. For this we need to credit the valdiator-indentity address and this is a hot wallet that may need to be topped up frmo time to time, so keep an eye on the balance.

# retrieve the validator identity address

~/Safecoin/target/release/safecoin address

From safe.trade or the SafeCoin Web Wallet, send 10 SAFE to the validator identity address as detailed above.

# send 10 SAFE to the validator-identity address

# now let's check the balance

~/Safecoin/target/release/safecoin balance

# if the balance report 10 SAFE then continue

We can now create the vote-account which will automatically debit funds from the identity-account.

~/Safecoin/target/release/safecoin create-vote-account ~/ledger/validator-vote-account.json ~/ledger/validator-identity.json ~/ledger/authorized-withdrawer.json

You will see a transaction id which confirms everything it good.

Starting your Validator

The startup command is a long one and it differs slightly according to whether you are running a Pruned node or a Full History node.

To start up a Pruned Node, your startup command is:

NDEBUG=1 ~/Safecoin/target/release/safecoin-validator \
        --identity ~/ledger/validator-identity.json \
        --ledger ~/ledger/validator-ledger \
        --expected-genesis-hash HfHmB9nh7EjpqoCL2DDZ559SJW4xN52gxheWPER782jW \
        --wal-recovery-mode skip_any_corrupted_record  \
        --known-validator 3USWzeHtWnMjzFCgmY5sUGWjn2J6KvM6xEgxegkrD16P \
        --known-validator 4aWxVu4ZjKV9EtuCZi4b8Z1XwsvDWvyyfA7LRXjhDDsA \
        --known-validator 4BRXtL6nEKDVJdYPEwgGCfAAvEHT4C4Sj5peQz8kHGZu \
        --vote-account ~/ledger/validator-vote-account.json \
        --authorized-voter ~/ledger/validator-identity.json \
        --rpc-port 8328 --enable-rpc-transaction-history \
        --entrypoint entrypoint.mainnet-beta.safecoin.org:10015 \
        --entrypoint entrypoint2.mainnet-beta.safecoin.org:10015 \
        --entrypoint entrypoint3.mainnet-beta.safecoin.org:10015 \
        --limit-ledger-size &

To start up a Full History node, simply remove the –limit-ledger-size option, start up the validator, give it 5 minutes to download the genesis block then stop your validator and add the –no-snapshot-fetch option. This time, you can leave it running.

Viewing the SafeCoin Validator log file

You can view the validator log from from this session or a future sessions as follows

tail -f <safecoin-validator-*.log>

Staking on your Validator

The Official guide covers these steps however I do not recommend you create a stake-account on the validator. It is not necessary for your validator to function. Your stake-account should be created and funded externally to your validator.

Check out Staking with CLI which shows how to setup stake accounts remote to your validator e.g. local laptop/desktop.