Addresses¶
- class hdwallet.addresses.ADDRESSES¶
A class that manages a dictionary of address classes.
This class provides methods to retrieve names and classes of various address implementations, as well as methods to validate and access specific address classes by name.
Here are available address names and classes:
Name
Class
Algorand
Aptos
Avalanche
BitcoinCash
hdwallet.addresses.bitcoincash.BitcoinCashCardano
Cosmos
EOS
Ergo
Ethereum
Filecoin
Harmony
Icon
Injective
Monero
MultiversX
Nano
Near
Neo
OKT-Chain
P2PKH
P2SH
P2TR
P2WPKH
P2WPKH-In-P2SH
P2WSH
P2WSH-In-P2SH
Ripple
Solana
Stellar
Sui
Tezos
Tron
XinFin
Zilliqa
- classmethod names() List[str]¶
Get the list of address class names.
- Returns:
A list of address class names.
- Return type:
List[str]
- classmethod classes() List[Type[IAddress]]¶
Get the list of address classes.
- Returns:
A list of address classes.
- Return type:
List[Type[IAddress]]
- classmethod address(name: str) Type[IAddress]¶
Retrieve an address class by its name.
- Parameters:
name (str) – The name of the address class.
- Returns:
The address class corresponding to the given name.
- Return type:
Type[IAddress]
- classmethod is_address(name: str) bool¶
Check if a given name is a valid address name.
- Parameters:
name (str) – The name to check.
- Returns:
True if the name is valid, False otherwise.
- Return type:
bool
>>> from hdwallet.addresses import ADDRESSES
>>> ADDRESSES.names()
['Algorand', 'Aptos', 'Avalanche', 'Cardano', 'Cosmos', 'EOS', 'Ergo', 'Ethereum', 'Filecoin', 'Harmony', 'Icon', 'Injective', 'Monero', 'MultiversX', 'Nano', 'Near', 'Neo', 'OKT-Chain', 'P2PKH', 'P2SH', 'P2TR', 'P2WPKH', 'P2WPKH-In-P2SH', 'P2WSH', 'P2WSH-In-P2SH', 'Ripple', 'Solana', 'Stellar', 'Sui', 'Tezos', 'Tron', 'XinFin', 'Zilliqa']
>>> ADDRESSES.classes()
[<class 'hdwallet.addresses.algorand.AlgorandAddress'>, <class 'hdwallet.addresses.aptos.AptosAddress'>, <class 'hdwallet.addresses.avalanche.AvalancheAddress'>, <class 'hdwallet.addresses.cardano.CardanoAddress'>, <class 'hdwallet.addresses.cosmos.CosmosAddress'>, <class 'hdwallet.addresses.eos.EOSAddress'>, <class 'hdwallet.addresses.ergo.ErgoAddress'>, <class 'hdwallet.addresses.ethereum.EthereumAddress'>, <class 'hdwallet.addresses.filecoin.FilecoinAddress'>, <class 'hdwallet.addresses.harmony.HarmonyAddress'>, <class 'hdwallet.addresses.icon.IconAddress'>, <class 'hdwallet.addresses.injective.InjectiveAddress'>, <class 'hdwallet.addresses.monero.MoneroAddress'>, <class 'hdwallet.addresses.multiversx.MultiversXAddress'>, <class 'hdwallet.addresses.nano.NanoAddress'>, <class 'hdwallet.addresses.near.NearAddress'>, <class 'hdwallet.addresses.neo.NeoAddress'>, <class 'hdwallet.addresses.okt_chain.OKTChainAddress'>, <class 'hdwallet.addresses.p2pkh.P2PKHAddress'>, <class 'hdwallet.addresses.p2sh.P2SHAddress'>, <class 'hdwallet.addresses.p2tr.P2TRAddress'>, <class 'hdwallet.addresses.p2wpkh.P2WPKHAddress'>, <class 'hdwallet.addresses.p2wpkh_in_p2sh.P2WPKHInP2SHAddress'>, <class 'hdwallet.addresses.p2wsh.P2WSHAddress'>, <class 'hdwallet.addresses.p2wsh_in_p2sh.P2WSHInP2SHAddress'>, <class 'hdwallet.addresses.ripple.RippleAddress'>, <class 'hdwallet.addresses.solana.SolanaAddress'>, <class 'hdwallet.addresses.stellar.StellarAddress'>, <class 'hdwallet.addresses.sui.SuiAddress'>, <class 'hdwallet.addresses.tezos.TezosAddress'>, <class 'hdwallet.addresses.tron.TronAddress'>, <class 'hdwallet.addresses.xinfin.XinFinAddress'>, <class 'hdwallet.addresses.zilliqa.ZilliqaAddress'>]
>>> from hdwallet.addresses.p2wsh import P2WSHAddress
>>> ADDRESSES.address(name="P2WSH")
<class 'hdwallet.addresses.p2wsh.P2WSHAddress'>
>>> ADDRESSES.address(name="P2WSH") == P2WSHAddress
True
>>> ADDRESSES.is_address(name="P2WSH")
True
- class hdwallet.addresses.iaddress.IAddress¶
- abstractmethod static name() str¶
Get the name of the address class.
- Returns:
The name of the address class.
- Return type:
str
- abstractmethod classmethod encode(public_key: bytes | str | IPublicKey, **kwargs) str¶
Encodes the given public key into a address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode. Can be bytes, string, or an object implementing IPublicKey.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded address as a string.
- Return type:
str
- abstractmethod classmethod decode(address: str, **kwargs) str¶
Decodes the given address into its corresponding public key or public key hash.
- Parameters:
address (str) – The address to decode.
kwargs (Any) – Additional keyword arguments specific to each decoding type.
- Returns:
The decoded public key as a string.
- Return type:
str
- class hdwallet.addresses.algorand.AlgorandAddress¶
- static name() str¶
Returns the name of the cryptocurrency.
- Returns:
The name of the cryptocurrency, which is “Algorand”.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes a public key to a string format with a checksum.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded. It can be in bytes, string, or IPublicKey format.
kwargs – Additional keyword arguments.
- Returns:
The encoded public key string with a checksum.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes an encoded address string to a public key, verifying its checksum.
- Parameters:
address (str) – The encoded address string.
kwargs – Additional keyword arguments.
- Returns:
The decoded public key as a string.
- Return type:
str
>>> from hdwallet.addresses.algorand import AlgorandAddress
>>> AlgorandAddress.name()
'Algorand'
>>> address: str = AlgorandAddress.encode(public_key="00d14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d")
>>> address
'2FDJMWB65EKEQ6DDLNKX2UK2KAVQINTIDDP6O5SXG52GWT2XS6GWBBFHDM'
>>> AlgorandAddress.decode(address=address)
'd14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d'
- class hdwallet.addresses.aptos.AptosAddress¶
- static name() str¶
Returns the name of the cryptocurrency.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes a public key into an Aptos address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode. Can be of type bytes, str, or IPublicKey.
kwargs – Additional arguments.
- Returns:
The encoded Aptos address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes an Aptos address into its raw form without the prefix.
- Parameters:
address (str) – The Aptos address to decode.
kwargs – Additional arguments.
- Returns:
The decoded address in its raw form.
- Return type:
str
>>> from hdwallet.addresses.aptos import AptosAddress
>>> AptosAddress.name()
'Aptos'
>>> address: str = AptosAddress.encode(public_key="00d14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d")
>>> address
'0x7d39ce271d420c8ae8fe93c07a2fbbfa733eec1c6d1fa4899058cbd48c433d'
>>> AptosAddress.decode(address=address)
'007d39ce271d420c8ae8fe93c07a2fbbfa733eec1c6d1fa4899058cbd48c433d'
- class hdwallet.addresses.avalanche.AvalancheAddress¶
- static name() str¶
Returns the name of the cryptocurrency.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes the given public key into an Avalanche address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded.
kwargs (Any) – Additional keyword arguments, including “address_type”.
- Returns:
The encoded Avalanche address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given Avalanche address into its corresponding public key.
- Parameters:
address (str) – The Avalanche address to be decoded.
kwargs (Any) – Additional keyword arguments, including “address_type”.
- Returns:
The decoded public key.
- Return type:
str
>>> from hdwallet.addresses.avalanche import AvalancheAddress
>>> AvalancheAddress.name()
'Avalanche'
>>> address: str = AvalancheAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'P-avax16zfzju9q6y9nfqeaxp3yvfvzvrx9rlamqm0t2x'
>>> AvalancheAddress.decode(address=address)
'd0922970a0d10b34833d306246258260cc51ffbb'
- class hdwallet.addresses.cardano.CardanoAddress¶
- static name() str¶
Returns the name of the cryptocurrency associated with this address format.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any)¶
Encodes the given public key into a Cardano address based on the specified encoding type.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode. Can be bytes, string, or an object implementing IPublicKey.
encode_type (str) – The type of Cardano address encoding to use (default: Cardano.ADDRESS_TYPES.PAYMENT).
kwargs (Any) – Additional keyword arguments specific to each encoding type.
- Returns:
The encoded Cardano address as a string.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given Cardano address into its corresponding public key based on the specified decoding type.
- Parameters:
address (str) – The Cardano address to decode.
decode_type (str) – The type of Cardano address decoding to use (default: Cardano.ADDRESS_TYPES.PAYMENT).
kwargs (Any) – Additional keyword arguments specific to each decoding type.
- Returns:
The decoded public key as a string.
- Return type:
str
- classmethod encode_byron(public_key: IPublicKey, chain_code: bytes | str, address_attributes: dict, address_type: str = 'public-key') str¶
Encodes the given public key and associated attributes into a Byron address format.
- Parameters:
public_key (IPublicKey) – The public key to encode.
chain_code (Union[bytes, str]) – The chain code associated with the address.
address_attributes (dict) – Additional attributes to include in the address encoding.
address_type (str) – The type of Byron address to generate (default: Cardano.ADDRESS_TYPES.PUBLIC_KEY).
- Returns:
The encoded Byron address as a string.
- Return type:
str
- classmethod encode_byron_icarus(public_key: bytes | str | IPublicKey, chain_code: bytes | str, address_type: str = 'public-key') str¶
Encodes the given public key and associated attributes into a Byron Icarus address format.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
chain_code (Union[bytes, str]) – The chain code associated with the address.
address_type (str) – The type of Byron address to generate (default: Cardano.ADDRESS_TYPES.PUBLIC_KEY).
- Returns:
The encoded Byron Icarus address as a string.
- Return type:
str
- classmethod encode_byron_legacy(public_key: bytes | str | IPublicKey, path: str, path_key: bytes | str, chain_code: bytes | str, address_type: str = 'public-key') str¶
Encodes the given public key and associated attributes into a Byron legacy address format.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
path (str) – The hierarchical deterministic (HD) path for address derivation.
path_key (Union[bytes, str]) – The HD path key used for encryption.
chain_code (Union[bytes, str]) – The chain code associated with the address.
address_type (str) – The type of Byron address to generate (default: Cardano.ADDRESS_TYPES.PUBLIC_KEY).
- Returns:
The encoded Byron legacy address as a string.
- Return type:
str
- classmethod decode_byron(address: str, address_type: str = 'public-key') str¶
Decodes the given Byron address into its corresponding public key.
- Parameters:
address (str) – The Byron address to decode.
address_type (str) – The type of Byron address (default: Cardano.ADDRESS_TYPES.PUBLIC_KEY).
- Returns:
The decoded public key as a string.
- Return type:
str
- classmethod decode_byron_icarus(address: str, address_type: str = 'public-key') str¶
Decodes the given Byron Icarus address into its corresponding public key.
- Parameters:
address (str) – The Byron Icarus address to decode.
address_type (str) – The type of Byron address (default: “public-key”).
- Returns:
The decoded public key as a string.
- Return type:
str
- classmethod decode_byron_legacy(address: str, address_type: str = 'public-key') str¶
Decodes the given Byron Legacy address into its corresponding public key.
- Parameters:
address (str) – The Byron Legacy address to decode.
address_type (str) – The type of Byron address (default: “public-key”).
- Returns:
The decoded public key as a string.
- Return type:
str
- classmethod encode_shelley(public_key: bytes | str | IPublicKey, staking_public_key: bytes | str | IPublicKey, network: str = 'mainnet') str¶
Encodes the given public key and staking public key into a Shelley payment address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
staking_public_key (Union[bytes, str, IPublicKey]) – The staking public key to encode.
network (str) – The network type (default: “mainnet”).
- Returns:
The encoded Shelley payment address.
- Return type:
str
- classmethod decode_shelley(address: str, network: str = 'mainnet') str¶
Decodes the given Shelley payment address into its corresponding public keys.
- Parameters:
address (str) – The Shelley address to be decoded.
network (str) – The network type (default: “mainnet”).
- Returns:
The decoded public keys.
- Return type:
str
- classmethod encode_shelley_staking(public_key: bytes | str | IPublicKey, network: str = 'mainnet') str¶
Encodes the given public key into a Shelley staking (reward) address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded.
network (str) – The network type (default: “mainnet”).
- Returns:
The encoded Shelley staking address.
- Return type:
str
- classmethod decode_shelley_staking(address: str, network: str = 'mainnet') str¶
Decodes the given Shelley staking (reward) address into its corresponding public key.
- Parameters:
address (str) – The Shelley staking address to be decoded.
network (str) – The network type (default: “mainnet”).
- Returns:
The decoded public key.
- Return type:
str
>>> from hdwallet.addresses.cardano import CardanoAddress
>>> CardanoAddress.name()
'Cardano'
>>> address: str = CardanoAddress.encode(
... public_key="00e55487c92c1913439f336b1b2dc316da6e88c02a157208f98781494b87f27eb8",
... chain_code="d537f39c41f0f781f543c4c512cac38927e5ebd3cd82b870dd7ce94de9e510b4",
... encode_type="byron-icarus"
... )
>>> address
'Ae2tdPwUPEZJy1etGnbAt9L92eC2goQEVzsQKpeg9vGYyy6wRSHRNLnTXhL'
>>> CardanoAddress.decode(address=address, decode_type="byron-icarus")
'de155535f68a45e86483a4d1381c17717a9d09b644720b4beae8145d'
>>>
>>> address: str = CardanoAddress.encode_byron_icarus(
... public_key="00e55487c92c1913439f336b1b2dc316da6e88c02a157208f98781494b87f27eb8",
... chain_code="d537f39c41f0f781f543c4c512cac38927e5ebd3cd82b870dd7ce94de9e510b4",
... )
>>> address
'Ae2tdPwUPEZJy1etGnbAt9L92eC2goQEVzsQKpeg9vGYyy6wRSHRNLnTXhL'
>>> CardanoAddress.decode_byron_icarus(address=address)
'de155535f68a45e86483a4d1381c17717a9d09b644720b4beae8145d'
>>>
>>> address: str = CardanoAddress.encode_byron_legacy(
... public_key="00e55487c92c1913439f336b1b2dc316da6e88c02a157208f98781494b87f27eb8",
... path="m/0'/0234'/123/243/5/7",
... path_key="39ddaa1e5719d88d6b53eda320f3dbe8c012d24abe33f4ac358fe78df43d5814",
... chain_code="d537f39c41f0f781f543c4c512cac38927e5ebd3cd82b870dd7ce94de9e510b4"
... )
>>> address
'Un4ZpTvXtoKmqsCFyDCG86z27yfgkyQ3ZidQSPQqf9YNk4DSCFqVfutBFTQCgMM9K2txjuBMBFs8ThUaB2zarMiPVaEby7hSg97nYfJjAJXx4cmP'
>>> CardanoAddress.decode_byron_legacy(address=address)
'5c27044e9fe6cd3f89df7d725dccc5f015ad1a3e7e5bb39f32a595e7d9758587b1078dfb12d017b4860de1a05dcecc07eea0291e18937278d865edab3840'
>>>
>>> address: str = CardanoAddress.encode_shelley(
... public_key="00e55487c92c1913439f336b1b2dc316da6e88c02a157208f98781494b87f27eb8",
... staking_public_key="007505bd415a4d5b21cb5be55360adeff02192ad952b5a1728e65010aea306aa54"
... )
>>> address
'addr1qy56fgzsfwpftatef0sxma2sksyxm7wf9husxazh0ph7n30zmrqdt7aqd5mfa0fs69dzs30svnqrc6v3s62l2nmg0c7q0d0m7j'
>>> CardanoAddress.decode_shelley(address=address)
'29a4a0504b8295f5794be06df550b4086df9c92df9037457786fe9c5e2d8c0d5fba06d369ebd30d15a2845f064c03c69918695f54f687e3c'
>>>
>>> address: str = CardanoAddress.encode_shelley_staking(
... public_key="00e55487c92c1913439f336b1b2dc316da6e88c02a157208f98781494b87f27eb8"
... )
>>> address
'stake1uy56fgzsfwpftatef0sxma2sksyxm7wf9husxazh0ph7n3g5jc0qy'
>>> CardanoAddress.decode_shelley_staking(address=address)
'29a4a0504b8295f5794be06df550b4086df9c92df9037457786fe9c5'
- class hdwallet.addresses.cosmos.CosmosAddress¶
- static name() str¶
Returns the name of the cryptocurrency or network.
- Returns:
The name “Cosmos”.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes the given public key into a Bech32 Cosmos address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded.
kwargs (Any) – Additional keyword arguments, including “hrp”.
- Returns:
The encoded Bech32 Cosmos address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given Bech32 Cosmos address into its corresponding public key hash.
- Parameters:
address (str) – The Bech32 Cosmos address to be decoded.
kwargs (Any) – Additional keyword arguments, including “hrp”.
- Returns:
The decoded public key hash.
- Return type:
str
>>> from hdwallet.addresses.cosmos import CosmosAddress
>>> CosmosAddress.name()
'Cosmos'
>>> address: str = CosmosAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'cosmos16zfzju9q6y9nfqeaxp3yvfvzvrx9rlam4ezznm'
>>> CosmosAddress.decode(address=address)
'd0922970a0d10b34833d306246258260cc51ffbb'
- class hdwallet.addresses.eos.EOSAddress¶
- static name() str¶
Returns the name of the cryptocurrency.
- Returns:
The name “EOS”.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes the given public key into an EOS address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded EOS address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given EOS address into its corresponding public key.
- Parameters:
address (str) – The EOS address to decode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The decoded public key.
- Return type:
str
>>> from hdwallet.addresses.eos import EOSAddress
>>> EOSAddress.name()
'EOS'
>>> address: str = EOSAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'EOS7ibykhJSC7L399MVKebcJVeeTotrvaqxTZD18M1igKJpEEwVD3'
>>> EOSAddress.decode(address=address)
'0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429'
- class hdwallet.addresses.ergo.ErgoAddress¶
- static name() str¶
Returns the name of the cryptocurrency.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes the given public key into an Ergo address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments, including “address_type” and “network_type”.
- Returns:
The encoded Ergo address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given Ergo address into its corresponding public key.
- Parameters:
address (str) – The Ergo address to decode.
kwargs (Any) – Additional keyword arguments, including “address_type” and “network_type”.
- Returns:
The decoded public key.
- Return type:
str
>>> from hdwallet.addresses.ergo import ErgoAddress
>>> ErgoAddress.name()
'Ergo'
>>> address: str = ErgoAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429", network_type="mainnet")
>>> address
'9hMB97bUb7FJZ9uuZiYPnPyu5fTjHCK1Q5gmTUSWCS2b9PTymeg'
>>> ErgoAddress.decode(address=address, network_type="mainnet")
'0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429'
- class hdwallet.addresses.ethereum.EthereumAddress¶
- static name() str¶
Returns the name of the cryptocurrency.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes the given public key into a Cosmos address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded.
kwargs (Any) – Additional keyword arguments, including “skip_checksum_encode”.
- Returns:
The encoded Cosmos address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given Cosmos address into its corresponding public key hash.
- Parameters:
address (str) – The Cosmos address to be decoded.
kwargs (Any) – Additional keyword arguments, including “skip_checksum_encode”.
- Returns:
The decoded public key hash.
- Return type:
str
>>> from hdwallet.addresses.ethereum import EthereumAddress
>>> EthereumAddress.name()
'Ethereum'
>>> address: str = EthereumAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'0xe349A2f7dF70161e529E4C2982828A50c20FfDaB'
>>> EthereumAddress.decode(address=address)
'e349a2f7df70161e529e4c2982828a50c20ffdab'
- class hdwallet.addresses.filecoin.FilecoinAddress¶
- static name() str¶
Returns the name of the blockchain.
- Returns:
The name of the blockchain.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes the given public key into a Filecoin address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded.
kwargs (Any) – Additional keyword arguments, including “address_type”.
- Returns:
The encoded Filecoin address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given Filecoin address into its corresponding public key hash.
- Parameters:
address (str) – The Filecoin address to be decoded.
kwargs (Any) – Additional keyword arguments, including “address_type”.
- Returns:
The decoded public key hash.
- Return type:
str
>>> from hdwallet.addresses.filecoin import FilecoinAddress
>>> FilecoinAddress.name()
'Filecoin'
>>> address: str = FilecoinAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'f1ziusa3hzevazyixnvy6falwmykiuozkb22utdea'
>>> FilecoinAddress.decode(address=address, address_type="secp256k1")
'ca29206cf925419c22edae3c502eccc291476541'
- class hdwallet.addresses.harmony.HarmonyAddress¶
- static name() str¶
Returns the name of the blockchain.
- Returns:
The name of the blockchain.
- Return type:
str
>>> from hdwallet.addresses.harmony import HarmonyAddress
>>> HarmonyAddress.name()
'Harmony'
>>> address: str = HarmonyAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'one1udy69a7lwqtpu557fs5c9q522rpqlldt0rxe4v'
>>> HarmonyAddress.decode(address=address)
'e349a2f7df70161e529e4c2982828a50c20ffdab'
- class hdwallet.addresses.icon.IconAddress¶
- static name() str¶
Returns the name of the blockchain.
- Returns:
The name of the blockchain.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes the given public key into an Icon address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded Icon address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes the given Icon address into its corresponding public key hash.
- Parameters:
address (str) – The Icon address to be decoded.
kwargs (Any) – Additional keyword arguments.
- Returns:
The decoded public key hash.
- Return type:
str
>>> from hdwallet.addresses.icon import IconAddress
>>> IconAddress.name()
'Icon'
>>> address: str = IconAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'hx9756520d3d5f07cc3e1c9f75e279d51d330bfdce'
>>> IconAddress.decode(address=address)
'9756520d3d5f07cc3e1c9f75e279d51d330bfdce'
- class hdwallet.addresses.injective.InjectiveAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “Injective”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes a public key into an Injective address using Bech32 encoding.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded Injective address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes an Injective address from Bech32 encoding.
- Parameters:
address (str) – The Injective address to decode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The decoded public key.
- Return type:
str
>>> from hdwallet.addresses.injective import InjectiveAddress
>>> InjectiveAddress.name()
'Injective'
>>> address: str = InjectiveAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'inj1udy69a7lwqtpu557fs5c9q522rpqlldt2tluvt'
>>> InjectiveAddress.decode(address=address)
'e349a2f7df70161e529e4c2982828a50c20ffdab'
- class hdwallet.addresses.monero.MoneroAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “Monero”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(spend_public_key: bytes | str | IPublicKey, view_public_key: bytes | str | IPublicKey, network: str = 'mainnet', address_type: str = 'standard', payment_id: bytes | None = None) str¶
Encodes the given spend and view public keys into a Monero address.
- Parameters:
spend_public_key (Union[bytes, str, IPublicKey]) – The spend public key.
view_public_key (Union[bytes, str, IPublicKey]) – The view public key.
network (str) – The network (default is “mainnet”).
address_type (str) – The address type (default is Monero.ADDRESS_TYPES.STANDARD).
payment_id (Optional[bytes]) – Optional payment ID bytes.
- Returns:
The encoded Monero address.
- Return type:
str
- classmethod decode(address: str, network: str = 'mainnet', address_type: str = 'standard', payment_id: bytes | None = None) Tuple[str, str]¶
Decodes a Monero address into spend and view public keys.
- Parameters:
address (str) – The Monero address to decode.
network (str) – The network (default is “mainnet”).
address_type (str) – The address type (default is Monero.ADDRESS_TYPES.STANDARD).
payment_id (Optional[bytes]) – Optional payment ID bytes.
- Returns:
A tuple containing the spend public key and view public key.
- Return type:
Tuple[str, str]
>>> from hdwallet.addresses.monero import MoneroAddress
>>> MoneroAddress.name()
'Monero'
>>> address: str = MoneroAddress.encode(
... spend_public_key="628247d3de93857cdd360fee4aef9a67ecfebedfe8eaec9cf6be35eacc895ca7",
... view_public_key="1bc7b28fdaec0ec300c8c2759b1bf01f5300bb8465f736c55d64c5d87ec5e311"
... )
>>> address
'45MdDdMknD2MtLcqtCBAfTJPDBhBiQ2QjTFkG6kbAYyhUxAPk2iygXPZcmtgou9dBV6EtHgRFYkMja1gncWwRdUv2vsuWU7'
>>> MoneroAddress.decode(address=address)
('628247d3de93857cdd360fee4aef9a67ecfebedfe8eaec9cf6be35eacc895ca7', '1bc7b28fdaec0ec300c8c2759b1bf01f5300bb8465f736c55d64c5d87ec5e311')
- class hdwallet.addresses.multiversx.MultiversXAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “MultiversX”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode the public key into a string format using Bech32 encoding.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode, can be bytes, str, or IPublicKey.
kwargs (Any) – Additional keyword arguments. - hrp: Human-readable part (optional).
- Returns:
The encoded public key as a string.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode an address string using Bech32 decoding.
- Parameters:
address (str) – The address string to decode.
kwargs (Any) – Additional keyword arguments. - hrp: Human-readable part (optional).
- Returns:
The decoded address as a string.
- Return type:
str
>>> from hdwallet.addresses.multiversx import MultiversXAddress
>>> MultiversXAddress.name()
'MultiversX'
>>> address: str = MultiversXAddress.encode(
... public_key="00d14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d"
... )
>>> address
'erd169rfvkp7ay2ys7rrtd2h65262q4sgdngrr07wajhxa6xkn6hj7xsdet995'
>>> MultiversXAddress.decode(address=address)
'd14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d'
- class hdwallet.addresses.nano.NanoAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “Nano”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into an address using custom encoding.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode an address string into a public key using custom decoding.
- Parameters:
address (str) – The address string to decode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The decoded public key as a string.
- Return type:
str
>>> from hdwallet.addresses.nano import NanoAddress
>>> NanoAddress.name()
'Nano'
>>> address: str = NanoAddress.encode(public_key="006aea61eeed872052377ab16b0fc5d9b9f142be59ac1488e6610645dedb4da45c")
>>> address
'nano_1tqce9qgu3s1cauqoedd3z4xmghjacz7md1nj5m843k7uufnub4wem9ziqhs'
>>> NanoAddress.decode(address=address)
'6aea61eeed872052377ab16b0fc5d9b9f142be59ac1488e6610645dedb4da45c'
- class hdwallet.addresses.near.NearAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “Near”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes a public key into a string format.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded public key as a string.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes an address string.
- Parameters:
address (str) – The address string to decode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The decoded address string.
- Return type:
str
>>> from hdwallet.addresses.nano import NanoAddress
>>> NanoAddress.name()
'Nano'
>>> address: str = NanoAddress.encode(public_key="006aea61eeed872052377ab16b0fc5d9b9f142be59ac1488e6610645dedb4da45c")
>>> address
'nano_1tqce9qgu3s1cauqoedd3z4xmghjacz7md1nj5m843k7uufnub4wem9ziqhs'
>>> NanoAddress.decode(address=address)
'6aea61eeed872052377ab16b0fc5d9b9f142be59ac1488e6610645dedb4da45c'
- class hdwallet.addresses.neo.NeoAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “Neo”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a cryptocurrency address using SLIP-10 NIST P-256 public key.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode. Can be bytes, str, or IPublicKey.
kwargs (Any) – Additional keyword arguments. - address_version: Version of the address (optional). - alphabet: Custom alphabet for encoding (optional).
- Returns:
The encoded cryptocurrency address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a cryptocurrency address into its public key using SLIP-10 NIST P-256 public key.
- Parameters:
address (str) – The address to decode.
kwargs (Any) – Additional keyword arguments. - alphabet: Custom alphabet for decoding (optional). - address_version: Version of the address (optional).
- Returns:
The decoded public key.
- Return type:
str
>>> from hdwallet.addresses.neo import NeoAddress
>>> NeoAddress.name()
'Neo'
>>> address: str = NeoAddress.encode(public_key="02e4bd97a82a8f3e575a9a35b7cca19cd730addd499a2bd4e9a9811df8bfc35e51")
>>> address
'AKMzgMj2nGYoy7fuDcQySog3STQ9uZfxFU'
>>> NeoAddress.decode(address=address)
'275c63df3b7d5362485e157872a22202101a5f6a'
- class hdwallet.addresses.okt_chain.OKTChainAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “OKT-Chain”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into an address using Bech32 encoding.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - hrp: Human-readable part (optional).
- Returns:
The encoded address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a OKT-Chain address from Bech32 encoding.
- Parameters:
address (str) – The OKT-Chain address to decode.
kwargs – Additional keyword arguments: - hrp (str, optional): Human-readable part for the Bech32 encoding. Defaults to cls.hrp.
- Returns:
Decoded OKT-Chain address.
- Return type:
str
>>> from hdwallet.addresses.okt_chain import OKTChainAddress
>>> OKTChainAddress.name()
'OKT-Chain'
>>> address: str = OKTChainAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'ex1udy69a7lwqtpu557fs5c9q522rpqlldtgt7ahy'
>>> OKTChainAddress.decode(address=address)
'e349a2f7df70161e529e4c2982828a50c20ffdab'
- class hdwallet.addresses.p2pkh.P2PKHAddress¶
- static name() str¶
Return the name of the cryptocurrency, which is “P2PKH”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into an address using a specified address prefix and alphabet.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - public_key_address_prefix: Address prefix for the public key (optional). - public_key_type: Type of the public key (optional). - alphabet: Custom alphabet for encoding (optional).
- Returns:
The encoded address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode an address string into a public key hash using a specified address prefix and alphabet.
- Parameters:
address (str) – The address string to decode.
kwargs (Any) – Additional keyword arguments. - public_key_address_prefix: Address prefix for the public key (optional). - alphabet: Custom alphabet for decoding (optional).
- Returns:
The decoded public key hash as a string.
- Return type:
str
>>> from hdwallet.addresses.p2pkh import P2PKHAddress
>>> P2PKHAddress.name()
'P2PKH'
>>> address: str = P2PKHAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'1L1peQYCrrMPRPbbT9UCXainKtczSiekmy'
>>> P2PKHAddress.decode(address=address)
'd0922970a0d10b34833d306246258260cc51ffbb'
- class hdwallet.addresses.p2sh.P2SHAddress¶
- static name() str¶
Return the name of the cryptocurrency, which is “P2SH”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a P2SH address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode. Can be bytes, str, or IPublicKey.
kwargs (Any) – Additional keyword arguments. - script_address_prefix: Prefix for the script address (optional). - public_key_type: Type of the public key (optional). - alphabet: Custom alphabet for encoding (optional).
- Returns:
The encoded P2SH address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a P2SH address into its original public key hash.
- Parameters:
address (str) – The P2SH address to decode.
kwargs (Any) – Additional keyword arguments. - script_address_prefix: Prefix for the script address (optional). - alphabet: Custom alphabet for decoding (optional).
- Returns:
The decoded public key hash as a string.
- Return type:
str
>>> from hdwallet.addresses.p2sh import P2SHAddress
>>> P2SHAddress.name()
'P2SH'
>>> address: str = P2SHAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'3DpehQMAa7jQHoVRnzoKz2w6Pr68Lctxgr'
>>> P2SHAddress.decode(address=address)
'85131e393e442cda8939042ef5709c8a18ddbae6'
- class hdwallet.addresses.p2tr.P2TRAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “P2TR”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod tagged_hash(tag: bytes | str, data_bytes: bytes) bytes¶
Computes a tagged hash using a double SHA256 hash with the given tag and data.
- Parameters:
tag (Union[bytes, str]) – The tag used for hashing, either as bytes or a string.
data_bytes (bytes) – The data bytes to be hashed.
- Returns:
The double SHA256 tagged hash.
- Return type:
bytes
- classmethod hash_tap_tweak(pub_key: IPublicKey) bytes¶
Computes a hash using a tagged hash with the tap tweak SHA256 algorithm and the x-coordinate of the public key.
- Parameters:
pub_key (IPublicKey) – The public key for computing the tweak hash.
- Returns:
The hashed tap tweak.
- Return type:
bytes
- classmethod lift_x(pub_key: IPublicKey) IPoint¶
Lifts the x-coordinate of a given public key onto the secp256k1 elliptic curve to compute its corresponding y-coordinate.
- Parameters:
pub_key (IPublicKey) – The public key whose x-coordinate needs to be lifted.
- Returns:
The elliptic curve point (x, y) corresponding to the lifted x-coordinate.
- Return type:
IPoint
- classmethod tweak_public_key(pub_key: IPublicKey) bytes¶
Tweaks a given public key by hashing its tap tweak and adjusting its x-coordinate on the secp256k1 elliptic curve.
- Parameters:
pub_key (IPublicKey) – The public key to be tweaked.
- Returns:
The tweaked public key bytes.
- Return type:
bytes
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encodes a public key into a SegWit address format using specified human-readable part (HRP) and witness version.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to be encoded.
kwargs (Any) – Additional keyword arguments. - hrp: Human-readable part (optional). - witness_version: SegWit witness version (optional).
- Returns:
The encoded SegWit address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decodes a SegWit address into its original public key using the specified human-readable part (HRP).
- Parameters:
address (str) – The SegWit address to decode.
kwargs (Any) – Additional keyword arguments. - hrp: Human-readable part (optional).
- Returns:
The decoded public key.
- Return type:
str
>>> from hdwallet.addresses.p2tr import P2TRAddress
>>> P2TRAddress.name()
'P2TR'
>>> address: str = P2TRAddress.encode(
... public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429"
... )
>>> address
'bc1pa73duht4ulz02gdn97t6eu0rcunsnmtqylxxr4ds22hxu8clcj4qt8e9h5'
>>> P2TRAddress.decode(address=address)
'efa2de5d75e7c4f521b32f97acf1e3c72709ed6027cc61d5b052ae6e1f1fc4aa'
- class hdwallet.addresses.p2wpkh.P2WPKHAddress¶
- static name() str¶
Returns the name of the cryptocurrency, which is “P2WPKH”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a SegWit address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - hrp: Human-readable part (optional). - public_key_type: Type of the public key (optional). - witness_version: Witness version (optional).
- Returns:
The encoded SegWit address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a SegWit address.
- Parameters:
address (str) – The SegWit address to decode.
kwargs (Any) – Additional keyword arguments. - hrp: Human-readable part (optional).
- Returns:
The decoded address as a string.
- Return type:
str
>>> from hdwallet.addresses.p2wpkh import P2WPKHAddress
>>> P2WPKHAddress.name()
'P2WPKH'
>>> address: str = P2WPKHAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'bc1q6zfzju9q6y9nfqeaxp3yvfvzvrx9rlamrrufhk'
>>> P2WPKHAddress.decode(address=address)
'd0922970a0d10b34833d306246258260cc51ffbb'
- class hdwallet.addresses.p2wpkh_in_p2sh.P2WPKHInP2SHAddress¶
- static name() str¶
Return the name of the address type, which is “P2WPKH-In-P2SH”.
- Returns:
The name of the address type.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a P2WPKH-In-P2SH address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - script_address_prefix: Script address prefix (optional). - public_key_type: Type of public key compression (optional). - alphabet: Custom alphabet for encoding (optional).
- Returns:
The encoded P2WPKH-In-P2SH address.
- Return type:
str
>>> from hdwallet.addresses.p2wpkh_in_p2sh import P2WPKHInP2SHAddress
>>> P2WPKHInP2SHAddress.name()
'P2WPKH-In-P2SH'
>>> address: str = P2WPKHInP2SHAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'39EKCqjpGxLxudcbgNBQDq6CcKg6kQG1hT'
>>> P2WPKHInP2SHAddress.decode(address=address)
'52b433640add2e12b63432fd84e8817ef9369ad0'
- class hdwallet.addresses.p2wsh.P2WSHAddress¶
- static name() str¶
Return the name of the address type, which is “P2WSH”.
- Returns:
The name of the address type.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a P2TR address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - public_key_type: Type of the public key (compressed or uncompressed). - hrp: Human-readable part (optional). - version: Address version (optional).
- Returns:
The encoded P2TR address.
- Return type:
str
>>> from hdwallet.addresses.p2wsh import P2WSHAddress
>>> P2WSHAddress.name()
'P2WSH'
>>> address: str = P2WSHAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'bc1qfv2azdx3776jxve27xpq52w97k0ke47969jt2pnm8yg4cnxnxdxqdfvmyp'
>>> P2WSHAddress.decode(address=address)
'4b15d134d1f7b523332af1820a29c5f59f6cd7c5d164b5067b39115c4cd3334c'
- class hdwallet.addresses.p2wsh_in_p2sh.P2WSHInP2SHAddress¶
- static name() str¶
Returns the name “P2WSH-In-P2SH”.
- Returns:
The name of the address type.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a P2WSH address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - script_address_prefix: Script address prefix (optional). - public_key_type: Type of public key (optional). - alphabet: Custom alphabet for encoding (optional).
- Returns:
The encoded P2WSH address.
- Return type:
str
>>> from hdwallet.addresses.p2wsh_in_p2sh import P2WSHInP2SHAddress
>>> P2WSHInP2SHAddress.name()
'P2WSH-In-P2SH'
>>> address: str = P2WSHInP2SHAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'3DsBoAQ5ZbzuZrXRmJmErWiyp4eLi1DrAs'
>>> P2WSHInP2SHAddress.decode(address=address)
'858de90e467c7297565d9d86e9ea77e14f9b6ece'
- class hdwallet.addresses.ripple.RippleAddress¶
- static name() str¶
Return the name of the cryptocurrency, which is “Ripple”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
>>> from hdwallet.addresses.ripple import RippleAddress
>>> RippleAddress.name()
'Ripple'
>>> address: str = RippleAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'rLrFeQYUiiMPRPbbT97UX258KtczS5ekmy'
>>> RippleAddress.decode(address=address)
'd0922970a0d10b34833d306246258260cc51ffbb'
- class hdwallet.addresses.solana.SolanaAddress¶
- static name() str¶
Return the name of the cryptocurrency, which is “Solana”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a Solana address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode. It can be a bytes object, a string, or an IPublicKey instance.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded Solana address as a string.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a Solana address back into its corresponding public key.
- Parameters:
address (str) – The Solana address to decode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The decoded public key as a string.
- Return type:
str
>>> from hdwallet.addresses.solana import SolanaAddress
>>> SolanaAddress.name()
'Solana'
>>> address: str = SolanaAddress.encode(public_key="00d14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d")
>>> address
'F5vdvUASQmeL76F62X4ff7uR3EQegeCibH7M72pY2qK2'
>>> SolanaAddress.decode(address=address)
'd14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d'
- class hdwallet.addresses.stellar.StellarAddress¶
- static name() str¶
Return the name of the cryptocurrency, which is “Stellar”.
- Returns:
The name of the cryptocurrency.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a Stellar address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - address_type: Type of the Stellar address (optional).
- Returns:
The encoded Stellar address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a Stellar address back into its public key representation.
- Parameters:
address (str) – The Stellar address to decode.
kwargs (Any) – Additional keyword arguments. - address_type: Type of the Stellar address (optional).
- Returns:
The decoded public key as a string.
- Return type:
str
>>> from hdwallet.addresses.stellar import StellarAddress
>>> StellarAddress.name()
'Stellar'
>>> address: str = StellarAddress.encode(public_key="00d14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d")
>>> address
'SDIUNFSYH3URISDYMNNVK7KRLJICWBBWNAMN7Z3WK43XI22PK6LY2GKP'
>>> StellarAddress.decode(address=address)
'd14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d'
- class hdwallet.addresses.sui.SuiAddress¶
- static name() str¶
Return the name “Sui”.
- Returns:
The string “Sui”.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a string format using a specific hashing algorithm.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode, can be bytes, string, or an IPublicKey object.
kwargs (Any) – Additional keyword arguments.
- Returns:
The encoded address as a string.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode an address string and validate its format.
- Parameters:
address (str) – The address string to decode.
kwargs (Any) – Additional keyword arguments.
- Returns:
The decoded address string.
- Return type:
str
>>> from hdwallet.addresses.sui import SuiAddress
>>> SuiAddress.name()
'Sui'
>>> address: str = SuiAddress.encode(public_key="00d14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d")
>>> address
'0xdff86ae2063acd23c139b94598d8b4b7347bd9794c301bbaeeea12fe6b330178'
>>> SuiAddress.decode(address=address)
'dff86ae2063acd23c139b94598d8b4b7347bd9794c301bbaeeea12fe6b330178'
- class hdwallet.addresses.tezos.TezosAddress¶
- static name() str¶
Get the name of the blockchain protocol.
- Returns:
The name of the blockchain protocol.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a Tezos address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode.
kwargs (Any) – Additional keyword arguments. - address_prefix: Address prefix (optional).
- Returns:
The encoded Tezos address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a Tezos address into its raw form.
- Parameters:
address (str) – The Tezos address to decode.
kwargs (Any) – Additional keyword arguments. - address_prefix: Address prefix (optional).
- Returns:
The decoded raw bytes of the Tezos address.
- Return type:
str
>>> from hdwallet.addresses.tezos import TezosAddress
>>> TezosAddress.name()
'Tezos'
>>> address: str = TezosAddress.encode(public_key="00d14696583ee9144878635b557d515a502b04366818dfe7765737746b4f57978d")
>>> address
'tz1PBvuXpgELdV3JuNYwbd5DXHWvrj9gS5JJ'
>>> TezosAddress.decode(address=address)
'26f0dbb538759db4e8256a6f11ba88ec9c214f11'
- class hdwallet.addresses.tron.TronAddress¶
- static name() str¶
Return the name associated with the Tron blockchain protocol.
- Returns:
The name “Tron”.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a Tron blockchain address.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode, which can be bytes, str, or IPublicKey.
kwargs (Any) – Additional keyword arguments.
- Returns:
Encoded Tron blockchain address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a Tron blockchain address back to its public key representation.
- Parameters:
address (str) – The Tron blockchain address to decode.
kwargs (Any) – Additional keyword arguments.
- Returns:
Decoded public key.
- Return type:
str
>>> from hdwallet.addresses.tron import TronAddress
>>> TronAddress.name()
'Tron'
>>> address: str = TronAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'TWgzbxurHnC2TFQF5FfE3KPexrDKSK4nej'
>>> TronAddress.decode(address=address)
'e349a2f7df70161e529e4c2982828a50c20ffdab'
- class hdwallet.addresses.xinfin.XinFinAddress¶
- static name() str¶
Return the name associated with the XinFin blockchain.
- Returns:
The name “XinFin”.
- Return type:
str
>>> from hdwallet.addresses.xinfin import XinFinAddress
>>> XinFinAddress.name()
'XinFin'
>>> address: str = XinFinAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'xdce349A2f7dF70161e529E4C2982828A50c20FfDaB'
>>> XinFinAddress.decode(address=address)
'e349a2f7df70161e529e4c2982828a50c20ffdab'
- class hdwallet.addresses.zilliqa.ZilliqaAddress¶
- static name() str¶
Return the name associated with the Zilliqa blockchain.
- Returns:
The name “Zilliqa”.
- Return type:
str
- classmethod encode(public_key: bytes | str | IPublicKey, **kwargs: Any) str¶
Encode a public key into a Zilliqa address using Bech32 encoding.
- Parameters:
public_key (Union[bytes, str, IPublicKey]) – The public key to encode, which can be bytes, str, or an IPublicKey object.
kwargs – Additional keyword arguments: - hrp (str, optional): Human-readable part for the Bech32 encoding. Defaults to cls.hrp.
- Returns:
Encoded Zilliqa address.
- Return type:
str
- classmethod decode(address: str, **kwargs: Any) str¶
Decode a Zilliqa address from Bech32 encoding.
- Parameters:
address (str) – The Zilliqa address to decode.
kwargs – Additional keyword arguments: - hrp (str, optional): Human-readable part for the Bech32 encoding. Defaults to cls.hrp.
- Returns:
Decoded Zilliqa address.
- Return type:
str
>>> from hdwallet.addresses.zilliqa import ZilliqaAddress
>>> ZilliqaAddress.name()
'Zilliqa'
>>> address: str = ZilliqaAddress.encode(public_key="0374a436044b4904bbd7a074b098d65fad39fc5b66f28da8440f10dbcf86568429")
>>> address
'zil1ahp99dssuhwz8mccwetm5m4gkh528wzw9lwdcf'
>>> ZilliqaAddress.decode(address=address)
'edc252b610e5dc23ef187657ba6ea8b5e8a3b84e'