0

I am working in js and I need a library that helps me get an address with a public key stored in a buffer.

1

Try bitcoinjs-lib

The following will generate a P2SH(P2WPKH) address

const bitcoin = require('bitcoinjs-lib')
let pubkey = Buffer.from('027a2c8c567a5bb7777580d31d1fd8d9910d4b1bb398570e3a36e81d7522cf828a', 'hex')
let address = bitcoin.payments.p2sh({redeem: bitcoin.payments.p2wpkh({ pubkey })}).address
console.log('address: ', address)

address:  3F1JMjuxgNFuK4kBxv4JXMEdQ2yvjuz939

Not the answer you're looking for? Browse other questions tagged or ask your own question.