0 votes
1 view
in Blockchain by (12.8k 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.8k points)

Try using :

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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...