Created
May 1, 2021 09:05
-
-
Save apow2/26b4a03bf3eef3910f94bee5b87678da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const avalanche = require("avalanche"); | |
let bintools = avalanche.BinTools.getInstance(); | |
const ID = 1; | |
const ava = new avalanche.Avalanche("api.avax-test.network", 443, "https", networkID); | |
const xchain = ava.XChain(); | |
let xKeychain = xchain.keyChain(); | |
let keypair = xKeychain.makeKey(); | |
//p ublic and private keys | |
let pubkstr = keypair.getPublicKeyString(); | |
let privkstr = keypair.getPrivateKeyString(); | |
console.log(pubkstr); | |
// decode private key | |
const decoded = bintools.cb58Decode(privkstr.split('-')[1]); | |
console.log(`0x${decoded.toString('hex')}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment