Hello,
I'm using the below method. May i know how to get an uncompressed address?
const { address } = bitcoin.payments.p2pkh({ pubkey: new Buffer(pubKey, 'hex') });
console.log(address);
Thanks.
use an uncompressed "pubKey" (130 length instead of 66 length.)
Edit: i figured it :)
@junderw thank you very much. how to convert compressed public key to uncompressed one?
const uncompressedHex = bitcoin.ECPair.fromPublicKey(
Buffer.from(pubKey, 'hex'),
{ compressed: false },
).publicKey.toString('hex')
in this case pubKey can be compressed or uncompressed. the ECPair will force it to uncompressed when you pass compressed: false as an option.
Most helpful comment
in this case pubKey can be compressed or uncompressed. the ECPair will force it to uncompressed when you pass
compressed: falseas an option.