Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

multichain-address-validator

christsim618MIT0.7.7TypeScript support: included

Multichain address validator for Bitcoin and other blockchains.

0x, zrx, Aave Coin, aave, Algorand, algo, Apecoin, ape, API3, api3, Aragon, ant, Arbitrum, arb, Augur, rep, AugurV2, repv2, AuroraCoin, aur, Avalanche, avax, Axie Infinity, axs, Bancor, bnt, Band Protocol, band, Bankex, bkx, Basic Attention Token, bat, BeaverCoin, bvc, Biconomy, bico, Binance, bnb, BioCoin, bio, Bitcoin, btc, Bitcoin SV, bsv, BitcoinCash, bch, BitcoinGold, btg, BitcoinPrivate, btcp, BitcoinZ, btcz, BlockTrade, btt, Blur, blur, Bonk, bonk, BTU Protocol, btu, Callisto, clo, Cardano, ada, Celo, celo, Chainlink, link, Chiliz, chz, Civic, cvc, Compound, comp, Cred, lba, Crypto.com Coin, cro, Curve DAO, crv, CUSD, cusd, Dash, dash, Decentraland, mana, Decred, dcr, DigiByte, dgb, District0x, dnt, DogeCoin, doge, Enjin Coin, enj, EOS, eos, Ethereum, eth, Ethereum Name Service, ens, EthereumClassic, etc, EthereumPow, ethw, EtherZero, etz, Expanse, exp, Fetch.ai, fet, FirmaChain, fct, Flare, flr, FreiCoin, frc, GameCredits, game, GarliCoin, grlc, Gnosis, gno, Golem, glm, Golem (GNT), gnt, Hashflow, hft, HedgeTrade, hedg, Hush, hush, HyperSpace, xsc, iExec RLC, rlc, Illuvium, ilv, Immutable, imx, Injective, inj, Komodo, kmd, LBRY Credits, lbc, Lido DAO Token, ldo, LiteCoin, ltc, loki, loki, Loom Network, loom, Magic, magic, Maker, mkr, Marlin, pond, Mask Network, mask, Matchpool, gup, Matic, matic, MegaCoin, mec, Melon, mln, Metal, mtl, Monero, xmr, Multi-collateral DAI, dai, NameCoin, nmc, Nano, nano, Nem, xem, Neo, neo, NeoGas, gas, Numeraire, nmr, Ocean Protocol, ocean, Odyssey, ocn, OmiseGO, omg, Onyx Protocol, xcn, Optimism, op, Origin Protocol, ogn, Paxos, pax, PayPal USD, pyusd, PeerCoin, ppc, PIVX, pivx, Polkadot, dot, Polymath, poly, PrimeCoin, xpm, ProtoShares, pts, Qtum, qtum, Quant, qnt, Quantum Resistant Ledger, qrl, RaiBlocks, xrb, Ripio Credit Network, rcn, Ripple, xrp, Salt, salt, Serve, serv, Siacoin, sc, Skale, skl, SnowGem, sng, Solana, sol, SolarCoin, slr, SOLVE, solve, Spendcoin, spnd, Status, snt, Stellar, xlm, Storj, storj, Storm, storm, StormX, stmx, SuperVerse, super, Swarm City, swt, Synthetix Network, snx, Tap, xtp, Tellor, trb, TEMCO, temco, TenX, pay, Tether, usdt, Tezos, xtz, The Graph, grt, The Sandbox, sand, Tron, trx, TrueUSD, tusd, Unifi Protocol DAO, unfi, Uniswap Coin, uni, USD Coin, usdc, VeChain, vet, VertCoin, vtc, Viberate, vib, VoteCoin, vot, Vulcan Forged PYR, pyr, Waves, waves, Wings, wings, Yearn.finance, yfi, ZCash, zec, ZClassic, zcl, ZenCash, zen

readme

multichain address validator

Simple blockchain address validator for validating Bitcoin and other blockchain addresses Node.js and browser.

Build Status

Installation

NPM

npm install multichain-address-validator

Browser

<script src="dist/multichain-address-validator.bundle.min.js"></script>

API

validate (address, chain)
Parameters
  • address - blockchain address to validate
  • chain - blockchain name or object with networkType (mainnet or testnet)

Returns true if the address is a valid wallet address for the blockchain specified or throws if validator could not be found for chain

Supported blockchains

  • Algorand: algorand
  • Bitcoin: bitcoin, btc, omni
  • Bitcoin Cash: bitcoin-cash, bitcoincash, bitcoin cash, bch
  • Cardano: cardano, ada
  • Dogecoin: dogecoin, doge
  • EOS: eos
  • Etherum: ethereum, eth, erc20, flare, avalanche, avalanche-c, bsc, bnb, binance, sonic, berachain, story
  • Litecoin: litecoin, ltc
  • Monero: monero
  • Nano: nano
  • NEM: nem
  • Polkadot: polkadot
  • Ripple: ripple',xrp`
  • Sia: sia
  • Solana: solana, spl
  • Tezos: tezos
  • Tron: tron, trc20
  • XLM: xlm, stellar

Usage example

Node

import { validate } from 'multichain-address-validator'

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

// This will log 'This is a valid address' to the console.
import { validate } from 'multichain-address-validator'

const valid = validate('0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB', 'ethereum');
if (valid)
  console.log('This is a valid address');
else
  console.log('Address INVALID');

// This will log 'This is a valid address' to the console.
import { validate } from 'multichain-address-validator'

const valid = validate('1KFzzGtDdnq5hrwxXGjwVnKzRbvf8WVxck', { chain: 'litecoin', networkType: 'testnet' });
if (valid)
  console.log('This is a valid address');
else
  console.log('Address INVALID');

// As this is a invalid litecoin address 'Address INVALID' will be logged to console.