A crypto-currency address inspection/validation library.
Project description
CoinAddrValidator
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
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 .
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size||File type Source||Python version None||Upload date||Hashes|
|Filename, size||File type Wheel||Python version py2.py3||Upload date||Hashes|
[coinaddrvalidator-1.1.0.tar.gz] (15.2 kB)
[View]
[coinaddrvalidator-1.1.0-py2.py3-none-any.whl] (25.1 kB)
[View]
[Close]
[Hashes] for coinaddrvalidator-1.1.0.tar.gz
|Algorithm||Hash digest|
|SHA256|
|MD5|
|BLAKE2-256|
a6d8927ba6f70f4e7524381cf896bd9521efb77c70edab727f371ced2f8d1594
3d82d10720a6b2dc741437130693085b
e6b50708e58157a6885d4545108fdf2730e6ad49565dccf758755b6a1dfa4514
[Close]
[Hashes] for coinaddrvalidator-1.1.0-py2.py3-none-any.whl
|Algorithm||Hash digest|
|SHA256|
|MD5|
|BLAKE2-256|
7fcf6e838e384453e092ca9116112484fc0303025ded5624199c8a66fdc3dbe2
e085078c1404034949aa172712f70250
0456b10d48ace2f8a906dbcad3b0dac163510ac5df55b0b44b06dc5a76a96d65.