crptwav

package module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2018 License: MIT Imports: 7 Imported by: 0

README

crptwav

Simple wallet address validator for validating Bitcoin and other altcoins addresses.

It is a port of JavaScript library https://github.com/ognus/wallet-address-validator.

Documentation

https://godoc.org/github.com/StrongSquirrel/crptwav

Example

package main

import (
    "fmt"
    "github.com/StrongSquirrel/crptwav"
)

func main() {
	fmt.Println(crptwav.IsValidAddress("0xE37c0D48d68da5c5b14E5c1a9f1CFE802776D9FF", "ETH"))
	fmt.Println(crptwav.IsValidAddress("12KYrjTdVGjFMtaxERSk3gphreJ5US8aUP", "Bitcoin"))
	fmt.Println(crptwav.IsValidProdAddress("12KYrjTdVGjFMtaxERSk3gphreJ5US8aUP", "Bitcoin"))
	fmt.Println(crptwav.IsValidTestnetAddress("mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef", "BTC"))
	fmt.Println(crptwav.IsValidProdAddress("mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef", "BTC"))
	// Output:
	// true
	// true
	// true
	// true
	// false
}
Supported crypto currencies (todo)
  • Auroracoin/AUR, 'auroracoin' or 'AUR'
  • BeaverCoin/BVC, 'beavercoin' or 'BVC'
  • Biocoin/BIO, 'biocoin' or 'BIO'
  • Bitcloud/BTDX, 'bitcloud' or 'BTDX'
  • 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'
  • Bitcore/BTX, 'bitcore' or 'BTX'
  • Bitsend/BSD, 'bitsend' or 'BSD'
  • 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'
  • Namecoin/NMC, 'namecoin' or 'NMC'
  • 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'
  • 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'

License

MIT

Documentation

Index

Constants

View Source
const (
	// NetworkProd is used to validate main network addresses.
	NetworkProd = "prod"

	// NetworkTest is used to validate test network addresses.
	NetworkTest = "testnet"

	// NetworkBoth is used to validate all network addresses.
	NetworkBoth = "both"
)

Variables

This section is empty.

Functions

func IsValidAddress added in v0.3.0

func IsValidAddress(address, currency string) bool

IsValidAddress validates the given currency main or test network address. Currency can be a name or a symbol, e.g. "bitcoin", "litecoin" or "ETH".

func IsValidProdAddress added in v0.3.0

func IsValidProdAddress(address, currency string) bool

IsValidProdAddress validates the given currency main network address. Currency can be a name or a symbol, e.g. "bitcoin", "litecoin" or "ETH".

func IsValidTestnetAddress added in v0.3.0

func IsValidTestnetAddress(address, currency string) bool

IsValidTestnetAddress validates the given currency test network address. Currency can be a name or a symbol, e.g. "bitcoin", "litecoin" or "ETH".

Types

This section is empty.

Directories

Path Synopsis
crypto
base58
Package base58 provides an API for working with modified base58 and Base58Check encodings.
Package base58 provides an API for working with modified base58 and Base58Check encodings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL