Help us shape the future of Go! Take the 2026 Go Developer Survey

ava

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: MIT Imports: 13 Imported by: 0

README

ava

Crypto-Addresses Validator

Installation

Install the package using

$ go get github.com/LanfordCai/ava
Usage

To use the package import it in your *.go code

import "github.com/LanfordCai/ava"
Example

Validate a Bitcoin address


package main

import (
	"fmt"

	"github.com/LanfordCai/ava"
)

func main() {
	a := ava.Address{
		ChainName: "Bitcoin",
		Address:   "3NJHZpnnk3bFxqVHVS2vUomUBznju6W8D9",
		IsTestnet: false,
	}

	if a.IsValid() {
		fmt.Printf("%s is a valid %s address!", a.Address, a.ChainName)
	} else {
		fmt.Printf("%s is an invalid %s address!", a.Address, a.ChainName)
	}
}

Notice

For EOS addresses(account name), ava only valid it's format. A valid result doesn't mean the account has been registered on the blockchain.

TODO
  • Validate bech32 addresses for Bitcoin/BitcoinCash
License

The ava is an open-source software licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

type Validator interface {
	ValidateAddress(addr string, isTestnet bool) common.ValidationResult
}

Validator - Address validator

func NewValidator

func NewValidator(chainName string) (Validator, error)

NewValidator - Create address validator according to given chain name

Directories

Path Synopsis
https://ethereum.stackexchange.com/questions/1374/how-can-i-check-if-an-ethereum-address-is-valid
https://ethereum.stackexchange.com/questions/1374/how-can-i-check-if-an-ethereum-address-is-valid

Jump to

Keyboard shortcuts

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