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.

closed as off-topic by Andrew Chow Feb 22 at 4:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product or service reviews are off-topic because they tend to attract subjective, low-quality, and spam answers. On the other hand, offerings in the Bitcoin space are still evolving rapidly which often renders answers outdated quickly. For more information see this meta-discussion." – Andrew Chow
If this question can be reworded to fit the rules in the help center, please edit the question.

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.