btc_address¶
validators.btc_address.btc_address(value)
¶
Return whether or not given value is a valid bitcoin address.
Full validation is implemented for P2PKH and P2SH addresses. For segwit addresses a regexp is used to provide a reasonable estimate on whether the address is valid.
Examples:
>>> btc_address('3Cwgr2g7vsi1bXDUkpEnVoRLA9w4FZfC69')
# Output: True
>>> btc_address('1BvBMsEYstWetqTFn5Au4m4GFg7xJaNVN2')
# Output: ValidationError(func=btc_address, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
Bitcoin address string to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.18.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/btc_address.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|