Skip to main content

Cryptocurrency address validation module

Project description

Coinage

Travis

Coinage is a python module for validating cryptocurrency addresses with different formats among different blockchain networks.

Examples

from coinage import BitcoinBlockchain, FailedValidation, FailedChecksumValidation

btc = BitcoinBlockchain()

try:
	valid = btc.validate('abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw')
	if valid.is_from_main_net():
		print('this address looks good')
	else:
		print('this isn\'t a mainnet address')
except FailedChecksumValidation:
	print('you probably made a mistake when copying this address')
except FailedValidation:
	print('this isnt a bitcoin address')

Or:

from coinage import BitcoinBlockchain, FailedValidation, FailedChecksumValidation

btc = BitcoinBlockchain()

result, details = btc.is_valid('abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw')
if result:
	if details.is_from_main_net():
		print('this address looks good')
	else:
		print('this isn\'t a mainnet address')
else:
	print('this isnt a valid bitcoin address')

Sources

Bitcoin wiki page about Bech32

BIP-0173

EIP-55

CashAddr Spec

Coinaddr Python Module

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

python-coinage-1.0.0.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

python_coinage-1.0.0-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

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