Installation
This section covers the steps to set up your local environment for Solana development.
Install Dependencies
- Windows users must first install WSL (Windows subsystem for Linux) and then install the dependencies specified in the Linux section below.
- Linux users should first install the dependencies specified in the Linux section below.
- Mac users should start with the Rust installation instructions below.
Solana Config
To see your current config:
You should see output similar to the following:
The RPC URL and Websocket URL specific the Solana cluster the CLI will make requests to. By default this will be mainnet-beta.
You can update the Solana CLI cluster using the following commands:
You can also use the following short options:
The Keypair Path specifies the location of the default wallet used by the Solana
CLI (to pay transaction fees and deploy programs). The default path is
~/.config/solana/id.json
. The next step walks through how to generate a
keypair at the default location.
Create Wallet
To interact with the Solana network using the Solana CLI, you need a Solana wallet funded with SOL.
To generate a keypair at the default Keypair Path, run the following command:
You should see output similar to the following:
Once a keypair is generated, you can get the address (public key) of the keypair with the following command:
Airdrop SOL
Once you've set up your local wallet, request an airdrop of SOL to fund your wallet. You need SOL to pay for transaction fees and to deploy programs.
Set your cluster to the devnet:
Then request an airdrop of devnet SOL:
To check your wallet's SOL balance, run the following command:
Run Local Validator
The Solana CLI comes with the test validator built-in. Running a local validator will allow you to deploy and test your programs locally.
In a separate terminal, run the following command to start a local validator: