Wallet Methods

Methods for working with XRPL wallets.

class xrpl.wallet.Wallet(seed: str, sequence: int, *, algorithm: Optional[CryptoAlgorithm] = None)

Bases: object

The cryptographic keys needed to control an XRP Ledger account. See Cryptographic Keys for details.

algorithm

The algorithm that is used to convert the seed into its public/private keypair.

classic_address

The address that publicly identifies this wallet, as a base58 string.

classmethod create(crypto_algorithm: CryptoAlgorithm = CryptoAlgorithm.ED25519) Wallet

Generates a new seed and Wallet.

Parameters:

crypto_algorithm – The key-generation algorithm to use when generating the seed. The default is Ed25519.

Returns:

The wallet that is generated from the given seed.

get_xaddress(*, tag: Optional[int] = None, is_test: bool = False) str

Returns the X-Address of the Wallet’s account.

Parameters:
  • tag – the destination tag of the address. Defaults to None.

  • is_test – whether the address corresponds to an address on the test network.

Returns:

The X-Address of the Wallet’s account.

private_key

The private key that is used to create signatures, as a hexadecimal string. MUST be kept secret!

public_key

The public key that is used to identify this wallet’s signatures, as a hexadecimal string.

seed

The core value that is used to derive all other information about this wallet. MUST be kept secret!

sequence

The next available sequence number to use for transactions from this wallet. Must be updated by the user. Increments on the ledger with every successful transaction submission, and stays the same with every failed transaction submission.

exception xrpl.wallet.XRPLFaucetException

Bases: XRPLException

Faucet generation exception.

xrpl.wallet.generate_faucet_wallet(client: SyncClient, wallet: Optional[Wallet] = None, debug: bool = False, faucet_host: Optional[str] = None, usage_context: Optional[str] = None) Wallet

Generates a random wallet and funds it using the XRPL Testnet Faucet.

Parameters:
  • client – the network client used to make network calls.

  • wallet – the wallet to fund. If omitted or None, a new wallet is created.

  • debug – Whether to print debug information as it creates the wallet.

  • faucet_host – A custom host to use for funding a wallet. In environments other than devnet and testnet, this parameter is required.

  • usage_context – The intended use case for the funding request (for example, testing). This information will be included in json body of the HTTP request to the faucet.

Returns:

A Wallet on the testnet that contains some amount of XRP.

Raises: