'When printing out public and private key through console.log, I only get Unit8Array(32) returned
Learning how to create wallets on Solana. I am running node 16.14.0 and npm 8.3.1 on Windows 10 via bash command line and Visual Studios. Below is the code of my index.js file, but for some reason I am only getting Uint8Array(32) output for the public key, but nothing returns for Uint8Array(64) for the private key to see if my test works. Am I missing libraries that should be installed?
const {
Connection,
PublicKey,
clusterApiUrl,
Keypair,
LAMPORTS_PER_SOL
} = require("@solana/web3.js")
const wallet = new Keypair()
const publicKey = wallet._keypair.publicKey
const secretKey = wallet._keypair.secretKey
console.log(publicKey)
console.log(secretKey)
Solution 1:[1]
I had to run
sudo apt-get update
sudo apt-get upgrade
I guess there was an issue with node 16.14.0 and/or npm 8.3.1, node 16.14.1 and npm 8.5.0 resolved it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user2873003 |
