Skip to main content

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

Metadata

Release files for coinaddrvalidator 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coinaddrvalidator 1.2.3
File Size Uploaded
coinaddrvalidator-1.2.3.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coinaddrvalidator 1.2.3
File Interpreter ABI Platform
coinaddrvalidator-1.2.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 37.8 kB

Release files / coinaddrvalidator-1.2.3.tar.gz

Download URL coinaddrvalidator-1.2.3.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8c81f30f5d87c21eedffd3e62995039082889e36b4c48a03ca4910c7623effc7
BLAKE2b-256 checksum
How to use checksums
7e11994f84e04aeed8d29316b0e85c48d4845dc3e2c5f8bd320295b4ef115758
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / coinaddrvalidator-1.2.3-py2.py3-none-any.whl

Download URL coinaddrvalidator-1.2.3-py2.py3-none-any.whl
Size 19.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1794494144b6340cc92f490ba7338b3467d44b57efd978a1aae053990eecb1c8
BLAKE2b-256 checksum
How to use checksums
a6a918843718656a8e2ed0c6d217ce2130d56c890ab49ddcefa9ff200ee942f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page