2019-08-08 11:42:17 -06:00
|
|
|
|
# Starting a Validator
|
|
|
|
|
|
2019-12-06 14:07:41 -07:00
|
|
|
|
## Configure Solana CLI
|
|
|
|
|
|
|
|
|
|
The solana cli includes `get` and `set` configuration commands to automatically
|
|
|
|
|
set the `--url` argument for cli commands. For example:
|
|
|
|
|
|
|
|
|
|
```bash
|
2020-03-13 15:00:27 -07:00
|
|
|
|
solana config set --url http://devnet.solana.com
|
2019-12-06 14:07:41 -07:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
\(You can always override the set configuration by explicitly passing the
|
2020-03-13 15:00:27 -07:00
|
|
|
|
`--url` argument with a command, eg: `solana --url http://tds.solana.com balance`\)
|
2019-12-06 14:07:41 -07:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
## Confirm The Testnet Is Reachable
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
Before attaching a validator node, sanity check that the cluster is accessible
|
2019-12-06 14:07:41 -07:00
|
|
|
|
to your machine by fetching the transaction count:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2020-01-20 23:06:47 -07:00
|
|
|
|
solana transaction-count
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
Inspect the network explorer at
|
|
|
|
|
[https://explorer.solana.com/](https://explorer.solana.com/) for activity.
|
2019-08-08 11:42:17 -06:00
|
|
|
|
|
2020-03-11 10:21:53 -07:00
|
|
|
|
View the [metrics dashboard](https://metrics.solana.com:3000/d/monitor/cluster-telemetry) for more
|
|
|
|
|
detail on cluster activity.
|
2019-08-08 11:42:17 -06:00
|
|
|
|
|
|
|
|
|
## Confirm your Installation
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
Try running following command to join the gossip network and view all the other
|
|
|
|
|
nodes in the cluster:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2020-02-19 14:04:34 -07:00
|
|
|
|
solana-gossip spy --entrypoint devnet.solana.com:8001
|
2019-11-28 15:39:27 -07:00
|
|
|
|
# Press ^C to exit
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
## Enabling CUDA
|
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
If your machine has a GPU with CUDA installed \(Linux-only currently\), include
|
|
|
|
|
the `--cuda` argument to `solana-validator`.
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
When your validator is started look for the following log message to indicate
|
|
|
|
|
that CUDA is enabled: `"[<timestamp> solana::validator] CUDA is enabled"`
|
|
|
|
|
|
|
|
|
|
## Tune System
|
|
|
|
|
|
2019-12-04 15:17:12 -08:00
|
|
|
|
For Linux validators, the solana repo includes a daemon to adjust system settings to optimize
|
|
|
|
|
performance (namely by increasing the OS UDP buffer limits, and scheduling PoH with realtime policy).
|
2019-12-02 10:53:07 -07:00
|
|
|
|
|
2019-12-04 15:17:12 -08:00
|
|
|
|
The daemon (`solana-sys-tuner`) is included in the solana binary release.
|
2019-12-02 10:53:07 -07:00
|
|
|
|
|
2019-12-04 15:17:12 -08:00
|
|
|
|
To run it:
|
2019-12-02 10:53:07 -07:00
|
|
|
|
|
|
|
|
|
```bash
|
2019-12-04 15:17:12 -08:00
|
|
|
|
sudo solana-sys-tuner --user $(whoami) > sys-tuner.log 2>&1 &
|
2019-12-02 10:53:07 -07:00
|
|
|
|
```
|
2019-11-28 15:39:27 -07:00
|
|
|
|
|
|
|
|
|
## Generate identity
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-15 11:05:34 -06:00
|
|
|
|
Create an identity keypair for your validator by running:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2019-10-29 17:13:20 -06:00
|
|
|
|
solana-keygen new -o ~/validator-keypair.json
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
2019-08-15 11:05:34 -06:00
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
The identity public key can now be viewed by running:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-15 11:05:34 -06:00
|
|
|
|
```bash
|
2019-12-02 10:53:07 -07:00
|
|
|
|
solana-keygen pubkey ~/validator-keypair.json
|
2019-08-15 11:05:34 -06:00
|
|
|
|
```
|
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
> Note: The "validator-keypair.json” file is also your \(ed25519\) private key.
|
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
Your validator identity keypair uniquely identifies your validator within the
|
|
|
|
|
network. **It is crucial to back-up this information.**
|
2019-11-28 15:39:27 -07:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
If you don’t back up this information, you WILL NOT BE ABLE TO RECOVER YOUR
|
|
|
|
|
VALIDATOR if you lose access to it. If this happens, YOU WILL LOSE YOUR
|
|
|
|
|
ALLOCATION OF LAMPORTS TOO.
|
|
|
|
|
|
|
|
|
|
To back-up your validator identify keypair, **back-up your
|
|
|
|
|
"validator-keypair.json” file to a secure location.**
|
|
|
|
|
|
|
|
|
|
### Vanity Keypair
|
|
|
|
|
|
|
|
|
|
You can generate a custom vanity keypair using solana-keygen. For instance:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
solana-keygen grind --starts-with e1v1s
|
|
|
|
|
```
|
2019-11-28 15:39:27 -07:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
Depending on the string requested, it may take days to find a match...
|
2019-11-28 15:39:27 -07:00
|
|
|
|
|
2019-12-06 14:07:41 -07:00
|
|
|
|
## More Solana CLI Configuration
|
2019-11-28 15:39:27 -07:00
|
|
|
|
|
2019-12-06 14:07:41 -07:00
|
|
|
|
Now that you have a keypair, set the solana configuration to use your validator
|
|
|
|
|
keypair for all following commands:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2020-01-21 08:53:44 -07:00
|
|
|
|
solana config set --keypair ~/validator-keypair.json
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
You should see the following output:
|
2019-08-15 11:05:34 -06:00
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
```text
|
|
|
|
|
Wallet Config Updated: /home/solana/.config/solana/wallet/config.yml
|
2020-03-13 15:00:27 -07:00
|
|
|
|
* url: http://devnet.solana.com
|
2019-11-28 15:39:27 -07:00
|
|
|
|
* keypair: /home/solana/validator-keypair.json
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Airdrop & Check Validator Balance
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-10-29 17:13:20 -06:00
|
|
|
|
Airdrop yourself some SOL to get started:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-15 11:05:34 -06:00
|
|
|
|
```bash
|
2019-11-28 15:39:27 -07:00
|
|
|
|
solana airdrop 1000
|
2019-08-15 11:05:34 -06:00
|
|
|
|
```
|
2019-08-08 11:42:17 -06:00
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
To view your current balance:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
```text
|
|
|
|
|
solana balance
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Or to see in finer detail:
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
solana balance --lamports
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
Read more about the [difference between SOL and lamports here](../introduction.md#what-are-sols).
|
2019-08-08 11:42:17 -06:00
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
## Create Vote Account
|
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
If you haven’t already done so, create a vote-account keypair and create the
|
|
|
|
|
vote account on the network. If you have completed this step, you should see the
|
2020-03-13 11:41:18 -07:00
|
|
|
|
“vote-account-keypair.json” in your Solana runtime directory:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2020-03-13 11:41:18 -07:00
|
|
|
|
solana-keygen new -o ~/vote-account-keypair.json
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
Create your vote account on the blockchain:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2020-03-13 11:41:18 -07:00
|
|
|
|
solana create-vote-account ~/vote-account-keypair.json ~/validator-keypair.json
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
|
|
|
|
|
2020-03-17 18:57:33 -07:00
|
|
|
|
## Trusted validators
|
|
|
|
|
|
|
|
|
|
If you know and trust other validator nodes, you can specify this on the command line with the `--trusted-validator <PUBKEY>`
|
|
|
|
|
argument to `solana-validator`. You can specify multiple ones by repeating the argument `--trusted-validator <PUBKEY1> --trusted-validator <PUBKEY2>`.
|
2020-03-18 09:40:51 -07:00
|
|
|
|
This has two effects, one is when the validator is booting with `--no-untrusted-rpc`, it will only ask that set of
|
|
|
|
|
trusted nodes for downloading genesis and snapshot data. Another is that in combination with the `--halt-on-trusted-validator-hash-mismatch` option,
|
|
|
|
|
it will monitor the merkle root hash of the entire accounts state of other trusted nodes on gossip and if the hashes produce any mismatch,
|
|
|
|
|
the validator will halt the node to prevent the validator from voting or processing potentially incorrect state values. At the moment, the slot that
|
2020-03-17 18:57:33 -07:00
|
|
|
|
the validator publishes the hash on is tied to the snapshot interval. For the feature to be effective, all validators in the trusted
|
|
|
|
|
set should be set to the same snapshot interval value or multiples of the same.
|
|
|
|
|
|
2020-03-18 09:40:51 -07:00
|
|
|
|
It is highly recommended you use these options to prevent malicious snapshot state download or
|
|
|
|
|
account state divergence.
|
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
## Connect Your Validator
|
|
|
|
|
|
|
|
|
|
Connect to a testnet cluster by running:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2020-03-13 11:41:18 -07:00
|
|
|
|
solana-validator --identity ~/validator-keypair.json --vote-account ~/vote-account-keypair.json \
|
2020-02-19 14:04:34 -07:00
|
|
|
|
--ledger ~/validator-ledger --rpc-port 8899 --entrypoint devnet.solana.com:8001 \
|
2019-11-28 15:39:27 -07:00
|
|
|
|
--limit-ledger-size
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
To force validator logging to the console add a `--log -` argument, otherwise
|
|
|
|
|
the validator will automatically log to a file.
|
2019-09-08 21:20:08 -07:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
Confirm your validator connected to the network by opening a new terminal and
|
|
|
|
|
running:
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```bash
|
2020-02-19 14:04:34 -07:00
|
|
|
|
solana-gossip spy --entrypoint devnet.solana.com:8001
|
2019-08-08 11:42:17 -06:00
|
|
|
|
```
|
|
|
|
|
|
2019-11-28 15:39:27 -07:00
|
|
|
|
If your validator is connected, its public key and IP address will appear in the list.
|
2019-08-08 11:42:17 -06:00
|
|
|
|
|
|
|
|
|
### Controlling local network port allocation
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
By default the validator will dynamically select available network ports in the
|
|
|
|
|
8000-10000 range, and may be overridden with `--dynamic-port-range`. For
|
|
|
|
|
example, `solana-validator --dynamic-port-range 11000-11010 ...` will restrict
|
|
|
|
|
the validator to ports 11000-11011.
|
2019-08-08 11:42:17 -06:00
|
|
|
|
|
|
|
|
|
### Limiting ledger size to conserve disk space
|
2019-09-23 03:38:34 +00:00
|
|
|
|
|
2019-12-02 10:53:07 -07:00
|
|
|
|
The `--limit-ledger-size` arg will instruct the validator to only retain the
|
|
|
|
|
last couple hours of ledger. To retain the full ledger, simply remove that arg.
|