SolMeet
Search…
A Starter Kit for Running Solana Validator
[Updated at 2022.3.31]

Overview

Validator Landscape

See Solana Beach for more details
  • 1600+ Validators
  • 1400+ RPC Nodes
  • 3000+ TPS
  • < 1s Block Time
  • ...

Economics

Solana’s crypto-economic system is designed to promote a healthy, long term self-sustaining economy with participant incentives aligned to the security and decentralization of the network. The main participants in this economy are validation-clients who secure solana network. At the early stage, just as many current blockchain economies (e.g. Bitcoin, Ethereum) does, rely on protocol-based rewards to support the economy, with the assumption that the revenue generated through transaction fees will support the economy in the long term, when the protocol derived rewards expire. see more here
So, where do the protocol-based rewards come from? The answer is Inflation Rate and transaction fees.
Initial Inflation Rate: 8% Dis-inflation Rate: −15% Long-term Inflation Rate: 1.5%
How can we avoid being affected by inflation? Stake your SOL and delegate to validator node.

Staking

Benefit
  1. 1.
    Avoid token dilution acording to inflation of SOL Staking tokens, which will receive their proportional distribution of inflation issuance, should assuage any dilution concerns for staked token holders.
  2. 2.
    Make Solana network more secure As more token holders choose to stake their SOL tokens to different validators across the network, and the total amount of stake on the network increases, it becomes increasingly difficult for even a coordinated and well-funded attacker to amass enough stake to single-handedly alter the outcome of a consensus vote for their own benefit.
Rewards people who stake their token earns their share by the formula and the figure below (or you can see here for more detail). You might notice there's a negative relation between staking yield and total SOL staked, which may be a factor that influences stake/unstake behavior.
1
Staking Yield = Inflation Rate × Validator Uptime ×
2
(1 − Validator Fee) × (1 / % SOL Staked)
3
where:
4
% SOL Staked = Total SOL Staked / Total Current Supply
Copied!
for example: (Statistics are from here)
1
Inflation Rate: 4.3%
2
Validator Uptime: 99.5%
3
Validator Fee: 10.0%
4
% SOL Staked: 77.1%
5
6
Staking Yield = 0.043 x 0.99.5 x (1 - 0.1) x (1 / 0.771)
7
= 0.0499 (4.99 %)
Copied!
Risk (Slashing) "Slashing" is any process by which some portion of stake delegated to a validator is destroyed as a punitive measure for malicious actions undertaken by the validator. If you stake your stake to malicious validator, part of your stake portion might be slashed too.
malicious actions include inconsistant voting during lockout time, or nodes who cause some block fail to full finalization. See more slashing rules here[1, 2]
How to join
  1. 3.
    Run a validator (talk more about this later)

Validator

Responsibility
  1. 1.
    verified received block
  2. 2.
    sending vote transaction (consensus mechanism)
Minimum Requirement
  • minimum SOL: 0.02685864 SOL(vote account rent)
  • hardware CPU 12 cores / 24 threads, RAM 128GB, Disk 1.5 TB (Accounts: 500GB, Ledger: 1TB) ... see more detail here
Cost
1.1 SOL/day at most (vote transaction cost)
Rewards
  1. 1.
    Protocol-based Rewards Issuances from a global, protocol-defined, inflation rate(short term). These rewards are delivered on top of earnings from transaction fees (long term)
  2. 2.
    Transaction Fee a fixed portion (initially 50%) of each transaction fee is destroyed, with the remaining fee going to the current leader processing the transaction.

Terminology

  • Validator vs RPC RPC node is a validator node who provide full functionality for public to query on-chain data and send transaction and also improved reliability, which means it needs higher hardware requirement than general validator node.
  • vote and stake account The rewards process is split into two on-chain programs. The Vote program solves the problem of making stakes slashable. The Stake program acts as custodian of the rewards pool and provides for passive delegation. The Stake program is responsible for paying rewards to staker and voter when shown that a staker's delegate has participated in validating the ledger. (Solana programs are stateless, thus we need accounts to store states)
  • identity same as keypair, in blockchain world address represent your identity.
  • paper wallet Solana commands can be run without ever saving a keypair to disk on a machine.
  • key rotation Leaders and validators are expected to use ephemeral keys for operation. And also for security concern, key rotation allows validator rotate the vote account authority keys with no effect on the stake accounts that have been delegate to the vote account.

Before We Start

Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

Create a Quiklabs Account

Here are the necessary steps to enroll in the test environment

Requirements

  • Access to a standard internet browser (Chrome browser recommended).
  • Time to complete the lab.
If you already have your own personal Google Cloud account or project, do not use it for this lab.
If you are using a Chrome OS device, open an Incognito window to run this lab.

Setup

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment.
It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

How to start your lab and sign in to the Google Cloud Console

  1. 1.
    Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is a panel populated with the temporary credentials that you must use for this lab.
  2. 2.
    Copy the username, and then click Open Google Console. The lab spins up resources, and then opens another tab that shows the Sign in page.
  • Open the tabs in separate windows, side-by-side.
  • If you see the Choose an account page, click Use Another Account. Choose an account
  1. 1.
    In the Sign in page, paste the username that you copied from the left panel. Then copy and paste the password.
Important: You must use the credentials from the left panel. Do not use your Google Cloud Training credentials. If you have your own Google Cloud account, do not use it for this lab (avoids incurring charges).
  1. 1.
    Click through the subsequent pages:
  • Accept the terms and conditions.
  • Do not add recovery options or two-factor authentication (because this is a temporary account).
  • Do not sign up for free trials.
  • After a few moments, the Cloud Console opens in this tab.
  • Please check with the upper top selected the project assigned to you.

Infrastructure Deployment

Create a VM (Navigation Menu -> Compute Engine -> VM instances -> Create Instance)
  • Use the default name, region, zone.
  • N2 series, Custom Machine type, CPU 24 cores, Ram 128 GB
  • Change the "Boot Disk", "SSD persistent disk", Size 500GB
  • Networking, Network tags, "solana"
  • Leave the rest by default
  • The above spec is based on Solana document
Create 1 Firewall rule (Navigation Menu -> VPC network -> Firewall -> Create Firewall Rule)
  • Name: solana-validator-ports
  • Network: default
  • Priority: 1000
  • Diretion of traffic: Ingress
  • Action on match: Allow
  • Target tags: solana
  • IPv4 ranges: 0.0.0.0/0
  • tcp:8899, 8900, 11000
  • udp:11000-11020

Commands to start a Validator

Connect to your Virtual Machine

  • Please visit the VM page (Navigation Menu -> Compute Engine -> VM instances)
  • Find the virtual machine you created, and click on the [SSH] buttom.
  • Now let's run some scripts!

Key and Configuration

Run following command to Solana Command Line Tool:
1
sh -c "$(curl -sSfL https://release.solana.com/v1.9.13/install)"
Copied!
Should get an output from previous command similiar to the following, please run it.
1
export PATH="/home/<studnet-00-ID>/.local/share/solana/install/active_release/bin:$PATH"
Copied!
By default, CLI connect to Mainnet Beta, Let's connect to Devnet
1
solana config set --url http://api.devnet.solana.com
Copied!
Leverage a System Tuner to update configuration automatically. For more detail please check Solana document
1
sudo $(command -v solana-sys-tuner) --user $(whoami) > sys-tuner.log 2>&1 &
Copied!
Solana CLI support 2 ways to create key pairs, file wallet or paper wallt. Let's use file wallet in this case for convinience. Paper wallet detail please check here
1
solana-keygen new -o ~/.config/solana/validator-keypair.json
Copied!
To show the pubkey again by running:
1
solana-keygen pubkey ~/.config/solana/validator-keypair.json
Copied!
Set the solana configuration to use your validator keypair for all following commands:
1
solana config set --keypair ~/.config/solana/validator-keypair.json
Copied!
You can use following command to check config status at any time:
1
solana config get
Copied!
To start your Validator, we need some SOL in the wallet. With Devnet we can simply get a SOL by following:
1
solana airdrop 1
Copied!
Let's check the balance
1
solana balance
Copied!
Before we launch our Validator, we also need another key-pair for Vote Account:
1
solana-keygen new -o ~/.config/solana/vote-account-keypair.json
Copied!
Also a key-pair for Authorized Withdrawer Account:
1
solana-keygen new -o ~/.config/solana/authorized-withdrawer-keypair.json
Copied!
Run this command to create your Vote Account:
1
solana create-vote-account ~/.config/solana/vote-account-keypair.json ~/.config/solana/validator-keypair.json ~/.config/solana/authorized-withdrawer-keypair.json
Copied!

Create script for managed background running Validator

Create a executable file validator.sh
1
touch ~/.config/solana/validator.sh
Copied!
Use your prefered editor to pasta following content to validator.sh
1
vim ~/.config/solana/validator.sh
Copied!
1
solana-validator \
2
--identity ~/.config/solana/validator-keypair.json \
3
--vote-account ~/.config/solana/vote-account-keypair.json \
4
--rpc-port 8899 \
5
--entrypoint entrypoint.devnet.solana.com:8001 \
6
--limit-ledger-size \
7
--log ~/.config/solana/solana-validator.log \
8
--dynamic-port-range 11000-11020 &
Copied!
Let's make it executable:
1
chmod 755 ~/.config/solana/validator.sh
Copied!
Now it's time to create a file for Systemd, which is the Linux program we are going to use"
1
sudo touch /etc/systemd/system/sol.service
Copied!
Paste following content to the file with your preferred editor: ( please change User, Environment, ExecStart with your own environment. )
1
sudo vim /etc/systemd/system/sol.service
Copied!
1
[Unit]
2
Description=Solana Validator
3
After=network.target
4
Wants=solana-sys-tuner.service
5
StartLimitIntervalSec=0
6
7
[Service]
8
Type=simple
9
Restart=always
10
RestartSec=1
11
User=<student-00-ID>
12
LimitNOFILE=1000000
13
LogRateLimitIntervalSec=0
14
Environment="PATH=/bin:/usr/bin:/home/<student-00-ID>/.local/share/solana/install/active_release/bin"
15
ExecStart=/home/<student-00-ID>/.config/solana/validator.sh
16
17
[Install]
18
WantedBy=multi-user.target
Copied!
Finally, let us run commands below to start our validator
1
sudo systemctl daemon-reload #let systemd to load our new service
Copied!
Enable the systemd, so when the service stop will bring up agaiin
1
sudo systemctl enable --now sol #enable this service when VM restart
Copied!
Now let's start the service
1
bash ~/.config/solana/validator.sh
Copied!

Check your validator status and logs

Let's check the log, once you see your validator catch up with other validator, can move to next step.
1
tail -f ~/.config/solana/solana-validator.log
Copied!
Check our Validator from the Solana Devnet
1
solana gossip | grep <PUBKEY>
Copied!
If you see your pubkey and the IP matching your VM external IP, Your Done!
Goal Incentivize new validators to join to secure Solana network
Get delegation from fundation
  • meet the Testnet Participation Criteria and all of the Baseline Criteria -> receive a “baseline” delegation from the Solana Foundation of 25,000 SOL
BASELINE REQUIREMENT
RESULT
Vote Credits
227,047 or more
Maximum Commission
10% or under
Solana Release
1.7.14 or greater
Self Stake
100 or more
Total Stake
3,000,000 or less
Infrastructure Concentration
10% or less
Infrastructure Concentration
Baseline in 5 of last 10 testnet epochs
  • meets all criteria to receive the baseline delegation and also meets all of the Bonus Criteria -> receive a “bonus” delegation (size is dynamic, this part depends on current participants)
Get delegation from external
  1. 1.
    starting a website and explaining why delegators should stake to you
  2. 2.
    starting a stake pool that promotes decentralization
  3. 3.
    joining a stake pool (https://solana.foundation/stake-pools) and receiving additional delegations from them.

References

  • https://github.com/DappioWonderland/solana
  • https://docs.solana.com/running-validator/validator-start
  • https://hackmd.io/@ironaddicteddog/solana-starter-kit
  • https://github.com/DappioWonderland/solana
tags: notes