Skip to main content

A crypto-currency address inspection/validation library.

Project description

CoinAddrValidator

Github Repo Pypi Version Pypi License Pypi Wheel Pypi Versions

Maintainer

Mohammad Aghamir - Maintainer of this repository - coinaddrvalidator

Fork Maintainer

Devmons s.r.o. - Maintainer of this fork - coinaddrng

See also the list of contributors who participated in this project.

Original Maintainer

Joe Black | me@joeblack.nyc | github

Introduction

A cryptocurrency address inspection/validation library for python.

Supported currencies

  • binancecoin
  • bitcoin
  • bitcoin-sv
  • bitcoin-cash
  • boscoin
  • cardano
  • cosmos
  • dashcoin
  • decred
  • dogecoin
  • eos
  • ethereum
  • ethereum-classic
  • ether-zero
  • groestlcoin
  • horizen
  • kusama
  • litecoin
  • neocoin
  • ontology
  • polkadot
  • ravencoin
  • ripple
  • stellar
  • tezos
  • tronix
  • vechain
  • zcash

Installation

pip3 install coinaddrvalidator

Usage

>>> import coinaddrvalidator
>>> coinaddrvalidator.validate('btc', b'1BoatSLRHtKNngkdXEeobR76b53LETtpyT')
ValidationResult(name='bitcoin', ticker='btc', address=b'1BoatSLRHtKNngkdXEeobR76b53LETtpyT', valid=True, network='main', is_extended=False, address_type='address')

ValidationResult returns coin name and ticker, address, if the address is valid or not. In case network prefix bytes are defined for the checked currency, then the network is returned, too. If the coin supports that and the address is an extended key, it returns if it is valid or not. For some coins the address type can be guessed based on its format, which is returned as address_type. If there's none, 'address' is being returned as a default.

Extending

Currencies

To add a new currency, simply instantiate a new coinaddr.currency.Currency class. It will be automatically registered.

from coinaddrvalidator import Currency
Currency('decred', ticker='dcr', validator='DecredCheck',
        networks=dict(
            main=(0x073f,0x071a,0x02fda926), test=(0x0f21,0x0efc,0x043587d1)),
        address_types=dict(
            address=(0x073f,0x0f21), ticket=(0x071a,0x0efc),
            xpubkey=(0x02fda926,0x043587d1)))

To override a default currency, simply instantiate a new currency with that name.

Validators

To add a new validator, simply create a subclass of coinaddr.validation.ValidatorBase with your own implementation that implements the coinaddr.interfaces.IValidator interface. It will be automatically registered.

from zope.interface import implementer
from coinaddr.interfaces import IValidator
from coinaddr import ValidatorBase


@implementer(IValidator)
class NewValidator(ValidatorBase):
    name = 'New'

    @property
    def networks(self):
        return 'testing'

    def validate(self):
        return True

To override a default validator, simply create a new validator with that name.

Changes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coinaddrvalidator-1.1.3.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

coinaddrvalidator-1.1.3-py2.py3-none-any.whl (27.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file coinaddrvalidator-1.1.3.tar.gz.

File metadata

  • Download URL: coinaddrvalidator-1.1.3.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for coinaddrvalidator-1.1.3.tar.gz
Algorithm Hash digest
SHA256 999ca1e5f27f716deb0050a60c39ec1461557e4ce180e23832187a19bfbd27ab
MD5 cc8eb2f30bea85bbaa099230d27ec12b
BLAKE2b-256 28a150a47bef98b347424e5c207f908680c1c6d31f87488fc408047ac1e104ae

See more details on using hashes here.

File details

Details for the file coinaddrvalidator-1.1.3-py2.py3-none-any.whl.

File metadata

  • Download URL: coinaddrvalidator-1.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for coinaddrvalidator-1.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a8d4dffbe0b00d921f4b94bb1b5aef8dadcc808c9183f0d91c2a408e33eb8ffe
MD5 140f7e6be4722d4ae9d95fcb0dc3a490
BLAKE2b-256 b95590700f196c46e2ca9f467d1ac7d5b7949a1841dd04e9bf6c11e265cce4c6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page