Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lanfordcai/ava

Crypto-addresses Validator
https://github.com/lanfordcai/ava

address-validation bitcoin blockchain cryptocurrency

Last synced: 2 months ago
JSON representation

Crypto-addresses Validator

Awesome Lists containing this project

README

        

# ava

Cryptocurrency Addresses Validator

### Installation

Install the package using
```go
$ go get github.com/LanfordCai/ava/validator
```

### Usage

To use the package import it in your `*.go` code
```go
import "github.com/LanfordCai/ava/validator"
```

### Example

***Validate a `Bitcoin` address***

```go
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
}
```

### **License**
The **ava** is an open-source software licensed under the [MIT License](LICENSE).