coin-addresses
A public key to the address a coin derives from it, and the validation of an address, in typed Python, with nothing above that: no transaction and no signature.
What is here
coin_addresses.evm derives and validates the addresses of Ethereum and
of the EVM chains, with their EIP-55 checksum;
coin_addresses.bitcoin_cash, coin_addresses.bitcoin_sv,
coin_addresses.bitcoin_gold, coin_addresses.ecash,
coin_addresses.litecoin, coin_addresses.dogecoin and
coin_addresses.dash those of the bitcoin clones; coin_addresses.tron
those of Tron, coin_addresses.cosmos those of the Cosmos Hub, and
coin_addresses.xrp the classic addresses of the XRP Ledger. These are
the coins on secp256k1 of the first stage.
coin_addresses.solana gives the addresses of Solana and
coin_addresses.stellar the account addresses of Stellar, coins on
ed25519 of the second stage. It builds on
ecc for the curve and on
base58-bech32 for the
encodings, and not on btclib.
btclib-org/.github#2197
records that decision and tracks the release; the later stages are
btclib-org/.github#2199,
btclib-org/.github#2200,
btclib-org/.github#2201
and btclib-org/.github#2202.
The package is fully annotated and ships py.typed. Its refusals are
coin_addresses.exceptions's classes: a ValueError or a
TypeError, under one base, CoinAddressesException.
from coin_addresses.exceptions import (
CoinAddressesException,
CoinAddressesTypeError,
CoinAddressesValueError,
)
assert issubclass(CoinAddressesValueError, (CoinAddressesException, ValueError))
assert issubclass(CoinAddressesTypeError, (CoinAddressesException, TypeError))
A public key, as a point or in its SEC encoding, compressed or not, gives its Ethereum address, and an address handed over is checked:
from coin_addresses import evm
# the generator of secp256k1, the public key of the private key 1
pub_key = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
address = evm.address_from_pub_key(pub_key)
assert address == "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf"
assert evm.is_valid_address(address)
assert not evm.is_valid_address(address.replace("E", "e", 1))
A bitcoin clone's address is that of the key's compressed SEC encoding, and a key written uncompressed is refused. The Litecoin and Bitcoin Gold modules name the script type, and the Bitcoin Cash and eCash modules give the legacy address beside the CashAddr one:
from coin_addresses import bitcoin_cash, dogecoin, litecoin
pub_key = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
address = litecoin.address_from_pub_key(pub_key, script_type="p2wpkh")
assert address == "ltc1qw508d6qejxtdg4y5r3zarvary0c5xw7kgmn4n9"
address = bitcoin_cash.address_from_pub_key(pub_key)
assert address == "bitcoincash:qp63uahgrxged4z5jswyt5dn5v3lzsem6cy4spdc2h"
address = bitcoin_cash.legacy_address_from_pub_key(pub_key)
assert address == "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH"
assert dogecoin.is_valid_address(dogecoin.address_from_pub_key(pub_key))
eCash writes CashAddr with its own prefix, and Bitcoin SV reads Bitcoin's legacy addresses alone:
from coin_addresses import bitcoin_cash, bitcoin_gold, bitcoin_sv, dash, ecash
pub_key = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
address = ecash.address_from_pub_key(pub_key)
assert address == "ecash:qp63uahgrxged4z5jswyt5dn5v3lzsem6cacy2kzvq"
assert not ecash.is_valid_address(bitcoin_cash.address_from_pub_key(pub_key))
address = bitcoin_sv.address_from_pub_key(pub_key)
assert address == "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH"
assert not bitcoin_sv.is_valid_address(bitcoin_cash.address_from_pub_key(pub_key))
address = bitcoin_gold.address_from_pub_key(pub_key, script_type="p2wpkh")
assert address == "btg1qw508d6qejxtdg4y5r3zarvary0c5xw7k6w057a"
assert dash.address_from_pub_key(pub_key) == "XmN7PQYWKn5MJFna5fRYgP6mxT2F7xpekE"
A Tron address carries the bytes of the key's Ethereum address, in Base58Check:
from coin_addresses import tron
pub_key = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
address = tron.address_from_pub_key(pub_key)
assert address == "TMVQGm1qAQYVdetCeGRRkTWYYrLXuHK2HC"
assert tron.is_valid_address(address)
A Cosmos Hub address carries a bitcoin clone's hash in bech32, with the
HRP cosmos, and an address with another chain's HRP is refused:
from coin_addresses import cosmos
from coin_addresses.exceptions import CoinAddressesValueError
pub_key = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
address = cosmos.address_from_pub_key(pub_key)
assert address == "cosmos1w508d6qejxtdg4y5r3zarvary0c5xw7k6ah60c"
assert cosmos.is_valid_address(address)
# the same bytes with Osmosis's HRP: a valid bech32 string, refused for
# its HRP alone
osmosis = "osmo1w508d6qejxtdg4y5r3zarvary0c5xw7kjxy2e2"
try:
cosmos.assert_valid_address(osmosis)
except CoinAddressesValueError as e:
assert str(e) == "not the Cosmos HRP"
else:
raise AssertionError(osmosis)
An XRP Ledger classic address carries the bytes of a Bitcoin P2PKH address, written with Ripple's Base58 alphabet. An X-address is refused:
from coin_addresses import xrp
pub_key = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
address = xrp.address_from_pub_key(pub_key)
# Bitcoin writes the same bytes as 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
assert address == "rBgGZ9tc4him9KBzD8fKFiQz3fSZpaSwMH"
assert xrp.is_valid_address(address)
# an X-address of another account, from xrpl-py's tests
assert not xrp.is_valid_address("X7AcgcsBL6XDcUb289X4mJ8djcdyKaB5hJDWMArnXr61cqZ")
A Solana address is the 32 bytes of an ed25519 public key in Base58, with no checksum. Any 32 bytes are an address, so a program derived address, which lies off the curve, is valid too:
from coin_addresses import solana
# a key of bip_utils's tests
pub_key = "e9b6062841bb977ad21de71ec961900633c26f21384e015b014a637a61499547"
address = solana.address_from_pub_key(pub_key)
assert address == "GjJyeC1r2RgkuoCWMyPYkCWSGSGLcz266EaAkLA27AhL"
assert solana.is_valid_address(address)
# the System Program's address, the 32 zero bytes
assert solana.address_from_pub_key(bytes(32)) == "1" * 32
# a program derived address of solana-sdk's tests
assert solana.is_valid_address("BwqrghZA2htAcqq8dzP1WDAhTXYTYWj7CHxF5j7TDBAe")
A Stellar account address is the strkey of an ed25519 public key: its
32 bytes in base-32, after a version byte and with a checksum. A muxed
account, M..., is refused:
from coin_addresses import stellar
# the key of SEP-0023's tests
pub_key = "3f0c34bf93ad0d9971d04ccc90f705511c838aad9734a4a2fb0d7a03fc7fe89a"
address = stellar.address_from_pub_key(pub_key)
assert address == "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ"
assert stellar.is_valid_address(address)
# SEP-0023's muxed account of the same key, with the id 0
muxed = "MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAACJUQ"
assert not stellar.is_valid_address(muxed)
tests/readme_test.py runs every Python block of this file, so the
examples above are the ones the suite checks.
Security
SECURITY.md says how to report a vulnerability, which versions are supported, and how a published file is traced back to the run that built it.
Contributing
Development is LLM-based: humans are welcome, as long as they are
comfortable with agentic development ;-). A contribution must have been
read and understood by the person who submits it.
CONTRIBUTING.md
has the rules.
CONTRIBUTING.md
has the commands each CI job runs, verbatim. uv sync creates the
environment; uv is the only tool that has to be installed.
REVIEWING.md
is what a pull request is answered against.
How the organization decides, and who holds which role, is its GOVERNANCE.md; what it intends to do, and what it deliberately does not, is its ROADMAP.md.
Links
- Documentation: https://coin-addresses.readthedocs.io/
- Source: https://github.com/btclib-org/coin-addresses
- Releases: https://github.com/btclib-org/coin-addresses/releases
- CHANGELOG.md, and RELEASE_NOTES.md for what a release asks a user to act on
Status
The btclib organization and its projects are actively supported by DGI and CheckSig.
Metadata
Release files for coin-addresses 2026.11.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coin_addresses-2026.11.15.tar.gz | 583.0 kB | With provenance | Details for coin_addresses-2026.11.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coin_addresses-2026.11.15-py3-none-any.whl | Python 3 | none | any | Details for coin_addresses-2026.11.15-py3-none-any.whl |
Total release size: 627.3 kB
Release files / coin_addresses-2026.11.15.tar.gz
| Download URL | coin_addresses-2026.11.15.tar.gz |
|---|---|
| Size | 583.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cbdfaf81fbc77f8350c67a3c7374ba209f68fa9b433baef0d8014d6c8d29598
|
|
BLAKE2b-256 checksum How to use checksums |
fcb6a6acee5b6e595039321392f374816a875a6b05da16cbd1171526376eb281
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logRelease files / coin_addresses-2026.11.15-py3-none-any.whl
| Download URL | coin_addresses-2026.11.15-py3-none-any.whl |
|---|---|
| Size | 44.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e209a150e918e48061db6d5bbc5c7bf28379706a8189681e047d786362e30f75
|
|
BLAKE2b-256 checksum How to use checksums |
76b57e8a53928bde690957234c5e98c099d87e76b982f329af6c60fc00e52f43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logSecurity for coin-addresses 2026.11.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for coin_addresses-2026.11.15.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.