Is there a JavaScript library for validating P2SH addresses?

3

I looked at coinstring.js but it looks like it only validates simple BTC addresses (1-prepended addresses).

isValid(base58str, version)

Validates whether the address string or wallet import format string is valid.

base58str: A string that is either the wallet import format or public address.

version: Is an integer representing the version or Buffer. See below for more information.

Returns a true or false.

I'm looking for a JS library that can validate BIP16 P2SH addresses.

kyledcline

Posted 2014-12-14T20:47:33.387

Reputation: 33

Answers

1

You can use the library you've linked.

Instead of using:

isValid(address, 0)

use

isValid(address, 5)

Nick ODell

Posted 2014-12-14T20:47:33.387

Reputation: 26 536