blockchainsolana

Convert Solana public key from UINT8Array


I have generated accounts using the Solana CLI, but I am getting the public and private keys as

publicKey: Uint8Array(32) [
  102, 255,  46,  44,  90, 176, 207,  98,
  251,  66, 136, 190, 240,  59, 198, 177,
  169,  35, 153,   3, 163,  68, 188, 214,
  225,  46,  55, 111, 159, 157, 182, 111
], 

but I want readable format to sustain key for next transaction.


Solution

  • You can try following

    console.log(wallet.publicKey.toBase58());