Skip to content

Instantly share code, notes, and snippets.

@jongan69
Created June 29, 2024 07:49
Show Gist options
  • Save jongan69/f80721bffaf43785285e8fc400939e82 to your computer and use it in GitHub Desktop.
Save jongan69/f80721bffaf43785285e8fc400939e82 to your computer and use it in GitHub Desktop.
Solana Wallet generation and base58 string output
use solana_sdk::{signature::Keypair, signer::Signer};
use bs58;
fn main() {
let wallet = Keypair::new();
let public_key_base58 = bs58::encode(wallet.pubkey().to_bytes()).into_string();
let secret_key_base58 = bs58::encode(wallet.to_bytes()).into_string();
println!("Public Key (Base58): {}\nSecret Key (Base58): {}\n", public_key_base58, secret_key_base58);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment