1Do you mean for a website or app? Or do you just want to personally verify one?– Marc AlexanderApr 12, 2017 at 22:23
for a website im working on. I have bitcoinjs library loaded, but not sure what function to call to check if a btc address is valid or not.– Patoshi パトシApr 12, 2017 at 23:34
If you call
It will throw an error if the address cannot be parsed as P2SH or P2PKH, or if the checksum is not valid. Replace the second argument with
bitcoin.networks.testnet for testnet.