Skip to content

Instantly share code, notes, and snippets.

@jadepark-dev
Created April 14, 2025 15:20
Show Gist options
  • Save jadepark-dev/93b34d6c044a1c335f6fb83eae257c40 to your computer and use it in GitHub Desktop.
Save jadepark-dev/93b34d6c044a1c335f6fb83eae257c40 to your computer and use it in GitHub Desktop.
SOL
// This nodejs script read solana keypair file([1,22,19,45,75,..., ]) and out public key and private key to command line
const fs = require('fs')
const { Keypair } = require('@solana/web3.js')
const bs58 = require('bs58')
const keypairData = JSON.parse(fs.readFileSync('./<YOUR_KEYPAIR_FILE>.json'))
const keypair = Keypair.fromSecretKey(Uint8Array.from(keypairData))
console.log('Private key (base58):', bs58.encode(keypair.secretKey))
console.log('Public key (base58):', keypair.publicKey.toBase58())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment