Skip to content

Wallet Interface

MoneroWallet

Base wallet with default implementations.

DEFAULT_LANGUAGE: str instance-attribute

Default Monero wallet seed language.

__init__()

Initialize a Monero wallet.

add_address_book_entry(address, description)

Add an address book entry.

Parameters:

Name Type Description Default
address str

is the entry address.

required
description str

is the entry description (optional).

required

Returns:

Type Description
int

the index of the added entry.

add_listener(listener)

Register a listener receive wallet notifications.

Parameters:

Name Type Description Default
listener MoneroWalletListener

is the listener to receive wallet notifications.

required

change_password(old_password, new_password)

Change the wallet password.

Parameters:

Name Type Description Default
old_password str

is the wallet's old password.

required
new_password str

is the wallet's new password.

required

check_reserve_proof(address, message, signature)

Proves a wallet has a disposable reserve using a signature.

Parameters:

Name Type Description Default
address str

is the public wallet address.

required
message str

is a message included with the signature to further authenticate the proof (optional).

required
signature str

is the reserve proof signature to check.

required

Returns:

Type Description
MoneroCheckReserve

the result of checking the signature proof.

check_spend_proof(tx_hash, message, signature)

Prove a spend using a signature. Unlike proving a transaction, it does not require the destination public address.

Parameters:

Name Type Description Default
tx_hash str

specifies the transaction to prove.

required
message str

is a message included with the signature to further authenticate the proof (optional).

required
signature str

is the transaction signature to confirm.

required

Returns:

Type Description
bool

True if the signature is good, False otherwise.

check_tx_key(tx_hash, tx_key, address)

Check a transaction in the blockchain with its secret key.

Parameters:

Name Type Description Default
tx_hash str

specifies the transaction to check.

required
tx_key str

is the transaction's secret key.

required
address str

is the destination public address of the transaction.

required

Returns:

Type Description
MoneroCheckTx

the result of the check.

check_tx_proof(tx_hash, address, message, signature)

Prove a transaction by checking its signature.

Parameters:

Name Type Description Default
tx_hash str

specifies the transaction to prove.

required
address str

is the destination public address of the transaction.

required
message str

is a message included with the signature to further authenticate the proof (optional).

required
signature str

is the transaction signature to confirm.

required

Returns:

Type Description
MoneroCheckTx

the result of the check.

close(save=False)

Optionally save then close the wallet.

Parameters:

Name Type Description Default
save bool

specifies if the wallet should be saved before being closed (default False).

False

create_account(label='')

Create a new account with a label for the first subaddress.

Parameters:

Name Type Description Default
label str

specifies the label for the account's first subaddress (optional).

''

Returns:

Type Description
MoneroAccount

the created account.

create_subaddress(account_idx, label='')

Create a subaddress within an account.

Parameters:

Name Type Description Default
account_idx int

specifies the index of the account to create the subaddress within.

required
label str

specifies the the label for the subaddress (defaults to empty string).

''

Returns:

Type Description
MoneroSubaddress

the created subaddress.

create_tx(config)

Create a transaction to transfer funds from this wallet.

Parameters:

Name Type Description Default
config MoneroTxConfig

configures the transaction to create.

required

Returns:

Type Description
MoneroTxWallet

the created transaction.

create_txs(config)

Create one or more transactions to transfer funds from this wallet.

Parameters:

Name Type Description Default
config MoneroTxConfig

configures the transactions to create.

required

Returns:

Type Description
list[MoneroTxWallet]

the created transactions.

decode_integrated_address(integrated_address)

Decode an integrated address to get its standard address and payment id.

Parameters:

Name Type Description Default
integrated_address str

is an integrated address to decode.

required

Returns:

Type Description
MoneroIntegratedAddress

the decoded integrated address including standard address and payment id.

delete_address_book_entry(index)

Delete an address book entry.

Parameters:

Name Type Description Default
index int

is the index of the entry to delete.

required

describe_multisig_tx_set(multisig_tx_hex)

Describe a tx set containing unsigned or multisig tx hex to a new tx set containing structured transactions.

Parameters:

Name Type Description Default
multisig_tx_hex str

multisig tx hex.

required

Returns:

Type Description
MoneroTxSet

the tx set containing structured transactions.

describe_tx_set(tx_set)

Describes a tx set containing unsigned or multisig tx hex to a new tx set containing structured transactions.

Parameters:

Name Type Description Default
tx_set MoneroTxSet

is a tx set containing unsigned or multisig tx hex.

required

Returns:

Type Description
MoneroTxSet

the tx set containing structured transactions.

describe_unsigned_tx_set(unsigned_tx_hex)

Describe a tx set from unsigned tx hex.

Parameters:

Name Type Description Default
unsigned_tx_hex str

unsigned tx hex.

required

Returns:

Type Description
MoneroTxSet

the tx set containing structured transactions.

edit_address_book_entry(index, set_address, address, set_description, description)

Edit an address book entry.

Parameters:

Name Type Description Default
index int

is the index of the address book entry to edit.

required
set_address bool

specifies if the address should be updated.

required
address str

is the updated address.

required
set_description bool

specifies if the description should be updated.

required
description str

is the updated description.

required

exchange_multisig_keys(multisig_hexes, password)

Exchange multisig hex with participants in a M/N multisig wallet.

This process must be repeated with participants exactly N-M times.

Parameters:

Name Type Description Default
multisig_hexes list[str]

are multisig hex from each participant.

required
password str

is the wallet's password (TODO monero-project: redundant? wallet is created with password).

required

Returns:

Type Description
MoneroMultisigInitResult

the result which has the multisig's address xor this wallet's multisig hex to share with participants if not done.

export_key_images(all=False)

Export signed key images.

Parameters:

Name Type Description Default
all bool

export all key images if True, else export key images since the last export.

False

Returns:

Type Description
list[MoneroKeyImage]

the wallet's signed key images.

export_multisig_hex()

Export this wallet's multisig info as hex for other participants.

Returns:

Type Description
str

this wallet's multisig info as hex for other participants.

export_outputs(all=False)

Export outputs in hex format.

Parameters:

Name Type Description Default
all bool

export all outputs if True, else export outputs since the last export.

False

Returns:

Type Description
str

outputs in hex format, empty string if no outputs.

freeze_output(key_image)

Freeze an output.

Parameters:

Name Type Description Default
key_image str

key image of the output to freeze.

required

get_account_tags()

Return all account tags.

Returns:

Type Description
list[MoneroAccountTag]

the wallet's account tags.

get_address(account_idx, subaddress_idx)

Get the address of a specific subaddress.

Parameters:

Name Type Description Default
account_idx int

specifies the account index of the address's subaddress.

required
subaddress_idx int

specifies the subaddress index within the account.

required

Returns:

Type Description
str

the receive address of the specified subaddress.

get_address_index(address)

Get the account and subaddress index of the given address.

Parameters:

Name Type Description Default
address str

is the address to get the account and subaddress index from.

required

Returns:

Type Description
MoneroSubaddress

the account and subaddress indices.

Raises:

Type Description
MoneroError

exception if address is not a wallet address.

get_attribute(key)

Get an attribute.

Parameters:

Name Type Description Default
key str

is the attribute to get the value of.

required

Returns:

Type Description
str

attribute's value.

get_daemon_connection()

Get the wallet's daemon connection.

Returns:

Type Description
MoneroRpcConnection | None

the wallet's daemon connection.

get_daemon_height()

Get the height that the wallet's daemon is synced to.

Returns:

Type Description
int

the height that the wallet's daemon is synced to.

get_daemon_max_peer_height()

Get the maximum height of the peers the wallet's daemon is connected to.

Returns:

Type Description
int

the maximum height of the peers the wallet's daemon is connected to.

get_default_fee_priority()

Get the current default fee priority (unimportant, normal, elevated, etc).

Returns:

Type Description
MoneroTxPriority

the current fee priority.

get_height()

Get the height of the last block processed by the wallet (its index + 1).

Returns:

Type Description
int

the height of the last block processed by the wallet.

get_height_by_date(year, month, day)

Get the blockchain's height by date as a conservative estimate for scanning.

Parameters:

Name Type Description Default
year int

year of the height to get.

required
month int

month of the height to get as a number between 1 and 12.

required
day int

day of the height to get as a number between 1 and 31.

required

Returns:

Type Description
int

the blockchain's approximate height at the given date.

get_integrated_address(standard_address='', payment_id='')

Get an integrated address from a standard address and a payment id.

Parameters:

Name Type Description Default
standard_address str

is the integrated addresse's standard address (defaults to wallet's primary address).

''
payment_id str

is the integrated addresse's payment id (defaults to randomly generating new payment id).

''

Returns:

Type Description
MoneroIntegratedAddress

the integrated address.

get_listeners()

Get the listeners registered with the wallet.

Returns:

Type Description
list[MoneroWalletListener]

List of listener registered with the wallet.

get_multisig_info()

Get multisig info about this wallet.

Returns:

Type Description
MoneroMultisigInfo

multisig info about this wallet.

get_network_type()

Get the wallet's network type (mainnet, testnet, or stagenet).

Returns:

Type Description
MoneroNetworkType

the wallet's network type.

get_new_key_images_from_last_import()

Get new key images from the last imported outputs.

Returns:

Type Description
list[MoneroKeyImage]

the key images from the last imported outputs.

get_path()

Get the path of this wallet's file on disk.

Returns:

Type Description
str

the path of this wallet's file on disk.

get_payment_uri(config)

Creates a payment URI from a tx configuration.

Parameters:

Name Type Description Default
config MoneroTxConfig

specifies configuration for a potential tx.

required

Returns:

Type Description
str

is the payment uri.

get_primary_address()

Get the wallet's primary address.

Returns:

Type Description
str

the wallet's primary address.

get_private_spend_key()

Get the wallet's private spend key.

Returns:

Type Description
str

the wallet's private spend key.

get_private_view_key()

Get the wallet's private view key.

Returns:

Type Description
str

the wallet's private view key.

get_public_spend_key()

Get the wallet's public spend key.

Returns:

Type Description
str

the wallet's public spend key.

get_public_view_key()

Get the wallet's public view key.

Returns:

Type Description
str

the wallet's public view key.

get_reserve_proof_account(account_idx, amount, message)

Generate a signature to prove an available amount in an account.

Parameters:

Name Type Description Default
account_idx int

specifies the account to prove ownership of the amount.

required
amount int

is the minimum amount to prove as available in the account.

required
message str

is a message to include with the signature to further authenticate the proof (optional).

required

Returns:

Type Description
str

the reserve proof signature.

get_reserve_proof_wallet(message)

Generate a signature to prove the entire balance of the wallet.

Parameters:

Name Type Description Default
message str

is a message included with the signature to further authenticate the proof (optional).

required

Returns:

Type Description
str

the reserve proof signature.

get_restore_height()

Get the height of the first block that the wallet scans.

Returns:

Type Description
int

the height of the first block that the wallet scans.

get_seed()

Get the wallet's mnemonic phrase or seed.

Returns:

Type Description
str

the wallet's mnemonic phrase or seed.

get_seed_language()

Get the language of the wallet's mnemonic phrase or seed.

Returns:

Type Description
str

the language of the wallet's mnemonic phrase or seed.

get_spend_proof(tx_hash, message='')

Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address.

Parameters:

Name Type Description Default
tx_hash str

specifies the transaction to prove.

required
message str

is a message to include with the signature to further authenticate the proof (optional).

''

Returns:

Type Description
str

the transaction signature.

get_subaddress(account_idx, subaddress_idx)

Get a subaddress.

Parameters:

Name Type Description Default
account_idx int

specifies the index of the subaddress's account.

required
subaddress_idx int

specifies index of the subaddress within the account.

required

Returns:

Type Description
MoneroSubaddress

the retrieved subaddress.

get_tx(tx_hash)

Get single wallet transaction by hash.

Parameters:

Name Type Description Default
tx_hash str

Transaction hash.

required

Returns:

Type Description
MoneroTxWallet | None

wallet transaction.

get_tx_key(tx_hash)

Get a transaction's secret key from its hash.

Parameters:

Name Type Description Default
tx_hash str

is the transaction's hash.

required

Returns:

Type Description
str

is the transaction's secret key.

get_tx_note(tx_hash)

Get a transaction note.

Parameters:

Name Type Description Default
tx_hash str

specifies the transaction to get the note of.

required

Returns:

Type Description
str

the tx note.

get_tx_notes(tx_hashes)

Get notes for multiple transactions.

Parameters:

Name Type Description Default
tx_hashes list[str]

identify the transactions to get notes for.

required

Returns:

Type Description
list[str]

notes for the transactions.

get_tx_proof(tx_hash, address, message='')

Get a transaction signature to prove it.

Parameters:

Name Type Description Default
tx_hash str

specifies the transaction to prove.

required
address str

is the destination public address of the transaction.

required
message str

is a message to include with the signature to further authenticate the proof (optional).

''

Returns:

Type Description
str

the transaction signature.

get_version()

Get the wallet's version.

Returns:

Type Description
MoneroVersion

the wallet's version.

import_key_images(key_images)

Import signed key images and verify their spent status.

Parameters:

Name Type Description Default
key_images list[MoneroKeyImage]

are key images to import and verify (requires hex and signature).

required

Returns:

Type Description
MoneroKeyImageImportResult

results of the import.

import_multisig_hex(multisig_hexes)

Import multisig info as hex from other participants.

Note: If the daemon is not trusted, this method will not automatically update the spent status after importing peer multisig hex.

Parameters:

Name Type Description Default
multisig_hexes list[str]

are multisig hex from each participant.

required

Returns:

Type Description
int

the number of outputs signed with the given multisig hex.

import_outputs(outputs_hex)

Import outputs in hex format.

Parameters:

Name Type Description Default
outputs_hex str

are outputs in hex format.

required

Returns:

Type Description
int

the number of outputs imported.

is_closed()

Indicates if the wallet is closed.

Returns:

Type Description
bool

True if the wallet is closed, False otherwise.

is_connected_to_daemon()

Indicates if the wallet is connected a daemon.

Returns:

Type Description
bool

True if the wallet is connected to daemon, False otherwise.

is_daemon_trusted()

Indicates if the daemon is trusted or untrusted.

Returns:

Type Description
bool

True if the daemon is trusted, False otherwise.

is_multisig()

Indicates if this wallet is a multisig wallet.

Returns:

Type Description
bool

True if this is a multisig wallet, False otherwise.

is_multisig_import_needed()

Indicates if importing multisig data is needed for returning a correct balance.

Returns:

Type Description
bool

True if importing multisig data is needed for returning a correct balance, False otherwise.

is_output_frozen(key_image)

Check if an output is frozen.

Parameters:

Name Type Description Default
key_image str

key image of the output to check if frozen.

required

Returns:

Type Description
bool

True if the output is frozen, False otherwise.

is_synced()

Indicates if the wallet is synced with the daemon.

Returns:

Type Description
bool

True if the wallet is synced with the daemon, False otherwise.

is_view_only()

Indicates if the wallet is view-only, meaning it does have the private spend key and can therefore only observe incoming outputs.

Returns:

Type Description
bool

True if the wallet is view-only, False otherwise.

make_multisig(multisig_hexes, threshold, password)

Make this wallet multisig by importing multisig hex from participants.

Parameters:

Name Type Description Default
multisig_hexes list[str]

are multisig hex from each participant.

required
threshold int

is the number of signatures needed to sign transfers.

required
password str

is the wallet password.

required

Returns:

Type Description
str

this wallet's multisig hex to share with participants.

move_to(path, password)

Move the wallet from its current path to the given path.

Parameters:

Name Type Description Default
path str

is the new wallet's path.

required
password str

is the new wallet's password.

required

parse_payment_uri(uri)

Parses a payment URI to a tx configuration.

Parameters:

Name Type Description Default
uri str

is the payment uri to parse.

required

Returns:

Type Description
MoneroTxConfig

the tx configuration parsed from the uri.

prepare_multisig()

Get multisig info as hex to share with participants to begin creating a multisig wallet.

Returns:

Type Description
str

this wallet's multisig hex to share with participants.

remove_listener(listener)

Unregister a listener to receive wallet notifications.

Parameters:

Name Type Description Default
listener MoneroWalletListener

is the listener to unregister.

required

rescan_blockchain()

Rescan the blockchain from scratch, losing any information which cannot be recovered from the blockchain itself.

WARNING: This method discards local wallet data like destination addresses, tx secret keys, tx notes, etc.

rescan_spent()

Rescan the blockchain for spent outputs.

Note: this can only be called with a trusted daemon.

Example use case: peer multisig hex is import when connected to an untrusted daemon, so the wallet will not rescan spent outputs. Then the wallet connects to a trusted daemon. This method should be manually invoked to rescan outputs.

save()

Save the wallet at its current path.

scan_txs(tx_hashes)

Scan transactions by their hash/id.

Parameters:

Name Type Description Default
tx_hashes list[str]

tx hashes to scan.

required

set_account_label(account_idx, label)

Set a human-readable description for an account.

Parameters:

Name Type Description Default
account_idx int

account index.

required
label str

is the label to set.

required

set_account_tag_label(tag, label)

Sets a human-readable description for a tag.

Parameters:

Name Type Description Default
tag str

is the tag to set a description for.

required
label str

is the label to set for the tag.

required

set_attribute(key, val)

Set an arbitrary attribute.

Parameters:

Name Type Description Default
key str

is the attribute key.

required
val str

is the attribute value.

required

set_restore_height(restore_height)

Set the height of the first block that the wallet scans.

Parameters:

Name Type Description Default
restore_height int

is the height of the first block that the wallet scans.

required

set_subaddress_label(account_idx, subaddress_idx, label='')

Set a subaddress label.

Parameters:

Name Type Description Default
account_idx int

index of the account to set the label for.

required
subaddress_idx int

index of the subaddress to set the label for.

required
label str

the label to set (default '').

''

set_tx_note(tx_hash, note)

Set a note for a specific transaction.

Parameters:

Name Type Description Default
tx_hash str

specifies the transaction.

required
note str

specifies the note.

required

set_tx_notes(tx_hashes, notes)

Set notes for multiple transactions.

Parameters:

Name Type Description Default
tx_hashes list[str]

specify the transactions to set notes for.

required
notes list[str]

are the notes to set for the transactions.

required

sign_message(msg, signature_type, account_idx=0, subaddress_idx=0)

Sign a message.

Parameters:

Name Type Description Default
msg str

the message to sign.

required
signature_type MoneroMessageSignatureType

sign with spend key or spend key.

required
account_idx int

the account index of the message signature (default 0).

0
subaddress_idx int

the subaddress index of the message signature (default 0).

0

Returns:

Type Description
str

the message signature.

sign_multisig_tx_hex(multisig_tx_hex)

Sign previously created multisig transactions as represented by hex.

Parameters:

Name Type Description Default
multisig_tx_hex str

is the hex shared among the multisig transactions when they were created.

required

Returns:

Type Description
MoneroMultisigSignResult

the result of signing the multisig transactions.

sign_txs(unsigned_tx_hex)

Sign unsigned transactions from a view-only wallet.

Parameters:

Name Type Description Default
unsigned_tx_hex str

is unsigned transaction hex from when the transactions were created.

required

Returns:

Type Description
MoneroTxSet

the signed transaction set.

start_mining(num_threads=None, background_mining=None, ignore_battery=None)

Start mining.

Parameters:

Name Type Description Default
num_threads Optional[int]

is the number of threads created for mining (default None).

None
background_mining Optional[bool]

specifies if mining should occur in the background (default None).

None
ignore_battery Optional[bool]

specifies if the battery should be ignored for mining (default None).

None

start_syncing(sync_period_in_ms=10000)

Start background synchronizing with a maximum period between syncs.

Parameters:

Name Type Description Default
sync_period_in_ms int

maximum period between syncs in milliseconds.

10000

stop_mining()

Stop mining.

stop_syncing()

Stop the asynchronous thread to continuously synchronize the wallet with the daemon.

submit_multisig_tx_hex(signed_multisig_tx_hex)

Submit signed multisig transactions as represented by a hex string.

Parameters:

Name Type Description Default
signed_multisig_tx_hex str

is the signed multisig hex returned from sign_multisig_txs().

required

Returns:

Type Description
list[str]

the resulting transaction hashes.

submit_txs(signed_tx_hex)

Submit signed transactions from a view-only wallet.

Parameters:

Name Type Description Default
signed_tx_hex str

is signed transaction hex from sign_txs().

required

Returns:

Type Description
list[str]

the resulting transaction hashes.

sweep_dust(relay=False)

Sweep all unmixable dust outputs back to the wallet to make them easier to spend and mix.

Parameters:

Name Type Description Default
relay bool

specifies if the resulting transaction should be relayed (default False).

False

Returns:

Type Description
list[MoneroTxWallet]

the created transactions.

sweep_output(config)

Sweep an output with a given key image.

Parameters:

Name Type Description Default
config MoneroTxConfig

configures the sweep transaction.

required

Returns:

Type Description
MoneroTxWallet

the created transaction.

sweep_unlocked(config)

Sweep unlocked funds according to the given config.

Parameters:

Name Type Description Default
config MoneroTxConfig

is the sweep configuration.

required

Returns:

Type Description
list[MoneroTxWallet]

the created transactions.

tag_accounts(tag, account_indices)

Tag accounts.

Parameters:

Name Type Description Default
tag str

is the tag to apply to the specified accounts.

required
account_indices list[int]

are the indices of the accounts to tag.

required

thaw_output(key_image)

Thaw a frozen output.

Parameters:

Name Type Description Default
key_image str

key image of the output to thaw.

required

untag_accounts(account_indices)

Untag acconts.

Parameters:

Name Type Description Default
account_indices list[int]

are the indices of the accounts to untag.

required

verify_message(msg, address, signature)

Verify a message signature.

Parameters:

Name Type Description Default
msg str

the signed message.

required
address str

signing address.

required
signature str

signature.

required

Returns:

Type Description
MoneroMessageSignatureResult

the message signature result.

wait_for_next_block()

Wait for the next block to be added to the chain.

Returns:

Type Description
int

the height of the next block when it is added to the chain.