@@ -5,31 +5,40 @@ description:
55 This section walks through some common Solana CLI commands to get you started.
66---
77
8- < Steps >
9- < Step >
8+ This section provides some common commands and examples
9+ to help you get you started using the Solana CLI.
1010
11- ### Solana Config
11+ ## Solana config
1212
13- To see your current config:
13+ Your Solana config specifies the following variables:
14+
15+ - ** Config file** : The path to your config file
16+ - ** RPC URL & Websocket URL** : The Solana cluster to which the CLI makes requests
17+ - ** Keypair path** :
18+ The path to the default Solana wallet (keypair) used to pay transaction fees and deploy programs.
19+ By default, this file is stored at ` ~/.config/solana/id.json ` .
20+
21+ To see your current configuration settings, enter the follow command in your terminal.
1422
1523``` terminal
1624$ solana config get
1725```
1826
19- You should see output like the following:
27+ A successful command will return output similar to the following:
2028
21- ```
29+ ``` txt title="Example output"
2230Config File: /Users/test/.config/solana/cli/config.yml
2331RPC URL: https://api.mainnet-beta.solana.com
2432WebSocket URL: wss://api.mainnet-beta.solana.com/ (computed)
2533Keypair Path: /Users/test/.config/solana/id.json
2634Commitment: confirmed
2735```
2836
29- The RPC URL and Websocket URL specify the Solana cluster the CLI makes requests
30- to.
37+ You can change the Solana CLI cluster with the following commands:
3138
32- You can update the Solana CLI cluster using the following commands:
39+ <Tabs items = { [" Full commands" , " Short commands" ]} >
40+
41+ <Tab value = " Full commands" >
3342
3443``` terminal
3544$ solana config set --url mainnet-beta
@@ -38,7 +47,8 @@ $ solana config set --url localhost
3847$ solana config set --url testnet
3948```
4049
41- You can also use the following short options:
50+ </Tab >
51+ <Tab value = " Short commands" >
4252
4353``` terminal
4454$ solana config set -um # For mainnet-beta
@@ -47,27 +57,23 @@ $ solana config set -ul # For localhost
4757$ solana config set -ut # For testnet
4858```
4959
50- The Keypair Path points to the default Solana wallet (keypair) used by the
51- Solana CLI to pay transaction fees and deploy programs. By default, this file is
52- stored at ` ~/.config/solana/id.json ` .
53-
54- </Step >
55- <Step >
60+ </Tab >
61+ </Tabs >
5662
57- ### Create Wallet
63+ ## Create a wallet
5864
59- To send transactions using the Solana CLI, you need a Solana wallet funded with
60- SOL.
65+ Before you can send a transactions using the Solana CLI,
66+ you need a Solana wallet funded with SOL.
6167
62- To generate a keypair at the default Keypair Path , run the following command:
68+ To generate a keypair at the default keypair path , run the following command:
6369
6470``` terminal
6571$ solana-keygen new
6672```
6773
68- You should see output like the following:
74+ A successful command will return output similar to the following:
6975
70- ```
76+ ``` txt title="Example output"
7177Generating a new keypair
7278
7379For added security, enter a BIP39 passphrase
@@ -87,11 +93,8 @@ cream bleak tortoise ocean nasty game gift forget fancy salon mimic amazing
8793```
8894
8995<Callout type = " info" >
90-
91- If you already have a file system wallet saved at the default location, this
92- command doesn't override it unless you explicitly force override using the
93- ` --force ` flag.
94-
96+ This command will not override an existing account at the default location,
97+ unless you use the ` --force ` flag.
9598</Callout >
9699
97100To view your wallet's address (public key), run:
@@ -100,21 +103,18 @@ To view your wallet's address (public key), run:
100103$ solana address
101104```
102105
103- </Step >
104- <Step >
105-
106- ### Airdrop SOL
106+ ## Airdrop SOL
107107
108108Request an airdrop of SOL to your wallet to pay for transactions and program
109109deployments.
110110
111- Set your cluster to the devnet :
111+ 1 . Set your cluster to Devnet :
112112
113113``` terminal
114114$ solana config set -ud
115115```
116116
117- Then request an airdrop of devnet SOL:
117+ 2 . Request an airdrop of Devnet SOL:
118118
119119``` terminal
120120$ solana airdrop 2
@@ -133,31 +133,20 @@ To check your wallet's SOL balance, run the following command:
133133$ solana balance
134134```
135135
136- </Step >
137- <Step >
138-
139- ### Run Local Validator
136+ ## Run local validator
140137
141138The Solana CLI includes a built-in
142139[ test validator] ( https://docs.anza.xyz/cli/examples/test-validator ) for local
143140development.
144141
145- In a separate terminal, run the following command to start a local validator :
142+ Open a new terminal and update your CLI to use localhost :
146143
147144``` terminal
148- $ solana-test-validator
145+ $ solana config set -ul
149146```
150147
151- <Callout >
152-
153- Remember to also update your CLI to use localhost before running Solana CLI
154- commands:
148+ Run the following command to start a local validator:
155149
156150``` terminal
157- $ solana config set -ul
151+ $ solana-test-validator
158152```
159-
160- </Callout >
161-
162- </Step >
163- </Steps >
0 commit comments