Skip to content

feat(run-manager): add keygen command to generate a new Solana keypair - #654

Open
Sahilvishnaliya wants to merge 2 commits into
PsycheFoundation:mainfrom
Sahilvishnaliya:feat/run-manager-keygen
Open

feat(run-manager): add keygen command to generate a new Solana keypair#654
Sahilvishnaliya wants to merge 2 commits into
PsycheFoundation:mainfrom
Sahilvishnaliya:feat/run-manager-keygen

Conversation

@Sahilvishnaliya

Copy link
Copy Markdown

Summary

Adds a run-manager keygen command that generates a new Solana keypair and writes it to disk in the same JSON format the solana-cli produces, so creating a wallet no longer requires installing the solana binaries.

Closes #500.

Usage

run-manager keygen --output ~/.config/solana/psyche-node.json
# Wrote new keypair to /home/user/.config/solana/psyche-node.json
# Public key: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
  • The output file is the standard 64-byte JSON array (identical to solana-keygen new --outfile), directly usable as WALLET_PATH / WALLET_PRIVATE_KEY_PATH in the .env file.
  • Refuses to overwrite an existing file unless --force is passed.
  • write_to_file creates parent directories and restricts permissions to 0600 on unix (both provided by solana_sdk's EncodableKey implementation).
  • Purely offline — no cluster connection, so it's usable without an .env or RPC endpoint.

Notes for reviewers

  • Follows the existing command conventions: #[derive(Debug, Clone, Args)] + #[command()], registered in Commands in main.rs; dispatched without a SolanaBackend since it needs no network access.
  • Keypair::new() (OS entropy) + EncodableKey::write_to_file are the same primitives solana-keygen uses, via the already-required anchor-client re-export of solana_sdk.
  • The book's Joining a run page is updated in a second commit to show run-manager keygen as the primary path (solana-cli kept as an alternative).
  • Local cargo check is blocked on Windows by the vendored openssl-sys build (needs perl; CI builds run on Ubuntu with libssl-dev), so compile verification is left to CI — the touched APIs (Keypair::new, write_to_file, pubkey) are verified against solana-sdk 2.1.4 sources.

Creates a new keypair and writes it as the same JSON format the
solana-cli produces (solana-keygen new --outfile), so users no longer
need the solana binaries just to create a wallet for joining runs.

Closes PsycheFoundation#500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: run-manager command to generate a new solana keypair

1 participant