当前位置: 首页 > 软件库 > Web3 > 开源货币/比特币 >

wallet-address-validator

授权协议 MIT License
开发语言 JavaScript
所属分类 Web3、 开源货币/比特币
软件类型 开源软件
地区 不详
投 递 者 索嘉石
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

wallet-address-validator

Simple wallet address validator for validating Bitcoin and other altcoins addresses in Node.js and browser.

Forked from ryanralph/altcoin-address.

File size is ~22 kB (minifed and gzipped).

Installation

NPM

npm install wallet-address-validator

Browser

<script src="wallet-address-validator.min.js"></script>

API

validate (address [, currency = 'bitcoin'[, networkType = 'prod']])
Parameters
  • address - Wallet address to validate.
  • currency - Optional. Currency name or symbol, e.g. 'bitcoin' (default), 'litecoin' or 'LTC'
  • networkType - Optional. Use 'prod' (default) to enforce standard address, 'testnet' to enforce testnet address and 'both' to enforce nothing.

Returns true if the address (string) is a valid wallet address for the crypto currency specified, see below for supported currencies.

Supported crypto currencies

  • Auroracoin/AUR, 'auroracoin' or 'AUR'

  • Bankex/BKX, 'bankex' or 'BKX'

  • BeaverCoin/BVC, 'beavercoin' or 'BVC'

  • Biocoin/BIO, 'biocoin' or 'BIO'

  • Bitcoin/BTC, 'bitcoin' or 'BTC'

  • BitcoinCash/BCH, 'bitcoincash' or 'BCH'

  • BitcoinGold/BTG, 'bitcoingold' or 'BTG'

  • BitcoinPrivate/BTCP, 'bitcoinprivate' or 'BTCP'

  • BitcoinZ/BTCZ, 'bitcoinz' or 'BTCZ'

  • Callisto/CLO, 'callisto' or 'CLO'

  • Dash, 'dash' or 'DASH'

  • Decred/DCR, 'decred' or 'DCR'

  • Digibyte/DGB, 'digibyte' or 'DGB'

  • Dogecoin/DOGE, 'dogecoin' or 'DOGE'

  • Ethereum/ETH, 'ethereum' or 'ETH'

  • EthereumClassic/ETH, 'ethereumclassic' or 'ETC'

  • EthereumZero/ETZ, 'etherzero' or 'ETZ'

  • Freicoin/FRC, 'freicoin' or 'FRC'

  • Garlicoin/GRLC, 'garlicoin' or 'GRLC'

  • Hush/HUSH, 'hush' or 'HUSH'

  • Komodo/KMD, 'komodo' or 'KMD'

  • Litecoin/LTC, 'litecoin' or 'LTC'

  • Megacoin/MEC, 'megacoin' or 'MEC'

  • Monero/XMR, 'monero' or 'XMR'

  • Namecoin/NMC, 'namecoin' or 'NMC'

  • Nano/NANO, 'nano' or 'NANO'

  • NEO/NEO, 'NEO' or 'NEO'

  • NeoGas/GAS, 'neogas' or 'GAS'

  • Peercoin/PPCoin/PPC, 'peercoin' or 'PPC'

  • Primecoin/XPM, 'primecoin' or 'XPM'

  • Protoshares/PTS, 'protoshares' or 'PTS'

  • Qtum/QTUM, 'qtum' or 'QTUM'

  • Raiblocks/XRB, 'raiblocks' or 'XRB'

  • Ripple/XRP, 'ripple' or 'XRP'

  • Snowgem/SNG, 'snowgem' or 'SNG'

  • Vertcoin/VTC, 'vertcoin' or 'VTC'

  • Votecoin/VTC, 'votecoin' or 'VOT'

  • Zcash/ZEC, 'zcash' or 'ZEC'

  • Zclassic/ZCL, 'zclassic' or 'ZCL'

  • ZenCash/ZEN, 'zencash' or 'ZEN'

Usage example

Node

var WAValidator = require('wallet-address-validator');

var valid = WAValidator.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.
var WAValidator = require('wallet-address-validator');

var valid = WAValidator.validate('1KFzzGtDdnq5hrwxXGjwVnKzRbvf8WVxck', 'litecoin', '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.

Browser

<script src="wallet-address-validator.min.js"></script>
// WAValidator is exposed as a global (window.WAValidator)
var valid = WAValidator.validate('1KFzzGtDdnq5hrwxXGjwVnKzRbvf8WVxck', 'bitcoin');
if(valid)
    alert('This is a valid address');
else
    alert('Address INVALID');

// This should show a pop up with text 'This is a valid address'.
 相关资料
  • Random.region() Random.region() 随机生成一个(中国)大区。 Random.region() // => "华北" Random.province() Random.province() 随机生成一个(中国)省(或直辖市、自治区、特别行政区)。 Random.province() // => "黑龙江省" Random.city( prefix? ) Random.c

  • 此方法返回当前运行Rexx命令的环境的名称。 语法 (Syntax) ADDRESS() 参数 (Parameters) 没有 返回值 (Return Value) 此方法返回当前运行Rexx命令的环境的名称。 例子 (Example) /* Main program */ say ADDRESS() 当我们运行上述程序时,我们将得到以下结果。 输出 (Output) bash

  • Address Bar 实现了类似 iOS Safari 浏览器地址栏的控件。

  • PLEASE NOTE WE HAVE DETECTED SOME FAKE COPAY WALLETS ON THE GOOGLE PLAY STORE FOR ANDROID, PLEASE BE SURE TO INSTALL "BITPAY WALLET" ONLY FROM THE APP STORES. APP's DEVELOPER SHOULD BE "BITPAY INC" ON

  • 地址1 地址: 以太坊地址的长度,大小20个字节,160位,所以可以用一个uint160编码。地址是所有合约的基础,所有的合约都会继承地址对象,也可以随时将一个地址串,得到对应的代码进行调用。当然地址代表一个普通帐户时,就没有这么多丰富的功能啦。 支持的运算符 <=,<,==,!=,>=和> 地址类型的成员 属性:balance 函数:send(),call(),delegatecall(),ca

  • 描述 (Description) HTML 标记用于指示地址。地址通常以斜体显示。 例子 (Example) <!DOCTYPE html> <html> <head> <title>HTML address Tag</title> </head> <body> <address> 600 Wisdon Apartments<br />