Create a read-only node

Tutorial*

*below are additional steps not covered in tutorial

1. Install the Solana CLI (Linux) (to get tools)

Open a Terminal application

Install the Solana release v1.18.26 on your machine by running:

sh -c "$(curl -sSfL https://release.solana.com/v1.18.26/install)"

The following output indicates a successful update:

downloading v1.18.26 installer
   1.18.26 initialized

Depending on your system, the end of the installer messaging may prompt you to

Please update your PATH environment variable to include the solana tools programs:

export PATH="/home/ubuntu/.local/share/solana/install/active_release/bin:$PATH"

Confirm you have the desired version of solana installed by running:

solana --version

The output should look like this:

solana-cli 1.18.26 (src:d9f20e95; feat:3241752014, client:SolanaLabs)

2. Install rust, cargo, rustfmt etc

Install rustc, cargo and rustfmt.

curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
rustup component add rustfmt 

Make sure you are using the latest stable rust version by running:

rustup update

Also install libssl-dev, pkg-config, zlib1g-dev, protobuf etc.

sudo apt-get update
sudo apt-get install libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang cmake make libprotobuf-dev protobuf-compiler

3. System Tuning (Linux)

Your system will need to be tuned in order to run properly. Your validator may not start without the settings below.

Optimize sysctl knobs

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

# Increase memory mapped files limit
vm.max_map_count = 1000000

# Increase number of allowed open file descriptors
fs.nr_open = 1000000
EOF"
sudo sysctl -p /etc/sysctl.d/21-solana-validator.conf

Increase systemd and session file limits

Add

LimitNOFILE=1000000

to the [Service] section of your systemd service file, if you use one, otherwise add

DefaultLimitNOFILE=1000000

to the [Manager] section of /etc/systemd/system.conf, using

nano /etc/systemd/system.conf

Execute configuration

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

Close all open sessions (log out then, in again)

4. Setup Solanalabs (Xolana) validator

Clone solana-validator code

git clone https://github.com/FairCrypto/solanalabs 
cd solanalabs
git checkout dyn_fees_v1

To verify your configuration, and should be * dyn_fees_v1:

git branch

5. Build

cargo build --release

Check ok with:

ls -l target/release/solana-validator

Copy solana-validator to your path:

cp target/release/solana-validator /home/ubuntu/.local/share/solana/install/active_release/bin/solana-validator

6. Set to Xolana network

solana config set -u https://xolana.xen.network

To verify set network, use:

solana config get

7. Create keypairs

Using command solana-keygen to generate a new wallet. It will generate a 12-word seed (aka. mnemonic, or recovery) phrase. Save it safe.

solana-keygen new --no-passphrase -o ~/.config/solana/id.json
solana-keygen new --no-passphrase -o ~/.config/solana/identity.json
solana-keygen new --no-passphrase -o ~/.config/solana/vote.json
solana-keygen new --no-passphrase -o ~/.config/solana/stake.json

To switch between keypairs:

solana config set -k id.json

8. Fund wallet

Check balance:

solana balance

9. Create a validator startup script & start node

In your ubuntu home directory (e.g. /home/ubuntu/), create a folder called bin. Inside that folder create a file called validator.sh and make it executable:

mkdir -p /home/ubuntu/bin
touch /home/ubuntu/bin/validator.sh

Next, open the validator.sh file for editing:

nano /home/ubuntu/bin/validator.sh

Copy and paste the following contents into validator.sh then save the file:

#!/bin/bash
exec solana-validator \
    --identity ~/.config/solana/identity.json \
    --vote-account ~/.config/solana/vote.json \
    --known-validator C58LhVv822GiE3s84pwb58yiaezWLaFFdUtTWDGFySsU \
    --known-validator Abt4r6uhFs7yPwR3jT5qbnLjBtasgHkRVAd1W6H5yonT \
    --only-known-rpc \
    --log /home/ubuntu/validator.log \
    --ledger ./ledger \
    --rpc-port 8899 \
    --dynamic-port-range 8000-8020 \
    --entrypoint xolana.xen.network:8001 \
    --wal-recovery-mode skip_any_corrupted_record \
    --limit-ledger-size 50000000 \
    --enable-rpc-transaction-history \
    --enable-extended-tx-metadata-storage \
    --rpc-pubsub-enable-block-subscription \
    --full-snapshot-interval-slots 5000 \
    --maximum-incremental-snapshots-to-retain 10 \
    --maximum-full-snapshots-to-retain 50 \

Make validator startup script executable:

chmod +x /home/ubuntu/bin/validator.sh

Make sure you're in the home directory:

cd ~ 

Start validator with nohup:

nohup /home/ubuntu/bin/validator.sh &

Check validator logs to see if it's running:

tail -f /home/ubuntu/validator.log

Check catch up status:

solana catchup --our-localhost

Use monitor command to check validator operations:

solana-validator --ledger ./ledger monitor

See all nodes connected to network, whether they are staked or not. Your identity.json should show up there.

solana gossip

Check validator process:

ps aux | grep validator    

Kill validator process:

solana-validator exit -f

Last updated