XRPL Address Codec¶
Functions for encoding and decoding XRP Ledger addresses and seeds.
- exception xrpl.core.addresscodec.XRPLAddressCodecException¶
Bases:
xrpl.constants.XRPLException
General XRPL Address Codec Exception.
- xrpl.core.addresscodec.classic_address_to_xaddress(classic_address: str, tag: Optional[int], is_test_network: bool) str ¶
Returns the X-Address representation of the data.
- Parameters
classic_address – The base58 encoding of the classic address.
tag – The destination tag.
is_test_network – Whether it is the test network or the main network.
- Returns
The X-Address representation of the data.
- Raises
XRPLAddressCodecException – If the classic address does not have enough bytes or the tag is invalid.
- xrpl.core.addresscodec.decode_account_public_key(account_public_key: str) bytes ¶
Returns the decoded bytes of the account public key.
- Parameters
account_public_key – Account public key to be decoded.
- Returns
The decoded bytes of the account public key.
- xrpl.core.addresscodec.decode_classic_address(classic_address: str) bytes ¶
Returns the decoded bytes of the classic address.
- Parameters
classic_address – Classic address to be decoded.
- Returns
The decoded bytes of the classic address.
- xrpl.core.addresscodec.decode_node_public_key(node_public_key: str) bytes ¶
Returns the decoded bytes of the node public key
- Parameters
node_public_key – Node public key to be decoded.
- Returns
The decoded bytes of the node public key.
- xrpl.core.addresscodec.decode_seed(seed: str) Tuple[bytes, xrpl.constants.CryptoAlgorithm] ¶
Returns (decoded seed, its algorithm).
- Parameters
seed – b58 encoding of a seed.
- Returns
(decoded seed, its algorithm).
- Raises
XRPLAddressCodecException – If the seed is invalid.
- xrpl.core.addresscodec.encode_account_public_key(bytestring: bytes) str ¶
Returns the account public key encoding of these bytes as a base58 string.
- Parameters
bytestring – Bytes to be encoded.
- Returns
The account public key encoding of these bytes as a base58 string.
- xrpl.core.addresscodec.encode_classic_address(bytestring: bytes) str ¶
Returns the classic address encoding of these bytes as a base58 string.
- Parameters
bytestring – Bytes to be encoded.
- Returns
The classic address encoding of these bytes as a base58 string.
- xrpl.core.addresscodec.encode_node_public_key(bytestring: bytes) str ¶
Returns the node public key encoding of these bytes as a base58 string.
- Parameters
bytestring – Bytes to be encoded.
- Returns
The node public key encoding of these bytes as a base58 string.
- xrpl.core.addresscodec.encode_seed(entropy: bytes, encoding_type: xrpl.constants.CryptoAlgorithm) str ¶
Returns an encoded seed.
- Parameters
entropy – Entropy bytes of SEED_LENGTH.
encoding_type – Either ED25519 or SECP256K1.
- Returns
An encoded seed.
- Raises
XRPLAddressCodecException – If entropy is not of length SEED_LENGTH or the encoding type is not one of CryptoAlgorithm.
- xrpl.core.addresscodec.is_valid_classic_address(classic_address: str) bool ¶
Returns whether classic_address is a valid classic address.
- Parameters
classic_address – The classic address to validate.
- Returns
Whether classic_address is a valid classic address.
- xrpl.core.addresscodec.is_valid_xaddress(xaddress: str) bool ¶
Returns whether
xaddress
is a valid X-Address.- Parameters
xaddress – The X-Address to check for validity.
- Returns
Whether
xaddress
is a valid X-Address.
- xrpl.core.addresscodec.xaddress_to_classic_address(xaddress: str) Tuple[str, Optional[int], bool] ¶
Returns a tuple containing the classic address, tag, and whether the address is on a test network for an X-Address.
- Parameters
xaddress – base58-encoded X-Address.
- Returns
classic_address: the base58 classic address tag: the destination tag is_test_network: whether the address is on the test network (or main)
- Return type
A tuple containing