Back
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();
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();
Try using :
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })
31k questions
32.8k answers
501 comments
693 users