Skip to content

Useful library for validation of Bitcoin, Litecoin and other cryptocoin addresses

License

Notifications You must be signed in to change notification settings

s-mohammad-dabir/altcoin-address

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

altcoin-address Build Status

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)
  • BeaverCoin/BVC (beavercoin)
  • Freicoin/FRC (freicoin)
  • Protoshares/PTS (protoshares)
  • Megacoin/MEC (megacoin)
  • Primecoin/XPM (primecoin)
  • Auroracoin/AUR (auroracoin)
  • Namecoin/NMC (namecoin)

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 = require('altcoin-address');

var valid = altcoin.validate('1KFzzGtDdnq5hrwxXGjwVnKzRbvf8WVxck', 'bitcoin');
if(valid)
	console.log('This is a valid address');
else
	console.log('Address INVALID');


//This should return that 'This is a valid address'
var altcoin = require('altcoin-address');

var valid = altcoin.validate('1KFzzGtDdnq5hrwxXGjwVnKzRbvf8WVxck', 'litecoinTestnet');
if(valid)
      console.log('This is a valid address');
else
      console.log('Address INVALID');


//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

###Ports to other languages

Ruby: https://bitbucket.org/noveltylab/crypto-address

About

Useful library for validation of Bitcoin, Litecoin and other cryptocoin addresses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%