Skip to content

Golang API to verify if cryptocurrency wallet address is somewhat valid

Notifications You must be signed in to change notification settings

evzpav/simple-crypto-address-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Crypto Address Validator

Simplistic cryptocurrency address validator that checks length and first chars of wallet address. Usage: get request to endpoint to verify if address is valid or not after user fills input. It is very simple but saves time not waiting for node to reply for failure.

Run locally :

go run main.go
# Server will be running on http://localhost:8888

curl localhost:8888/validate/btc/1CFNjwLjZdSKB8nZopxhLaR8vvqaQKD3Bi
curl http://addressvalidator.evzpav.com/validate/btc/1CFNjwLjZdSKB8nZopxhLaR8vvqaQKD3Bi

Success return:

{
    "ok":true, //if no error is true
    "crypto":"btc", //same as received
    "address":"1CFNjwLjZdSKB8nZopxhLaR8vvqaQKD3Bi", //same as received
    "valid":true //same as received
}

Error return:

{
    "ok":false,
    "crypto":"bt",
    "address":"1CFNjwLjZdSKB8nZopxhLaR8vvqaQKD3Bi",
    "valid":false,
    "error":"Cryptocurrency not available: bt"
}

Run unit tests:

go test

About

Golang API to verify if cryptocurrency wallet address is somewhat valid

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages