Skip to content

Cryptocurrency address inspection/validation library for python

License

Notifications You must be signed in to change notification settings

joeblackwaslike/coinaddr

Repository files navigation

CoinAddr

Build Status Github Repo Pypi Version Pypi License Pypi Wheel Pypi Versions

Maintainer

Joe Black | me@joeblack.nyc | github

Introduction

A cryptocurrency address inspection/validation library for python.

Supported currencies

  • bitcoin
  • bitcoin-cash
  • litecoin
  • ethereum
  • ethereum-classic
  • ether-zero
  • dogecoin
  • dashcoin
  • neocoin
  • ripple

Installation

pip3 install coinaddr

Usage

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

Extending

Currencies

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

from coinaddr import Currency
Currency('testcoin', ticker='ttc', validator='Base58Check',
         networks=dict(
            main=(0x00, 0x05), test=(0x6f, 0xc4)))

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

About

Cryptocurrency address inspection/validation library for python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages