|
| 1 | +# Solana |
| 2 | + |
| 3 | +import { Callout } from "/src/components/callout"; |
| 4 | + |
| 5 | +Instructions to set up your Solana Validator node. |
| 6 | + |
| 7 | +### Requirements |
| 8 | + |
| 9 | +- [Setup your Axelar validator](/validator/setup/overview/) |
| 10 | +- Minimum hardware requirements: CPUs: 2.8GHz 12 cores / 24 threads, RAM: 256 GB Storage (SSD): 2 TB NVMe drive |
| 11 | +- Ubuntu 20.04 |
| 12 | +- [Official Documentation](https://docs.anza.xyz/operations/setup-a-validator) |
| 13 | + |
| 14 | +### Install the Solana CLI |
| 15 | + |
| 16 | +All commands mentioned in this section should be done on your trusted computer and NOT on a server where you intend to run your validator. |
| 17 | + |
| 18 | +Install the Agave release on your local (not the server) machine by running: |
| 19 | + |
| 20 | +```bash |
| 21 | +sh -c "$(curl -sSfL https://release.anza.xyz/v2.2.0/install)" |
| 22 | +``` |
| 23 | + |
| 24 | +You can replace v2.2.0 with the release tag matching the software version of your desired release. |
| 25 | + |
| 26 | +Confirm you have the desired version of solana installed by running: |
| 27 | + |
| 28 | +```bash |
| 29 | +solana --version |
| 30 | +``` |
| 31 | + |
| 32 | +After a successful install, `agave-install update` may be used to easily update the Solana software to a newer version at any time. |
| 33 | + |
| 34 | +Once you have successfully installed the cli, the next step is to change your config so that it is making requests to the right cluster: |
| 35 | + |
| 36 | +<tabs> |
| 37 | + <tab-item title="Mainnet"> |
| 38 | + ```bash |
| 39 | + export SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=mainnet-beta,u=mainnet-beta_write,p=password" |
| 40 | + solana config set --url https://api.mainnet-beta.solana.com |
| 41 | + ``` |
| 42 | + </tab-item> |
| 43 | + <tab-item title="Testnet"> |
| 44 | + ```bash |
| 45 | + export SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=tds,u=testnet_write,p=c4fa841aa918bf8274e3e2a44d77568d9861b3ea" |
| 46 | + solana config set --url https://api.testnet.solana.com/ |
| 47 | + ``` |
| 48 | + </tab-item> |
| 49 | +</tabs> |
| 50 | + |
| 51 | +### Create a new keypair |
| 52 | + |
| 53 | +Create a new keypair for your validator, vote account, and authorized withdrawer. |
| 54 | + |
| 55 | +```bash |
| 56 | +solana-keygen new -o validator-keypair.json |
| 57 | +solana-keygen new -o vote-account-keypair.json |
| 58 | +solana-keygen new -o authorized-withdrawer-keypair.json |
| 59 | +``` |
| 60 | + |
| 61 | +Here’s what each keypair is used for: |
| 62 | + |
| 63 | +Validator keypair (validator-keypair.json) |
| 64 | +This is the identity of your validator node. It signs votes, transactions, and blocks. Think of it as the “identity card” for your validator in the Solana network. |
| 65 | + |
| 66 | +Vote account keypair (vote-account-keypair.json) |
| 67 | +This account holds and tracks your validator’s voting credits. It’s linked to your validator identity and records the validator’s participation in consensus. |
| 68 | + |
| 69 | +Authorized withdrawer keypair (authorized-withdrawer-keypair.json) |
| 70 | +This key has permission to withdraw rewards from the vote account. You can (and often should) separate this from the validator operator to improve security, as it controls the movement of funds. |
| 71 | + |
| 72 | +Reminder: Even if you’re familiar with keypair management, here’s a quick best practices review: |
| 73 | +- Store keypairs securely and back them up safely. |
| 74 | +- Never share private keys or store them on insecure machines. |
| 75 | +- Set strict file permissions (`chmod 600`). |
| 76 | + |
| 77 | +### Create a vote account |
| 78 | + |
| 79 | +Create a vote account for your validator. |
| 80 | + |
| 81 | +```bash |
| 82 | +solana config set --keypair ./validator-keypair.json |
| 83 | +``` |
| 84 | + |
| 85 | +Now verify your account balance of 0: |
| 86 | + |
| 87 | +```bash |
| 88 | +solana balance |
| 89 | +``` |
| 90 | + |
| 91 | +Deposit some SOL into that keypair account in order create a transaction |
| 92 | + |
| 93 | +```bash |
| 94 | +solana airdrop 1 |
| 95 | +``` |
| 96 | + |
| 97 | +The airdrop sub command does not work on mainnet, so you will have to acquire SOL and transfer it into this keypair's account if you are setting up a mainnet validator. |
| 98 | + |
| 99 | +Create a vote account: |
| 100 | + |
| 101 | +```bash |
| 102 | +solana create-vote-account -ut \ |
| 103 | + --fee-payer ./validator-keypair.json \ |
| 104 | + ./vote-account-keypair.json \ |
| 105 | + ./validator-keypair.json \ |
| 106 | + ./authorized-withdrawer-keypair.json |
| 107 | +``` |
| 108 | + |
| 109 | +Note -ut tells the cli command that we would like to use the testnet cluster. If you're creating the RPC node you don't need the vote account. |
| 110 | + |
| 111 | +Now it's time to connect to the server. SSH into your server. |
| 112 | + |
| 113 | +### Preparing the system |
| 114 | + |
| 115 | +All commands mentioned below should be done on a server where you intend to run your validator. |
| 116 | + |
| 117 | +Create a new Ubuntu user, named sol, for running the validator: |
| 118 | + |
| 119 | +```bash |
| 120 | +sudo adduser sol |
| 121 | +sudo usermod -aG sudo sol |
| 122 | +``` |
| 123 | + |
| 124 | +Prepare the hard drives or partitions to be used for the validator: for ledger and AccountsDB. |
| 125 | + |
| 126 | +Your system will need to be tuned in order to run properly. Your validator may not start without the settings below. |
| 127 | + |
| 128 | +```bash |
| 129 | +sudo bash -c "cat >/etc/sysctl.d/21-agave-validator.conf <<EOF |
| 130 | +# Increase max UDP buffer sizes |
| 131 | +net.core.rmem_max = 134217728 |
| 132 | +net.core.wmem_max = 134217728 |
| 133 | +
|
| 134 | +# Increase memory mapped files limit |
| 135 | +vm.max_map_count = 1000000 |
| 136 | +
|
| 137 | +# Increase number of allowed open file descriptors |
| 138 | +fs.nr_open = 1000000 |
| 139 | +EOF" |
| 140 | +``` |
| 141 | + |
| 142 | +Apply the settings: |
| 143 | + |
| 144 | +```bash |
| 145 | +sudo sysctl -p /etc/sysctl.d/21-agave-validator.conf |
| 146 | +``` |
| 147 | + |
| 148 | +Add: |
| 149 | + |
| 150 | +```text |
| 151 | +LimitNOFILE=1000000 |
| 152 | +``` |
| 153 | + |
| 154 | +to the `[Service]` section of your systemd service file, if you use one. If not: |
| 155 | + |
| 156 | +```text |
| 157 | +DefaultLimitNOFILE=1000000 |
| 158 | +``` |
| 159 | + |
| 160 | +to `/etc/systemd/system.conf` (`[Manager]` section). |
| 161 | + |
| 162 | +```bash |
| 163 | +sudo bash -c "cat >/etc/security/limits.d/90-solana-nofiles.conf <<EOF |
| 164 | +# Increase process file descriptor count limit |
| 165 | +* - nofile 1000000 |
| 166 | +EOF" |
| 167 | +``` |
| 168 | + |
| 169 | +On your personal computer, not on the validator, securely copy your validator-keypair.json file and your vote-account-keypair.json file to the validator server: |
| 170 | + |
| 171 | +```bash |
| 172 | +scp validator-keypair.json sol@<server.hostname>: |
| 173 | +scp vote-account-keypair.json sol@<server.hostname>: |
| 174 | +``` |
| 175 | + |
| 176 | +On the validator server, switch to the sol user: |
| 177 | + |
| 178 | +```bash |
| 179 | +su - sol |
| 180 | +``` |
| 181 | + |
| 182 | +### Install the Solana software |
| 183 | + |
| 184 | +Your remote machine will need the Solana CLI installed to run the Agave validator software. For simplicity, install the cli with user sol. Refer again to Solana's Install Tool or build from source. |
| 185 | + |
| 186 | +### Create A Validator Startup Script |
| 187 | + |
| 188 | +In your sol home directory (e.g. ``/home/sol/`), create a folder called `bin`. Inside that folder create a file called validator.sh and make it executable: |
| 189 | + |
| 190 | +```bash |
| 191 | +mkdir -p /home/sol/bin |
| 192 | +touch /home/sol/bin/validator.sh |
| 193 | +chmod +x /home/sol/bin/validator.sh |
| 194 | +``` |
| 195 | + |
| 196 | +Next, open the validator.sh file for editing and paste the following: |
| 197 | + |
| 198 | +<tabs> |
| 199 | + <tab-item title="Mainnet"> |
| 200 | + ```text |
| 201 | + #!/bin/bash |
| 202 | + exec agave-validator \ |
| 203 | + --identity ~/validator-keypair.json \ |
| 204 | + --vote-account ~/vote-account-keypair.json \ |
| 205 | + --known-validator 7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2 \ |
| 206 | + --known-validator GdnSyH3YtwcxFvQrVVJMm1JhTS4QVX7MFsX56uJLUfiZ \ |
| 207 | + --known-validator DE1bawNcRJB9rVm3buyMVfr8mBEoyyu73NBovf2oXJsJ \ |
| 208 | + --known-validator CakcnaRDHka2gXyfbEd2d3xsvkJkqsLw2akB3zsN1D2S \ |
| 209 | + --only-known-rpc \ |
| 210 | + --ledger ledger \ |
| 211 | + --rpc-port 8899 \ |
| 212 | + --private-rpc \ |
| 213 | + --dynamic-port-range 8000-8020 \ |
| 214 | + --entrypoint entrypoint.mainnet-beta.solana.com:8001 \ |
| 215 | + --entrypoint entrypoint2.mainnet-beta.solana.com:8001 \ |
| 216 | + --entrypoint entrypoint3.mainnet-beta.solana.com:8001 \ |
| 217 | + --entrypoint entrypoint4.mainnet-beta.solana.com:8001 \ |
| 218 | + --entrypoint entrypoint5.mainnet-beta.solana.com:8001 \ |
| 219 | + --expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d \ |
| 220 | + --wal-recovery-mode skip_any_corrupted_record \ |
| 221 | + --limit-ledger-size |
| 222 | + ``` |
| 223 | + </tab-item> |
| 224 | + <tab-item title="Testnet"> |
| 225 | + ```text |
| 226 | + #!/bin/bash |
| 227 | + exec agave-validator \ |
| 228 | + --identity validator-keypair.json \ |
| 229 | + --vote-account vote-account-keypair.json \ |
| 230 | + --known-validator 5D1fNXzvv5NjV1ysLjirC4WY92RNsVH18vjmcszZd8on \ |
| 231 | + --known-validator dDzy5SR3AXdYWVqbDEkVFdvSPCtS9ihF5kJkHCtXoFs \ |
| 232 | + --known-validator Ft5fbkqNa76vnsjYNwjDZUXoTWpP7VYm3mtsaQckQADN \ |
| 233 | + --known-validator eoKpUABi59aT4rR9HGS3LcMecfut9x7zJyodWWP43YQ \ |
| 234 | + --known-validator 9QxCLckBiJc783jnMvXZubK4wH86Eqqvashtrwvcsgkv \ |
| 235 | + --only-known-rpc \ |
| 236 | + --ledger ledger \ |
| 237 | + --rpc-port 8899 \ |
| 238 | + --dynamic-port-range 8000-8020 \ |
| 239 | + --entrypoint entrypoint.testnet.solana.com:8001 \ |
| 240 | + --entrypoint entrypoint2.testnet.solana.com:8001 \ |
| 241 | + --entrypoint entrypoint3.testnet.solana.com:8001 \ |
| 242 | + --expected-genesis-hash 4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY \ |
| 243 | + --wal-recovery-mode skip_any_corrupted_record \ |
| 244 | + --limit-ledger-size |
| 245 | + ``` |
| 246 | + </tab-item> |
| 247 | +</tabs> |
| 248 | + |
| 249 | +Refer to `agave-validator --help` for more information on what each flag is doing in this script. You can try running to check if working as expected. |
| 250 | + |
| 251 | +```bash |
| 252 | +tail -f agave-validator.log |
| 253 | +``` |
| 254 | + |
| 255 | +Check also if gossip protocol is working as expected. More information can be found [here](https://docs.anza.xyz/operations/setup-a-validator#gossip-protocol). |
| 256 | + |
| 257 | +### Creating a service |
| 258 | + |
| 259 | +Assuming you have a user called sol on your machine, create the file `/etc/systemd/system/sol.service` with the following: |
| 260 | + |
| 261 | +```text |
| 262 | +[Unit] |
| 263 | +Description=Solana Validator |
| 264 | +After=network.target |
| 265 | +StartLimitIntervalSec=0 |
| 266 | +
|
| 267 | +[Service] |
| 268 | +Type=simple |
| 269 | +Restart=always |
| 270 | +RestartSec=1 |
| 271 | +User=sol |
| 272 | +LimitNOFILE=1000000 |
| 273 | +LogRateLimitIntervalSec=0 |
| 274 | +Environment="PATH=/bin:/usr/bin:/home/sol/.local/share/solana/install/active_release/bin" |
| 275 | +ExecStart=/home/sol/bin/validator.sh |
| 276 | +
|
| 277 | +[Install] |
| 278 | +WantedBy=multi-user.target |
| 279 | +``` |
| 280 | + |
| 281 | +Ensure that running `/home/sol/bin/validator.sh` manually starts the validator as expected. Don't forget to mark it executable with `chmod +x /home/sol/bin/validator.sh`. |
| 282 | + |
| 283 | +Start the service with: |
| 284 | + |
| 285 | +```bash |
| 286 | +sudo systemctl enable --now sol |
| 287 | +``` |
| 288 | + |
| 289 | +## RPC node |
| 290 | + |
| 291 | +Since a Solana RPC server runs the same process as a consensus validator, first follow the instructions above. Below is an example `validator.sh` file for a testnet RPC server. |
| 292 | + |
| 293 | +<tabs> |
| 294 | + <tab-item title="Mainnet"> |
| 295 | + ```text |
| 296 | + #!/bin/bash |
| 297 | + exec agave-validator \ |
| 298 | + --identity ~/validator-keypair.json \ |
| 299 | + --vote-account ~/vote-account-keypair.json \ |
| 300 | + --known-validator 7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2 \ |
| 301 | + --known-validator GdnSyH3YtwcxFvQrVVJMm1JhTS4QVX7MFsX56uJLUfiZ \ |
| 302 | + --known-validator DE1bawNcRJB9rVm3buyMVfr8mBEoyyu73NBovf2oXJsJ \ |
| 303 | + --known-validator CakcnaRDHka2gXyfbEd2d3xsvkJkqsLw2akB3zsN1D2S \ |
| 304 | + --only-known-rpc \ |
| 305 | + --full-rpc-api \ |
| 306 | + --ledger ledger \ |
| 307 | + --no-voting \ |
| 308 | + --rpc-port 8899 \ |
| 309 | + --private-rpc \ |
| 310 | + --dynamic-port-range 8000-8020 \ |
| 311 | + --entrypoint entrypoint.mainnet-beta.solana.com:8001 \ |
| 312 | + --entrypoint entrypoint2.mainnet-beta.solana.com:8001 \ |
| 313 | + --entrypoint entrypoint3.mainnet-beta.solana.com:8001 \ |
| 314 | + --entrypoint entrypoint4.mainnet-beta.solana.com:8001 \ |
| 315 | + --entrypoint entrypoint5.mainnet-beta.solana.com:8001 \ |
| 316 | + --expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d \ |
| 317 | + --wal-recovery-mode skip_any_corrupted_record \ |
| 318 | + --limit-ledger-size |
| 319 | + ``` |
| 320 | + </tab-item> |
| 321 | + <tab-item title="Testnet"> |
| 322 | + ```text |
| 323 | + #!/bin/bash |
| 324 | + exec agave-validator \ |
| 325 | + --identity /home/sol/validator-keypair.json \ |
| 326 | + --known-validator 5D1fNXzvv5NjV1ysLjirC4WY92RNsVH18vjmcszZd8on \ |
| 327 | + --known-validator dDzy5SR3AXdYWVqbDEkVFdvSPCtS9ihF5kJkHCtXoFs \ |
| 328 | + --known-validator eoKpUABi59aT4rR9HGS3LcMecfut9x7zJyodWWP43YQ \ |
| 329 | + --known-validator 7XSY3MrYnK8vq693Rju17bbPkCN3Z7KvvfvJx4kdrsSY \ |
| 330 | + --known-validator Ft5fbkqNa76vnsjYNwjDZUXoTWpP7VYm3mtsaQckQADN \ |
| 331 | + --known-validator 9QxCLckBiJc783jnMvXZubK4wH86Eqqvashtrwvcsgkv \ |
| 332 | + --only-known-rpc \ |
| 333 | + --full-rpc-api \ |
| 334 | + --no-voting \ |
| 335 | + --ledger /mnt/ledger \ |
| 336 | + --accounts /mnt/accounts \ |
| 337 | + --log /home/sol/solana-rpc.log \ |
| 338 | + --rpc-port 8899 \ |
| 339 | + --rpc-bind-address 0.0.0.0 \ |
| 340 | + --private-rpc \ |
| 341 | + --dynamic-port-range 8000-8020 \ |
| 342 | + --entrypoint entrypoint.testnet.solana.com:8001 \ |
| 343 | + --entrypoint entrypoint2.testnet.solana.com:8001 \ |
| 344 | + --entrypoint entrypoint3.testnet.solana.com:8001 \ |
| 345 | + --expected-genesis-hash 4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY \ |
| 346 | + --wal-recovery-mode skip_any_corrupted_record \ |
| 347 | + --limit-ledger-size |
| 348 | + ``` |
| 349 | + </tab-item> |
| 350 | +</tabs> |
0 commit comments