Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { BinTools, Buffer } from "avalanche"
const bintools: BinTools = BinTools.getInstance()
const main = async (): Promise<any> => {
// hex private key exported from metamask
let hexPrivKey: string = "461109a6ffdd39be8eb7b763cb52b9cd7190c6e88ad35b7421dfb6f859ead495"
let buf: Buffer = Buffer.from(hexPrivKey, 'hex')
let encoded: string = `PrivateKey-${bintools.cb58Encode(buf)}`
console.log(encoded)
// cb58 encoded private key to import into our web wallet
// PrivateKey-XrkrRUWpsQ2ctH4D73vghLV1eSGnfp2CdspvvuBxQbHLzJttf
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment