> ## Documentation Index
> Fetch the complete documentation index at: https://docs.genlabs.co/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Wallet

> Manage local Grid wallets: create, import, list, switch, rename, remove, and export keys.

`gen wallet` manages the local wallet store used to sign Grid activations. Wallets live under `~/.gen/wallets/`: `keystore.json` holds the wallet records and `config.toml` tracks the active wallet. New wallets are encrypted with a password by default; leaving the password blank, or passing `--plaintext`, stores secret material unencrypted.

This page covers wallet identity and key management only. For balance queries, transfers, and faucet bootstrap, see [gen wallet transfers](/reference/cli/transfers). For RPC connection settings (`--rpc-url`, headers), see [CLI configuration](/reference/cli/configuration).

## Options

Only the global flags work on every `gen wallet` subcommand:

* `--json`, `-j`: emit a single JSON envelope (`{ ok, command, timestamp, result | error }`) instead of human output. Required for scripting. See [CLI configuration](/reference/cli/configuration) for the other global flags (`--rpc-url`, `--header`, and so on).

The rest are command-specific and are rejected on subcommands that do not define them:

* `--plaintext`: only on the commands that store new secret material (`create`, `import seed`, `import mnemonic`, `import private-key`), skips password encryption and writes the wallet in plaintext. Unsafe; use only for disposable local automation.
* `--wallet <NAME>`: only on commands that take an optional positional `NAME`, the named-flag form of the same argument.

Wallet selection precedence for commands that need an active wallet:

1. explicit `NAME` argument or `--wallet <NAME>`
2. active wallet recorded in `~/.gen/wallets/config.toml`
3. error if neither is set

Hex output (public keys, private keys, seeds) is always `0x`-prefixed.

## `gen wallet init`

Interactive onboarding flow. Walks through choosing seed create/import, mnemonic create/import, or private-key import; prompts for an optional name; prompts for an encryption password; and sets the resulting wallet as active.

```bash theme={null}
gen wallet init
```

Output: prompts to stdin/stdout, then a confirmation that the wallet was created and set active. Use this when you do not yet have a wallet and want a guided setup.

## `gen wallet create`

Create a new wallet from fresh CSPRNG entropy. Defaults to a 32-byte seed; pass `--mnemonic` to generate a BIP-39 phrase instead.

```text theme={null}
gen wallet create [NAME] [--mnemonic [--12-word]] [--plaintext]
```

Key flags:

* `[NAME]` (positional): Wallet to act on; defaults to the active wallet.
* `--wallet <NAME>`: Wallet to act on, as a flag instead of the positional NAME; defaults to the active wallet.
* `--plaintext`: Store the private key without encryption (unsafe).
* `--mnemonic`: Generate a BIP-39 recovery phrase instead of the default seed.
* `--12-word`: Generate a 12-word recovery phrase instead of the default 24-word phrase.

Example:

```bash theme={null}
gen wallet create alice --mnemonic --12-word
```

Output: prints the wallet name, the `Address:` (`grd@...` 1-part account locator), the public key, and the recovery material (seed or mnemonic) **once**. Record the recovery material immediately; the store does not retain it.

## `gen wallet import`

Import a wallet from existing key material. Each flavor is its own subcommand.

### `gen wallet import seed`

Import from a 32-byte seed (64 hex characters, optionally `0x`-prefixed).

```text theme={null}
gen wallet import seed [NAME] [--seed-file <PATH>] [--derivation-path <PATH>] [--plaintext]
```

Key flags:

* `[NAME]` (positional): Wallet to act on; defaults to the active wallet.
* `--wallet <NAME>`: Wallet to act on, as a flag instead of the positional NAME; defaults to the active wallet.
* `--plaintext`: Store the private key without encryption (unsafe).
* `--seed-file <PATH>`: Read the seed hex from a file instead of prompting.
* `--derivation-path <PATH>`: Use a custom BIP-44 derivation path instead of the default Gen path (for example: m/44'/218'/0'/0/7; only purpose, coin type, and account are hardened).

Example:

```bash theme={null}
gen wallet import seed alice --seed-file ./alice.seed
```

Output: confirms the imported wallet name, address, and public key.

### `gen wallet import mnemonic`

Import from a BIP-39 recovery phrase.

```text theme={null}
gen wallet import mnemonic [NAME] [--mnemonic-file <PATH>] [--derivation-path <PATH>] [--plaintext]
```

Key flags:

* `[NAME]` (positional): Wallet to act on; defaults to the active wallet.
* `--wallet <NAME>`: Wallet to act on, as a flag instead of the positional NAME; defaults to the active wallet.
* `--plaintext`: Store the private key without encryption (unsafe).
* `--mnemonic-file <PATH>`: Read the recovery phrase from a file instead of prompting.
* `--derivation-path <PATH>`: Use a custom BIP-44 derivation path instead of the default Gen path (for example: m/44'/218'/0'/0/7; only purpose, coin type, and account are hardened).

Example:

```bash theme={null}
gen wallet import mnemonic alice --mnemonic-file ./alice.mnemonic
```

Output: confirms the imported wallet name, address, and public key.

### `gen wallet import private-key`

Import from a raw private key (hex, optionally `0x`-prefixed).

```text theme={null}
gen wallet import private-key [NAME] [--private-key-file <PATH>] [--plaintext]
```

Key flags:

* `[NAME]` (positional): Wallet to act on; defaults to the active wallet.
* `--wallet <NAME>`: Wallet to act on, as a flag instead of the positional NAME; defaults to the active wallet.
* `--plaintext`: Store the private key without encryption (unsafe).
* `--private-key-file <PATH>`: Read the private key from a file instead of prompting.

Example:

```bash theme={null}
gen wallet import private-key alice --private-key-file ./alice.key
```

Output: confirms the imported wallet name, address, and public key.

### `gen wallet import encrypted`

Import a portable encrypted wallet bundle previously produced by `gen wallet export encrypted`.

```text theme={null}
gen wallet import encrypted <PATH> [NAME] [--wallet <NAME>]
```

Prompts for the bundle password, validates the decrypted key against the bundle metadata, prompts for a destination wallet name if not supplied, then prompts for a local storage password. Sets the imported wallet active.

Example:

```bash theme={null}
gen wallet import encrypted ./alice.wallet alice-restored
```

Output: confirms the destination wallet name and address.

## `gen wallet list`

Show all stored wallets as a table.

```bash theme={null}
gen wallet list
```

Columns: `NAME`, `ACTIVE`, `STORAGE`, `SOURCE`, `ADDRESS`. With `--json`, returns an array of records with the same fields.

## `gen wallet show`

Show metadata for one wallet. With no argument, shows the active wallet.

```text theme={null}
gen wallet show [NAME] [--public-key-only] [--account-address-only]
```

Key flags:

* `[NAME]` (positional): Wallet to act on; defaults to the active wallet.
* `--wallet <NAME>`: Wallet to act on, as a flag instead of the positional NAME; defaults to the active wallet.
* `--account-address-only`: Print only the selected wallet account address.
* `--public-key-only`: Print only the selected wallet public key.

Example:

```bash theme={null}
gen wallet show alice --account-address-only
```

Output: human-readable metadata block with `Address` and `Public key`, or just the requested field. JSON mode returns a `result` object with `name`, `account`, `public_key_hex`, `storage`, and `source`.

## `gen wallet set-active`

Set which wallet is used by default for wallet-backed commands.

```bash theme={null}
gen wallet set-active alice
```

Output: confirmation that the active wallet has changed. Persisted to `~/.gen/wallets/config.toml`.

## `gen wallet rename`

Rename a stored wallet. If the renamed wallet was active, it stays active under the new name.

```bash theme={null}
gen wallet rename alice alice-prod
```

Output: confirmation of the rename.

## `gen wallet remove`

Delete a wallet from the local store. If the removed wallet was active, the active wallet is cleared.

```bash theme={null}
gen wallet remove alice
```

Output: confirmation of the removal. There is no recovery; make sure recovery material is backed up first.

## `gen wallet export`

Export wallet material. Two flavors: raw private key, or a portable encrypted bundle.

### `gen wallet export private-key`

Print the wallet's private key to stdout as `0x`-prefixed hex. Requires explicit `--unsafe` acknowledgement.

```text theme={null}
gen wallet export private-key <NAME> --unsafe
```

Example:

```bash theme={null}
gen wallet export private-key alice --unsafe
```

Output: a single `0x`-prefixed hex string on stdout. This is the only command in the wallet surface that prints the private key; treat the output as a secret.

### `gen wallet export encrypted`

Write a portable encrypted wallet bundle to a file. Secret material never touches stdout.

```text theme={null}
gen wallet export encrypted <NAME> --output <PATH>
```

If the wallet is already encrypted, the bundle inherits the wallet's existing password. If the wallet is plaintext, the command prompts for a new bundle password.

Example:

```bash theme={null}
gen wallet export encrypted alice --output ./alice.wallet
```

Output: confirmation that the bundle was written. Restore on another machine with `gen wallet import encrypted`.

## See also

* [gen wallet transfers](/reference/cli/transfers): `balance`, `balances`, `transfer`, and `faucet`.
* [CLI configuration](/reference/cli/configuration): RPC URL, headers, and the persisted client config.
* [Quickstart](/quickstart/index): install the CLI and create your first wallet.
