Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

Below are the code.

const bitcoin = require('bitcoinjs-lib'); let testnet = bitcoin.networks.testnet;

let keypair = bitcoin.ECPair.makeRandom({network: testnet});

let addr = keypair.getAddress();

let  pk = keypair.toWIF();

enter image description here

1 Answer

0 votes
by (29.5k points)

Try using :

 const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })

Browse Categories

...