Cryptocurrency Addresses Validator
Install the package using
$ go get github.com/LanfordCai/ava/validator
To use the package import it in your *.go
code
import "github.com/LanfordCai/ava/validator"
Validate a Bitcoin
address
package main
import (
"fmt"
"github.com/LanfordCai/ava/validator"
)
func main() {
v := &validator.Bitcoin{}
addr := "19JeUHUvw23fwKeK1zZD4moKyxj1xn4Kxi"
result := v.ValidateAddress(addr, validator.Mainnet)
fmt.Printf("Address is valid?: %t\n", result.IsValid)
fmt.Printf("Address type: %s\n", result.Type)
// Address is valid?: true
// Address type: P2PKH
}
The ava is an open-source software licensed under the MIT License.