This is a Python class which performs strong validation of different cryptocurrency addresses, chains, and ticker symbols. It will ensure that the data provided calculates to a correct value, and is syntactically safe to use. Segwit compatible
This library performs Levels 1 through 4 for all supported coins and address formats
This library has two dependencies: pysha3 and base58. You use this library by importing and calling static methods in the top-level Validation class. Coin tickers, chains, and names are case-insensitive. All functions return a boolean True/False answer.
class Validation:
@staticmethod
def is_btc_chain(chain): ...
@staticmethod
def is_xmr_chain(chain): ...
@staticmethod
def is_coin_ticker(coin): ...
@staticmethod
def is_coin_name(name): ...
@staticmethod
def is_address(coin, address): ...
@staticmethod
def is_btc_address(address): ...
@staticmethod
def is_ltc_address(address): ...
@staticmethod
def is_xmr_address(address, label=None): ...
from Validation import Validation
if Validation.is_coin_ticker("BTC"):
print("Valid")
if Validation.is_btc_chain("testnet"):
print("Valid")
if Validation.is_xmr_chain("stagenet"):
print("Valid")
if Validation.is_coin_name("lITeCoiN"):
print("Valid")
if Validation.is_address("BTC", "3FkenCiXpSLqD8L79intRNXUgjRoH9sjXa"):
print("Valid")
if Validation.is_address("BTC", "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq"):
print("Valid")
if Validation.is_address("LTC", "LS78aoGtfuGCZ777x3Hmr6tcoW3WaYynx9"):
print("Valid")
if Validation.is_address("XMR", "46E5ekYrZd5UCcmNuYEX24FRjWVMgZ1ob79cRViyfvLFZjfyMhPDvbuCe54FqLQvVCgRKP4UUMMW5fy3ZhVQhD1JLLufBtu"):
print("Valid")
I borrowed / modified code from these projects:
Please test throughly before using this in a production environment. There are no warranties, guarantees, or strings attached when using this software