altcoin-address
Functions for working with altcoin addresses, forked from DefunctZombie.
API
validate (address [, type])
returns true if the address (string) is a valid altcoin address for the type specified
if no options are specified it defaults to bitcoin
get_address_type (address)
returns address type if valid base58 address, otherwise null
Address types
- Bitcoin/BTC (bitcoin)
- Litecoin/LTC (litecoin)
- Peercoin/PPCoin/PPC (peercoin)
- Dogecoin/DOGE (dogecoin)
- Freicoin/FRC (freicoin)
- Protoshares/PTS (protoshares)
- Megacoin/MEC (megacoin)
- Primecoin/XPM (primecoin)
- Auroracoin/AUR (auroracoin)
I intend to update this to include more currencies in the future. If you would like a new currency added quickly please send a pull request including tests.
This will work for both BIP-0016 P2SH addresses and regular addresses.
To check the validity of a testnet address for any of the listed coins just append 'Testnet'
Example
var altcoin = ; var valid = altcoin;ifvalid console;else console; //This should return that 'This is a valid address'
var altcoin = ; var valid = altcoin;ifvalid console;else console; //As this is a invalid litecoin address response will be 'Address INVALID'
Donations
If you've found this useful feel free to send me a tip
BTC 1E3s7YjGVWrnhxTYkjkBKtTX3c673CCm3w