docs/src/cli/examples/test-validator.md
During early stage development, it is often convenient to target a cluster with
fewer restrictions and more configuration options than the public offerings
provide. This is easily achieved with the solana-test-validator binary, which
starts a full-featured, single-node cluster on the developer's workstation.
--bpf-program ...)--clone ...)--limit-ledger-size ...)--slots-per-epoch ...)--warp-slot ...)The solana-test-validator binary ships with the Solana CLI Tool Suite.
Install before continuing.
First take a look at the configuration options
solana-test-validator --help
Next start the test validator
solana-test-validator
By default, basic status information is printed while the process is running. See Appendix I for details
Ledger location: test-ledger
Log: test-ledger/validator.log
Identity: EPhgPANa5Rh2wa4V2jxt7YbtWa3Uyw4sTeZ13cQjDDB8
Genesis Hash: 4754oPEMhAKy14CZc8GzQUP93CB4ouELyaTs4P8ittYn
Version: 1.6.7
Shred Version: 13286
Gossip Address: 127.0.0.1:1024
TPU Address: 127.0.0.1:1027
JSON RPC URL: http://127.0.0.1:8899
⠈ 00:36:02 | Processed Slot: 5142 | Confirmed Slot: 5142 | Finalized Slot: 5110 | Snapshot Slot: 5100 | Transactions: 5142 | ◎499.974295000
Leave solana-test-validator running in its own terminal. When it is no longer
needed, it can be stopped with ctrl-c.
Open a new terminal to interact with a running solana-test-validator
instance using other binaries from the Solana CLI Tool Suite or your own client
software.
solana config set --url http://127.0.0.1:8899
solana genesis-hash
Genesis Hash: field in the
solana-test-validator status outputsolana balance
Error: No such file or directory (os error 2) means that the default
wallet does not yet exist. Create it with solana-keygen new.solana airdrop 10solana transfer EPhgPANa5Rh2wa4V2jxt7YbtWa3Uyw4sTeZ13cQjDDB8 1
msg!() output from on-chain programssolana logs
Ledger location: test-ledger
--limit-ledger-size ... or relocate it with
--ledger ...Log: test-ledger/validator.log
--log. Status output is suppressed in this case.Identity: EPhgPANa5Rh2wa4V2jxt7YbtWa3Uyw4sTeZ13cQjDDB8
Version: 1.6.7
Gossip Address: 127.0.0.1:1024
TPU Address: 127.0.0.1:1027
JSON RPC URL: http://127.0.0.1:8899
⠈ 00:36:02 | Processed Slot: 5142 | Confirmed Slot: 5142 | Finalized Slot: 5110 | Snapshot Slot: 5100 | Transactions: 5142 | ◎499.974295000
By default, the test validator runs with all runtime features activated.
You can verify this using the Solana command-line tools:
solana feature status -ul
Since this may not always be desired, especially when testing programs meant for deployment to mainnet, the CLI provides an option to deactivate specific features:
solana-test-validator --deactivate-feature <FEATURE_PUBKEY_1> --deactivate-feature <FEATURE_PUBKEY_2>