Services Approach Projects Back to Home
Utility · Open Source

solana-private-key-converter

A small, focused Rust command-line tool that converts Solana CLI keypair JSON files into the Base58-encoded private key strings that wallet applications like Phantom expect when importing existing keys.

Rust 1.85+ Edition 2024 CLI Utility Phantom Compatible MIT License

Overview

Solana's CLI tooling stores keypairs as 64-byte JSON arrays. Wallet applications like Phantom, however, expect their private keys Base58-encoded. solana-private-key-converter does exactly that conversion — accepting either a full 64-byte CLI keypair or a 32-byte seed file and producing both the full-file and seed-only Base58 encodings.

What It Outputs

  • base58_full_<N>bytes — the entire keypair file Base58-encoded.
  • base58_seed_32bytes — the first 32 bytes of a 64-byte keypair, Base58-encoded.

Output prints to stdout. A safety warning is emitted to stderr on every run.

Requirements

  • Rust 1.85+ with edition 2024.
  • A Solana keypair JSON file — either the 64-byte CLI format or a 32-byte seed file.

Setup

1. Clone and build

~/install
$ git clone https://github.com/hadesbaker/solana-private-key-converter.git $ cd solana-private-key-converter $ cargo build --release

2. Run against your keypair

~/convert
$ cargo run --release -- wallet.json

Replace wallet.json with the path to your Solana keypair file. The Base58 strings print to stdout; the safety warning prints to stderr — pipe stdout separately if you're capturing output.

This tool prints a private key in plain text. Anyone who sees that output gains full, irreversible control of the wallet and any funds in it. Run only on machines you control, never share a screen while using it, and clear your terminal scrollback when you're done.