Bitcoinjs-lib: how do you validate a btc addressing using this?

Created on 12 Apr 2017  路  2Comments  路  Source: bitcoinjs/bitcoinjs-lib

I couldn't find a function that validates a btc address. How can this be done? Thanks.

how to / question / docs

Most helpful comment

https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/address.js#L7

bitcoin.addresses.fromBase58Check will throw if the provided address parameter is invalid.

Use bitcoin.addresses.toOutputScript if you also want to check the version byte for a valid script.

All 2 comments

If you're generating an address using the library, then I'm sure it will only return a valid address, but if you want to add your own checks to it, here is a good resource:

http://stackoverflow.com/questions/21559851/bitcoin-address-form-validation-javascript-and-php

https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/address.js#L7

bitcoin.addresses.fromBase58Check will throw if the provided address parameter is invalid.

Use bitcoin.addresses.toOutputScript if you also want to check the version byte for a valid script.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coingeek picture coingeek  路  4Comments

Mr-Mondragon picture Mr-Mondragon  路  3Comments

Beardcoding picture Beardcoding  路  3Comments

LeonYanghaha picture LeonYanghaha  路  3Comments

rbndg picture rbndg  路  3Comments