|
| 1 | +--- |
| 2 | +title: Stellar Keys |
| 3 | +hide_table_of_contents: true |
| 4 | +description: Manage stellar keys |
| 5 | +custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/stellar-keys.mdx |
| 6 | +--- |
| 7 | + |
| 8 | +This guide walks you through generating, inspecting, and removing a Stellar identity using the CLI. |
| 9 | + |
| 10 | +### 1. Generate a New Identity |
| 11 | + |
| 12 | +Run the following command to create a new keypair and save it under the alias named `carol`: |
| 13 | + |
| 14 | +```bash |
| 15 | +stellar keys generate carol |
| 16 | +``` |
| 17 | + |
| 18 | +Output: |
| 19 | + |
| 20 | +``` |
| 21 | +✅ Key saved with alias carol in ".config/soroban/identity/carol.toml" |
| 22 | +``` |
| 23 | + |
| 24 | +The CLI stores this identity in a TOML file. |
| 25 | + |
| 26 | +### 2. Verify the Identity File |
| 27 | + |
| 28 | +Navigate to the configuration directory and list the contents: |
| 29 | + |
| 30 | +```bash cookbooktest.ignore |
| 31 | +cd .config/soroban/identity && ls |
| 32 | +``` |
| 33 | + |
| 34 | +Output: |
| 35 | + |
| 36 | +``` |
| 37 | +carol.toml |
| 38 | +``` |
| 39 | + |
| 40 | +The file carol.toml contains the seed phrase for your identity. |
| 41 | + |
| 42 | +### 3. View the Seed Phrase |
| 43 | + |
| 44 | +```bash cookbooktest.ignore |
| 45 | +cat carol.toml |
| 46 | +``` |
| 47 | + |
| 48 | +Output: |
| 49 | + |
| 50 | +``` |
| 51 | +seed_phrase = "patrol clean public grocery roof aim have valve cherry dismiss lunar tail duty license capable little version banana amount often cover dice couple party" |
| 52 | +``` |
| 53 | + |
| 54 | +:::danger |
| 55 | + |
| 56 | +Note: The seed phrase is sensitive information. Handle it with care and never expose it publicly. |
| 57 | + |
| 58 | +::: |
| 59 | + |
| 60 | +### 4. Derive the Secret Key |
| 61 | + |
| 62 | +To display the secret key for the carol identity: |
| 63 | + |
| 64 | +```bash |
| 65 | +stellar keys secret carol |
| 66 | +``` |
| 67 | + |
| 68 | +Output: |
| 69 | + |
| 70 | +``` |
| 71 | +SCJP663VYFZPYN75H2DYJA3FYUBP5UR23HZ4ZDHDMDY6TXVYUYMWNKTI |
| 72 | +``` |
| 73 | + |
| 74 | +:::danger |
| 75 | + |
| 76 | +Note: The secret key is sensitive information. Handle it with care and never expose it publicly. |
| 77 | + |
| 78 | +::: |
| 79 | + |
| 80 | +### 5. Derive the Public Key |
| 81 | + |
| 82 | +To display the corresponding public key for the carol identity: |
| 83 | + |
| 84 | +```bash |
| 85 | +stellar keys public-key carol |
| 86 | +``` |
| 87 | + |
| 88 | +Output: |
| 89 | + |
| 90 | +``` |
| 91 | +GD3BFFX7DTNJAGDVVM5RYGGQQNURZTH4VSBLWF55YXY3L6T2WWZK57EI |
| 92 | +``` |
| 93 | + |
| 94 | +This is the public address of your key. |
| 95 | + |
| 96 | +### 6. Fund this account |
| 97 | + |
| 98 | +```bash |
| 99 | +stellar keys fund carol |
| 100 | +``` |
| 101 | + |
| 102 | +Output: |
| 103 | + |
| 104 | +``` |
| 105 | +✅ Account carol funded on "Test SDF Network ; September 2015" |
| 106 | +``` |
| 107 | + |
| 108 | +You can also fund the account while creating the key by using `stellar keys generate --fund`. |
| 109 | + |
| 110 | +### 7. Remove the Identity |
| 111 | + |
| 112 | +When you no longer need this identity, remove it using: |
| 113 | + |
| 114 | +```bash |
| 115 | +stellar keys rm carol |
| 116 | +``` |
| 117 | + |
| 118 | +Output: |
| 119 | + |
| 120 | +``` |
| 121 | +ℹ️ Removing the key's cli config file |
| 122 | +``` |
| 123 | + |
| 124 | +At this point, the identity file carol.toml is deleted, and the alias is no longer available in the CLI. |
0 commit comments