diff --git a/.gitignore b/.gitignore index a0d03be..7f380ca 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ test_wallets .idea .codacy coverage* -.coverage \ No newline at end of file +.coverage +.cache \ No newline at end of file diff --git a/README.md b/README.md index f711ce3..6b41a64 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ A Python library for creating Monero applications using RPC and Python bindings * Supports wallet and daemon RPC clients. * Supports client-side wallets using Python bindings. * Supports multisig, view-only, and offline wallets. -* Wallet types are interchangeable by conforming to a [common interface](https://woodser.github.io/monero-java/javadocs/monero/wallet/MoneroWallet.html). +* Wallet types are interchangeable by conforming to a [common interface](https://everoddandeven.github.io/monero-python/mkdocs/public/api/wallet/). * Uses a clearly defined [data model and API specification](https://github.com/everoddandeven/monero-python/blob/main/docs/monero-spec.pdf) intended to be intuitive and robust. * Query wallet transactions, transfers, and outputs by their properties. * Fetch and process binary data from the daemon (e.g. raw blocks). @@ -31,7 +31,7 @@ A Python library for creating Monero applications using RPC and Python bindings

Build Python
- applications using RPC or Python bindings to monero-project/monero. Wallet implementations are interchangeable by conforming to a common interface, MoneroWallet.
+ applications using RPC or Python bindings to monero-project/monero. Wallet implementations are interchangeable by conforming to a common interface, MoneroWallet.
+ 
+

MoneroRpcConnection ¶ Bases: SerializableStruct
Models a connection to a daemon.
password: str | None property ¶Connection authentication password.
priority: int instance-attribute ¶Connection priority.
proxy_uri: str | None instance-attribute ¶Connection proxy address.
response_time: int | None property ¶Connection response time in milliseconds.
timeout: int instance-attribute ¶Connection timeout (milliseconds).
uri: str | None instance-attribute ¶Connection uri.
username: str | None property ¶Connection authentication username.
zmq_uri: str | None instance-attribute ¶ZMQ connection uri.
before(c1, c2, current_connection) staticmethod ¶Compare RPC connections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c1 | MoneroRpcConnection | connection. | required |
c2 | MoneroRpcConnection | other connection. | required |
current_connection | MoneroRpcConnection | current connection. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
check_connection(timeout_ms=20000) ¶Check the connection and update online, authentication, and response time status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout_ms | int | the maximum response time before considered offline. | 20000 |
Returns:
| Type | Description |
|---|---|
bool |
|
get_attribute(key) ¶Returns RPC connection attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key | str | attribute key. | required |
Returns:
| Type | Description |
|---|---|
str | attribute value. |
is_authenticated() ¶Indicates if the connection is authenticated according to the last call to check_connection().
Note: must call check_connection() manually.
Returns:
| Type | Description |
|---|---|
bool | None |
|
is_connected() ¶Indicates if the connection is connected according to the last call to check_connection().
Note: must call check_connection() manually.
Returns:
| Type | Description |
|---|---|
bool | None |
|
is_i2p() ¶Indicates if the connection is a I2P connection.
Returns:
| Type | Description |
|---|---|
bool |
|
is_onion() ¶Indicates if the connection is a TOR connection.
Returns:
| Type | Description |
|---|---|
bool |
|
is_online() ¶Indicates if the connection is online according to the last call to check_connection().
Note: must call check_connection() manually.
Returns:
| Type | Description |
|---|---|
bool | None |
|
send_binary_request(method, parameters=None) ¶Send a binary RPC request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method | str | is the path of the binary RPC method to invoke. | required |
parameters | Optional[object] | are the request parameters (default | None |
Returns:
| Type | Description |
|---|---|
str | None | the request's deserialized binary response. |
send_json_request(method, parameters=None) ¶Send a request to the JSON-RPC API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method | str | is the method to request. | required |
parameters | Optional[object] | are the request's input parameters (default | None |
Returns:
| Type | Description |
|---|---|
object | None | the RPC API response as a map. |
send_path_request(method, parameters=None) ¶Send a RPC request to the given path and with the given paramters.
E.g. /get_transactions with params.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method | str | is the url path of the request to invoke. | required |
parameters | Optional[object] | are request parameters sent in the body. | None |
Returns:
| Type | Description |
|---|---|
object | None | the request's deserialized response. |
set_attribute(key, value) ¶Set RPC connection attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key | str | key attribute. | required |
value | str | value attribute. | required |
set_credentials(username, password) ¶Set RPC connection credentials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username | str | username used for RPC authentication. | required |
password | str | passowrd user for RPC authentication. | required |
MoneroDaemon ¶Monero daemon interface.
__init__() ¶Initialize a Monero daemon.
add_listener(listener) ¶Register a listener to receive daemon notifications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
listener | MoneroDaemonListener | the listener to register. | required |
check_for_update() ¶Check for update.
Returns:
| Type | Description |
|---|---|
MoneroDaemonUpdateCheckResult | the result of the update check. |
download_update(path='') ¶Download an update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | download path. | '' |
Returns:
| Type | Description |
|---|---|
MoneroDaemonUpdateDownloadResult | the result of the update download. |
get_alt_block_hashes() ¶Get known block hashes which are not on the main chain.
Returns:
| Type | Description |
|---|---|
list[str] | known block hashes which are not on the main chain. |
get_alt_chains() ¶Get alternative chains seen by the node.
Returns:
| Type | Description |
|---|---|
list[MoneroAltChain] | alternative chains seen by the node. |
get_block_by_hash(hash) ¶Get a block by hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hash | str | is the hash of the block to get. | required |
Returns:
| Type | Description |
|---|---|
MoneroBlock | the block with the given hash. |
get_block_by_height(height) ¶Get a block by height.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height | int | is the height of the block to get. | required |
Returns:
| Type | Description |
|---|---|
MoneroBlock | the block at the given height. |
get_block_hash(height) ¶Get a block's hash by its height.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height | int | is the height of the block hash to get. | required |
Returns:
| Type | Description |
|---|---|
str | the block's hash at the given height. |
get_block_hashes(block_hashes, start_height) ¶Get block hashes as a binary request to the daemon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_hashes | list[str] | specify block hashes to fetch; first 10 blocks hash goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block. | required |
start_height | int | is the starting height of block hashes to return. | required |
Returns:
| Type | Description |
|---|---|
list[str] | the requested block hashes. |
get_block_header_by_hash(hash) ¶Get a block header by its hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hash | str | is the hash of the block to get the header of. | required |
Returns:
| Type | Description |
|---|---|
MoneroBlockHeader | the block's header. |
get_block_header_by_height(height) ¶Get a block header by its height.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height | int | is the height of the block to get the header of. | required |
Returns:
| Type | Description |
|---|---|
MoneroBlockHeader | the block's header. |
get_block_headers_by_range(start_height, end_height) ¶Get block headers for the given range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_height | int | is the start height lower bound inclusive (optional). | required |
end_height | int | is the end height upper bound inclusive (optional). | required |
Returns:
| Type | Description |
|---|---|
list[MoneroBlockHeader] | block headers in the given range. |
get_blocks_by_hash(block_hashes, start_height, prune) ¶Get a block by hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_hashes | list[str] | is the hash of the block to get. | required |
start_height | int | filter blocks by block height. | required |
prune | bool | prune hash. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroBlock] | the block with the given hash. |
get_blocks_by_height(heights) ¶Get blocks at the given heights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
heights | list[int] | are the heights of the blocks to get. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroBlock] | blocks at the given heights. |
get_blocks_by_range(start_height, end_height) ¶Get blocks in the given height range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_height | int | is the start height lower bound inclusive (optional). | required |
end_height | int | is the end height upper bound inclusive (optional). | required |
Returns:
| Type | Description |
|---|---|
list[MoneroBlock] | blocks in the given height range. |
get_blocks_by_range_chunked(start_height, end_height, max_chunk_size=None) ¶Get blocks in the given height range as chunked requests so that each request is not too big.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_height | int | is the start height lower bound inclusive (optional). | required |
end_height | int | is the end height upper bound inclusive (optional). | required |
max_chunk_size | int | is the maximum chunk size in any one request (default 3,000,000 bytes). | None |
Returns:
| Type | Description |
|---|---|
list[MoneroBlock] | blocks in the given height range. |
get_download_limit() ¶Get the download bandwidth limit.
Returns:
| Type | Description |
|---|---|
int | is the download bandwidth limit. |
get_fee_estimate(grace_blocks=0) ¶Get mining fee estimates per kB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grace_blocks | int | number of blocks we want the fee estimate to be valid for. | 0 |
Returns:
| Type | Description |
|---|---|
MoneroFeeEstimate | mining fee estimates per kB. |
get_hard_fork_info() ¶Look up information regarding hard fork voting and readiness.
Returns:
| Type | Description |
|---|---|
MoneroHardForkInfo | hard fork information. |
get_height() ¶Get the number of blocks in the longest chain known to the node.
Returns:
| Type | Description |
|---|---|
int | the number of blocks. |
get_info() ¶Get general information about the state of the node and the network.
Returns:
| Type | Description |
|---|---|
MoneroDaemonInfo | general information about the node and network. |
get_key_image_spent_status(key_image) ¶Get the spent status of the given key image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_image | str | is key image hex to get the status of. | required |
Returns:
| Type | Description |
|---|---|
MoneroKeyImageSpentStatus | the status of the key image. |
get_key_image_spent_statuses(key_images) ¶Get the spent status of each given key image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_images | list[str] | are hex key images to get the statuses of. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroKeyImageSpentStatus] | the spent status for each key image. |
get_known_peers() ¶Get all known peers including their last known online status.
Returns:
| Type | Description |
|---|---|
list[MoneroPeer] | the daemon's known peers. |
get_last_block_header() ¶get_listeners() ¶Get the listeners registered with the daemon.
Returns:
| Type | Description |
|---|---|
list[MoneroDaemonListener] | the registered listeners. |
get_miner_tx_sum(height, num_blocks) ¶Gets the total emissions and fees from the genesis block to the current height.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height | int | is the height to start computing the miner sum. | required |
num_blocks | int | are the number of blocks to include in the sum. | required |
Returns:
| Type | Description |
|---|---|
MoneroMinerTxSum | the sum emission and fees since the geneis block. |
get_mining_status() ¶Get the daemon's mining status.
Returns:
| Type | Description |
|---|---|
MoneroMiningStatus | the daemon's mining status. |
get_output_histogram(amounts, min_count, max_count, is_unlocked, recent_cutoff) ¶Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. RingCT outputs counts as 0 amount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amounts | list[int] | are amounts of outputs to make the histogram with (atomic-units). | required |
min_count | Optional[int] | filter amounts with at least this number of outputs. | required |
max_count | Optional[int] | filter amounts with at most this number of outputs. | required |
is_unlocked | Optional[bool] | makes a histogram with outputs with the specified lock state. | required |
recent_cutoff | Optional[int] | exclude outputs from older than this timestamp. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroOutputHistogramEntry] | output histogram entries meeting the parameters. |
get_outputs(outputs) ¶Get outputs identified by a list of output amounts and indices as a binary request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outputs | list[MoneroOutput] | identify each output by amount and index. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroOutput] | the identified outputs. |
get_peer_bans() ¶get_peers() ¶Get peers with active incoming or outgoing connections to the node.
Returns:
| Type | Description |
|---|---|
list[MoneroPeer] | the daemon's peers. |
get_sync_info() ¶Get synchronization information.
Returns:
| Type | Description |
|---|---|
MoneroDaemonSyncInfo | contains sync information. |
get_tx(tx_hash, prune=False) ¶Get a transaction by hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_hash | str | is the hash of the transaction to get. | required |
prune | bool | specifies if the returned tx should be pruned (defaults to | False |
Returns:
| Type | Description |
|---|---|
MoneroTx | None | the transaction with the given hash or null if not found. |
get_tx_hex(tx_hash, prune=False) ¶Get a transaction hex by hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_hash | str | is the hash of the transaction to get hex from. | required |
prune | bool | specifies if the returned tx hex should be pruned (defaults to | False |
Returns:
| Type | Description |
|---|---|
str | None | the tx hex with the given hash. |
get_tx_hexes(tx_hashes, prune=False) ¶Get transaction hexes by hashes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_hashes | list[str] | are hashes of transactions to get hexes from | required |
prune | bool | Prune transaction hashes. | False |
Returns:
| Type | Description |
|---|---|
list[str] | are the tx hexes. |
get_tx_pool() ¶Get valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the tx pool.
Returns:
| Type | Description |
|---|---|
list[MoneroTx] | transactions in the transaction pool. |
get_tx_pool_backlog() ¶Get all transaction pool backlog.
Returns:
| Type | Description |
|---|---|
list[MoneroTxBacklogEntry] | transaction pool backlog entries. |
get_tx_pool_hashes() ¶Get hashes of transactions in the transaction pool.
Returns:
| Type | Description |
|---|---|
list[str] | hashes of transactions in the transaction pool. |
get_tx_pool_stats() ¶Get transaction pool statistics.
Returns:
| Type | Description |
|---|---|
MoneroTxPoolStats | statistics about the transaction pool. |
get_txs(tx_hashes, prune=False) ¶Get transactions by hashes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_hashes | list[str] | are hashes of transactions to get. | required |
prune | bool | Prune transactions. | False |
Returns:
| Type | Description |
|---|---|
list[MoneroTx] | found transactions with the given hashes. |
get_upload_limit() ¶Get the upload bandwidth limit.
Returns:
| Type | Description |
|---|---|
int | is the upload bandwidth limit. |
get_version() ¶is_trusted() ¶Indicates if the daemon is trusted or untrusted.
Returns:
| Type | Description |
|---|---|
bool |
|
prune_blockchain(check) ¶Prune the blockchain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check | bool | specifies to check the pruning (default | required |
Returns:
| Type | Description |
|---|---|
MoneroPruneResult | the prune result. |
relay_tx_by_hash(tx_hash) ¶Relays a transaction by hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_hash | str | identifies the transaction to relay. | required |
relay_txs_by_hash(tx_hashes) ¶Relays transactions by hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_hashes | list[str] | identify the transactions to relay. | required |
remove_listener(listener) ¶Unregister a listener to receive daemon notifications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
listener | MoneroDaemonListener | a previously registered listener to be unregistered. | required |
reset_download_limit() ¶Reset the download bandwidth limit.
Returns:
| Type | Description |
|---|---|
int | the download bandwidth limit after resetting. |
reset_upload_limit() ¶Reset the upload bandwidth limit.
Returns:
| Type | Description |
|---|---|
int | the upload bandwidth limit after resetting. |
set_download_limit(limit) ¶Set the download bandwidth limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit | int | is the download limit to set ( | required |
Returns:
| Type | Description |
|---|---|
int | is the new download limit after setting. |
set_incoming_peer_limit(limit) ¶Limit number of incoming peers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit | int | is the maximum number of incoming peers. | required |
set_outgoing_peer_limit(limit) ¶Limit number of outgoing peers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit | int | is the maximum number of outgoing peers. | required |
set_peer_ban(ban) ¶Ban a peer node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ban | MoneroBan | contains information about a node to ban. | required |
set_peer_bans(bans) ¶Ban peers nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bans | list[MoneroBan] | are bans to apply against peer nodes. | required |
set_upload_limit(limit) ¶Set the upload bandwidth limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit | int | is the upload limit to set ( | required |
Returns:
| Type | Description |
|---|---|
int | is the new upload limit after setting. |
start_mining(address, num_threads, is_background, ignore_battery) ¶Start mining.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address | str | is the address given miner rewards if the daemon mines a block. | required |
num_threads | int | is the number of mining threads to run. | required |
is_background | bool | specifies if the miner should run in the background or not. | required |
ignore_battery | bool | specifies if the battery state (e.g. on laptop) should be ignored or not. | required |
stop() ¶Safely disconnect and shut down the daemon.
stop_mining() ¶Stop mining.
submit_block(block_blob) ¶Submit a mined block to the network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_blob | str | is the mined block to submit. | required |
submit_blocks(block_blobs) ¶Submit mined blocks to the network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_blobs | list[str] | are the mined blocks to submit. | required |
submit_tx_hex(tx_hex, do_not_relay=False) ¶Submits a transaction to the daemon's pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_hex | str | is the raw transaction hex to submit. | required |
Returns:
| Type | Description |
|---|---|
MoneroSubmitTxResult | the submission results. |
wait_for_next_block_header() ¶Get the header of the next block added to the chain.
Returns:
| Type | Description |
|---|---|
MoneroBlockHeader | the header of the next block added to the chain. |
MoneroDaemonRpc ¶ Bases: MoneroDaemon
Implements a MoneroDaemon using monerod-rpc_.
.. _monerod-rpc: https://docs.getmonero.org/rpc-library/monerod-rpc/
get_rpc_connection() ¶Get the daemon's RPC connection.
Returns:
| Type | Description |
|---|---|
MoneroRpcConnection | the daemon's rpc connection. |
is_connected() ¶Indicates if the client is connected to the daemon via RPC.
Returns:
| Type | Description |
|---|---|
bool |
|
MoneroSslOptions ¶Models SSL options for a Monero rpc connection.
ssl_allow_any_cert: bool | None instance-attribute ¶Allow any certificate.
ssl_allowed_fingerprints: list[str] instance-attribute ¶Allowed ssl fingerprints.
ssl_ca_file: str | None instance-attribute ¶Path to ssl CA file.
ssl_certificate_path: str | None instance-attribute ¶Path to private ssl certificate.
ssl_private_key_path: str | None instance-attribute ¶Path to private ssl key.
__init__() ¶Initialize a new rpc connection ssl options.
MoneroConnectionType ¶ Bases: IntEnum
Enumerates a connection type, wich can be IPV4, IPV6, TOR, I2P or INVALID.
I2P = 4 class-attribute instance-attribute ¶4 Indicates that Monero connection type is I2P.
INVALID = 0 class-attribute instance-attribute ¶0 Indicates that Monero connection type is invalid.
IPV4 = 1 class-attribute instance-attribute ¶1 Indicates that Monero connection type is IPV4.
IPV6 = 2 class-attribute instance-attribute ¶2 Indicates that Monero connection type is IPV6.
TOR = 3 class-attribute instance-attribute ¶3 Indicates that Monero connection type is TOR.
MoneroConnectionPriorityComparator ¶Connection priority compare utils.
compare(p1, p2) staticmethod ¶Compare connection priorities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1 | int | first priority to check. | required |
p2 | int | second priority to check. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
MoneroNetworkType ¶ Bases: IntEnum
Enumerates a Monero network type_.
.. _Monero network type: https://docs.getmonero.org/infrastructure/networks/
MAINNET = 0 class-attribute instance-attribute ¶0 indicates Mainnet network_.
.. _Mainnet network: https://docs.getmonero.org/infrastructure/networks/#mainnet
STAGENET = 2 class-attribute instance-attribute ¶2 indicates Stagenet network_.
.. _Stagenet network: https://docs.getmonero.org/infrastructure/networks/#stagenet
TESTNET = 1 class-attribute instance-attribute ¶1 indicates Testnet network_.
.. _Testnet network: https://docs.getmonero.org/infrastructure/networks/#testnet
MoneroVersion ¶ Bases: SerializableStruct
Models a Monero version.
MoneroBlockHeader ¶ Bases: SerializableStruct
Models a Monero block header which contains information about the block.
cumulative_difficulty: int | None instance-attribute ¶Cumulative difficulty of all blocks up to the block in the reply.
depth: int | None instance-attribute ¶The number of blocks succeeding this block on the blockchain. A larger number means an older block.
difficulty: int | None instance-attribute ¶The strength of the Monero network based on mining power.
hash: str | None instance-attribute ¶The hash of this block.
height: int | None instance-attribute ¶The number of blocks preceding this block on the blockchain.
long_term_weight: int | None instance-attribute ¶The long term block weight, based on the median weight of the preceding 100000 blocks.
major_version: int | None instance-attribute ¶The major version of the monero protocol at this block height.
miner_tx_hash: str | None instance-attribute ¶The hash of this block's coinbase transaction.
minor_version: int | None instance-attribute ¶The minor version of the monero protocol at this block height.
nonce: int | None instance-attribute ¶A cryptographic random one-time number used in mining a Monero block.
num_txs: int | None instance-attribute ¶Number of transactions included in this block.
orphan_status: bool | None instance-attribute ¶If True, this block is not part of the longest chain.
pow_hash: str | None instance-attribute ¶The hash, as a hexadecimal string, calculated from the block as proof-of-work.
prev_hash: str | None instance-attribute ¶The hash of the block immediately preceding this block in the chain.
reward: int | None instance-attribute ¶The amount of atomic-units rewarded to the miner. The reward is the sum of new coins created (the emission) and fees paid by transactions in this block. Note: 1 XMR = 1e12 atomic-units.
size: int | None instance-attribute ¶Backward compatibility, same as weight, use that instead.
timestamp: int | None instance-attribute ¶The unix time at which the block was recorded into the blockchain.
weight: int | None instance-attribute ¶The adjusted block size, in bytes. This is the raw size, plus a positive adjustment for any Bulletproof transactions with more than 2 outputs.
__init__() ¶Initialize a Monero block header.
copy() ¶merge(other) ¶Merge current block header with another one.
Raises:
| Type | Description |
|---|---|
Exception | on reconciliation error. |
MoneroBlock ¶ Bases: MoneroBlockHeader
Models a Monero block in the blockchain.
hex: str | None instance-attribute ¶Hexadecimal blob of block information.
miner_tx: MoneroTx | None instance-attribute ¶Miner transaction information.
tx_hashes: list[str] instance-attribute ¶List of hashes of non-coinbase transactions in the block.
txs: list[MoneroTx] instance-attribute ¶List of non-coinbase transactions in the block.
__init__() ¶Initialize a Monero block.
copy() ¶MoneroTx ¶ Bases: SerializableStruct
Models a Monero transaction on the blockchain.
DEFAULT_PAYMENT_ID: str instance-attribute ¶Default tx payment id
block: MoneroBlock | None instance-attribute ¶Block including the transaction.
common_tx_sets: str | None instance-attribute ¶A hexadecimal string representing a set of unsigned transactions, or a set of signing keys used in a multisig transaction.
extra: list[int] instance-attribute ¶Usually called the payment ID but can be used to include any random 32 bytes.
fee: int | None instance-attribute ¶The amount of the mining fee included in the transaction, in atomic-units.
full_hex: str | None instance-attribute ¶Full transaction information as a hex string.
hash: str | None instance-attribute ¶The transaction hash.
in_tx_pool: bool | None instance-attribute ¶States if the transaction is in pool (True) or included in a block (False).
inputs: list[MoneroOutput] instance-attribute ¶List of inputs into transaction.
is_confirmed: bool | None instance-attribute ¶States if the transaction included in a block (True) or is in pool (False).
is_double_spend_seen: bool | None instance-attribute ¶States if the transaction is a double-spend (True) or not (False).
is_failed: bool | None instance-attribute ¶Indicates if the transaction validation has previously failed.
is_kept_by_block: bool | None instance-attribute ¶States if the transaction was included in a block at least once (True) or not (False).
is_miner_tx: bool | None instance-attribute ¶States if the transaction is a coinbase-transaction (True) or not (False).
is_relayed: bool | None instance-attribute ¶States if the transaction was relayed (True) or not (False).
key: str | None instance-attribute ¶The transaction key.
last_failed_hash: str | None instance-attribute ¶If the transaction validation has previously failed, this tells the previous transaction hash.
last_failed_height: int | None instance-attribute ¶If the transaction validation has previously failed, this tells at what height that occurred.
last_relayed_timestamp: int | None instance-attribute ¶Last unix time at which the transaction has been relayed.
max_used_block_hash: str | None instance-attribute ¶Tells the hash of the most recent block with an output used in this transaction.
max_used_block_height: int | None instance-attribute ¶Tells the height of the most recent block with an output used in this transaction.
metadata: str | None instance-attribute ¶Transaction metadata.
num_confirmations: int | None instance-attribute ¶Number of network confirmations.
output_indices: list[int] instance-attribute ¶Transaction indexes.
outputs: list[MoneroOutput] instance-attribute ¶Transaction outputs.
payment_id: str | None instance-attribute ¶Payment ID for this transaction.
prunable_hash: str | None instance-attribute ¶Keccak-256 hash of the prunable portion of the block.
prunable_hex: str | None instance-attribute ¶Prunable block encoded as a hex string.
pruned_hex: str | None instance-attribute ¶Pruned block encoded as hex string.
rct_sig_prunable: str | None instance-attribute ¶Prunable ring signature.
rct_signatures: str | None instance-attribute ¶Signatures used in ring signature to hide the true origin of the transaction.
received_timestamp: int | None instance-attribute ¶Unix time at chich the transaction has been received.
relay: bool | None instance-attribute ¶States if this transaction should be relayed (True) or not (False).
ring_size: int | None instance-attribute ¶The ring size of this transaction.
signatures: list[str] instance-attribute ¶List of signatures used in ring signature to hide the true origin of the transaction.
size: int | None instance-attribute ¶Backward compatibility, same as weight, use that instead.
unlock_time: int | None instance-attribute ¶If not 0, this tells when the transaction outputs are spendable.
version: int | None instance-attribute ¶Transaction version.
weight: int | None instance-attribute ¶The weight of this transaction in bytes.
__init__() ¶Initialize a new Monero transaction.
get_height() ¶Get the transaction height.
Returns:
| Type | Description |
|---|---|
int | None | The height of the transaction, if known. |
merge(other) ¶Merge current tx with another one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | MoneroTx | other tx to merge with. | required |
MoneroKeyImage ¶ Bases: SerializableStruct
Models a Monero key image.
hex: str | None instance-attribute ¶The key image in hexadecimal format.
signature: str | None instance-attribute ¶The key image signature. None if not known.
__init__() ¶Initialize a Monero key image.
copy() ¶deserialize_key_images(key_images_json) staticmethod ¶Deserialize key images from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_images_json | str | JSON string with serialized key images. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroKeyImage] | Deserialized key images. |
merge(other) ¶Merge current key image with another one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | MoneroKeyImage | other key image to merge with. | required |
MoneroOutput ¶ Bases: SerializableStruct
Models a Monero transaction output.
amount: int | None instance-attribute ¶Output amount in atomic-units.
index: int | None instance-attribute ¶Output index.
key_image: MoneroKeyImage | None instance-attribute ¶The key image of the output.
ring_output_indices: list[int] instance-attribute ¶Indices of ring outputs.
stealth_public_key: str | None instance-attribute ¶The public key of the output.
tx: MoneroTx instance-attribute ¶The transaction related to this output.
__init__() ¶Initialize a Monero output.
copy() ¶merge(other) ¶Merge current output wallet with another output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | MoneroOutput | other output to merge with. | required |
MoneroAltChain ¶Models an alternative chain seen by the node.
block_hashes: list[str] instance-attribute ¶List of all block hashes in the alternative chain that are not in the main chain.
difficulty: int | None instance-attribute ¶Cumulative difficulty of all blocks in the alternative chain.
height: int | None instance-attribute ¶The block height of the first diverging block of this alternative chain.
length: int | None instance-attribute ¶The length in blocks of this alternative chain, after divergence.
main_chain_parent_block_hash: str | None instance-attribute ¶The hash of the greatest height block that is shared between the alternative chain and the main chain.
__init__() ¶Initialize a Monero alt chain info.
MoneroBan ¶Model a Monero banhammer.
host: str | None instance-attribute ¶Host ban.
ip: int | None instance-attribute ¶IP ban.
is_banned: bool | None instance-attribute ¶Indicates if ban on the host is active (True) or not (False).
seconds: int | None instance-attribute ¶Indicates the duration of the ban in seconds.
__init__() ¶Initialize a Monero banhammer.
MoneroPruneResult ¶MoneroMiningStatus ¶Models a Monero daemon mining status.
address: str | None instance-attribute ¶Account address daemon is mining to. None if not mining.
is_active: bool | None instance-attribute ¶Indicates if mining is enabled.
is_background: bool | None instance-attribute ¶Indicates if mining is running in background.
num_threads: int | None instance-attribute ¶Number of running mining threads.
speed: int | None instance-attribute ¶Mining power in hashes per seconds.
__init__() ¶Initialize a Monero daemon mining status.
MoneroMinerTxSum ¶MoneroBlockTemplate ¶Monero block template to mine.
block_hashing_blob: str | None instance-attribute ¶Blob on which to try to find a valid nonce.
block_template_blob: str | None instance-attribute ¶Blob on which to try to mine a new block.
difficulty: int | None instance-attribute ¶Network difficulty.
expected_reward: int | None instance-attribute ¶Coinbase reward expected to be received if block is successfully mined.
height: int | None instance-attribute ¶Height on which to mine.
next_seed_hash: str | None instance-attribute ¶Hash of the next block to use as seed for Random-X proof-of-work.
prev_hash: str | None instance-attribute ¶Hash of the most recent block on which to mine the next block.
reserved_offset: int | None instance-attribute ¶Reserved offset.
seed_hash: str | None instance-attribute ¶Hash of block to use as seed for Random-X proof-of-work.
seed_height: int | None instance-attribute ¶Height of block to use as seed for Random-X proof-of-work.
__init__() ¶Initialize a Monero block template.
MoneroConnectionSpan ¶Monero daemon connection span.
connection_id: str | None instance-attribute ¶Id of connection
num_blocks: int | None instance-attribute ¶Number of blocks in this span
rate: int | None instance-attribute ¶Connection rate
remote_address: str | None instance-attribute ¶Peer address the node is downloading (or has downloaded) than span from.
size: int | None instance-attribute ¶Total number of bytes in that span's blocks (including txes).
speed: int | None instance-attribute ¶Connection speed.
start_height: int | None instance-attribute ¶Block height of the first block in that span.
__init__() ¶Initialize a Monero connection span.
MoneroPeer ¶Models a peer to the daemon.
address: str | None instance-attribute ¶The peer's address, actually IPv4 & port.
avg_download: int | None instance-attribute ¶Average bytes of data downloaded by node.
avg_upload: int | None instance-attribute ¶Average bytes of data uploaded by node.
connection_type: MoneroConnectionType | None instance-attribute ¶Type of peer connection.
current_download: int | None instance-attribute ¶Current bytes downloaded by node.
current_upload: int | None instance-attribute ¶Current bytes uploaded by node.
hash: str | None instance-attribute ¶Peer hash.
height: int | None instance-attribute ¶The peer blockchain height.
host: str | None instance-attribute ¶The peer host.
id: str | None instance-attribute ¶The node's ID on the network.
is_incoming: bool | None instance-attribute ¶Indicates if peer is pulling blocks from node.
is_local_host: bool | None instance-attribute ¶Indicates if peer is localhost.
is_local_ip: bool | None instance-attribute ¶Indicates if peer has a local ip address.
is_online: bool | None instance-attribute ¶Indicates if the peer is online.
last_seen_timestamp: int | None instance-attribute ¶Last activity timestamp of this peer.
live_time: int | None instance-attribute ¶Length of time the peer has been online.
num_receives: int | None instance-attribute ¶Total number of messages received from this peer.
num_sends: int | None instance-attribute ¶Total number of messages sent to this peer.
num_support_flags: int | None instance-attribute ¶Support flags number.
port: int | None instance-attribute ¶The port that the node is using to connect to the network.
pruning_seed: int | None instance-attribute ¶Block height at which pruning began.
receive_idle_time: int | None instance-attribute ¶Seconds since last data was received from this peer.
rpc_credits_per_hash: int | None instance-attribute ¶Credits for every hash calculated by client.
rpc_port: int | None instance-attribute ¶Peer RPC port.
send_idle_time: int | None instance-attribute ¶Seconds since the last data sent to this peer.
state: str | None instance-attribute ¶Peer state.
__init__() ¶Initialize a new Monero peer.
MoneroSubmitTxResult ¶Models the result from submitting a tx to a daemon.
credits: int | None instance-attribute ¶If payment for RPC is enabled, the number of credits available to the requesting client.
has_invalid_input: bool | None instance-attribute ¶Indicates if the transaction has an invalid input.
has_invalid_output: bool | None instance-attribute ¶Indicates if the transaction has an invalid output.
has_too_few_outputs: bool | None instance-attribute ¶Indicates if the transaction has too few outputs.
is_double_spend: bool | None instance-attribute ¶Indicates if the transaction is double spend.
is_fee_too_low: bool | None instance-attribute ¶Indicates if the transaction fee is too low.
is_good: bool | None instance-attribute ¶Indicates if the submission of the transaction was successfull.
is_mixin_too_low: bool | None instance-attribute ¶Indicates if the transaction mixin count is too low.
is_overspend: bool | None instance-attribute ¶Indicates if the transaction uses more money than available
is_relayed: bool | None instance-attribute ¶Indicates if the transaction has been relayed.
is_too_big: bool | None instance-attribute ¶Indicates if the transaction size is too big.
is_tx_extra_too_big: bool | None instance-attribute ¶Indicates if the transaction extra size is too big.
reason: str | None instance-attribute ¶Additional information. Currently empty or Not relayed if transaction was accepted but not relayed.
sanity_check_failed: bool | None instance-attribute ¶Indicates if the transaction sanity check has failed.
top_block_hash: str | None instance-attribute ¶Hash of the highest block in the chain.
__init__() ¶Initialize a new submit transaction result.
MoneroOutputDistributionEntry ¶Models a Monero output distribution entry.
amount: int | None instance-attribute ¶Output amount in atomic-units.
base: int | None instance-attribute ¶The total number of outputs of amount in the chain before, not including, the block at start_height.
distribution: list[int] instance-attribute ¶The output distibution.
start_height: int | None instance-attribute ¶Not necessarily equal to start_height parameter especially for amount = 0 where start_height will be no less than the height of the v4 hardfork.
__init__() ¶Initialize a Monero output distribution entry.
MoneroOutputHistogramEntry ¶Models a Monero output histogram entry.
amount: int | None instance-attribute ¶Output amount in atomic-units.
num_instances: int | None instance-attribute ¶Number of outputs.
recent_instances: int | None instance-attribute ¶Number of recent outputs.
unlocked_instances: int | None instance-attribute ¶Number of unlocked outputs.
__init__() ¶Initialize a Monero output histogram entry.
MoneroTxPoolStats ¶Models transaction pool statistics.
bytes_max: int | None instance-attribute ¶Max transaction size in pool.
bytes_med: int | None instance-attribute ¶Median transaction size in pool.
bytes_min: int | None instance-attribute ¶Min transaction size in pool.
bytes_total: int | None instance-attribute ¶Total size of all transactions in pool.
fee_total: int | None instance-attribute ¶The sum of the fees for all transactions currently in the transaction pool atomic-units.
histo98pc: int | None instance-attribute ¶The time 98% of txes are younger than.
num10m: int | None instance-attribute ¶Number of transactions in pool for more than 10 minutes.
num_double_spends: int | None instance-attribute ¶Number of double spend transactions.
num_failing: int | None instance-attribute ¶Number of failing transactions.
num_not_relayed: int | None instance-attribute ¶Number of non-relayed transactions.
num_txs: int | None instance-attribute ¶Total number of transactions.
oldest_timestamp: int | None instance-attribute ¶Unix time of the oldest transaction in the pool.
__init__() ¶Initialize a Monero transaction pool statistics.
MoneroDaemonUpdateCheckResult ¶Models the result of checking for a daemon update.
auto_uri: str | None instance-attribute ¶URL automatically generated by the daemon to download the update.
hash: str | None instance-attribute ¶Integrity check hash.
is_update_available: bool | None instance-attribute ¶Indicates if an update is available to download.
user_uri: str | None instance-attribute ¶Alternative user URI.
version: str | None instance-attribute ¶Version available for download.
__init__() ¶Initialize a Monero update check result.
MoneroDaemonUpdateDownloadResult ¶ Bases: MoneroDaemonUpdateCheckResult
Models the result of downloading a daemon update.
MoneroFeeEstimate ¶Models a Monero fee estimate.
fee: int | None instance-attribute ¶Amount of fees estimated per byte in atomic-units.
fees: list[int] instance-attribute ¶Represents the base fees at different priorities [slow, normal, fast, fastest].
quantization_mask: int | None instance-attribute ¶Final fee should be rounded up to an even multiple of this value.
__init__() ¶Initialize a Monero fee estimate.
MoneroDaemonInfo ¶Models information got from a Monero daemon.
adjusted_timestamp: int | None instance-attribute ¶Current time approximated from chain data, as Unix time.
block_size_limit: int | None instance-attribute ¶Backward compatibility, same as block_weight_limit, use that instead.
block_size_median: int | None instance-attribute ¶Backward compatibility, same as block_weight_median, use that instead.
block_weight_limit: int | None instance-attribute ¶Maximum allowed adjusted block size based on latest 100000 blocks.
block_weight_median: int | None instance-attribute ¶Median adjusted block size of latest 100000 blocks.
bootstrap_daemon_address: str | None instance-attribute ¶Bootstrap-node to give immediate usability to wallets while syncing by proxying RPC to it.
credits: int | None instance-attribute ¶If payment for RPC is enabled, the number of credits available to the requesting client.
cumulative_difficulty: int | None instance-attribute ¶Cumulative difficulty.
database_size: int | None instance-attribute ¶The size of the blockchain database, in bytes.
difficulty: int | None instance-attribute ¶The network difficulty.
free_space: int | None instance-attribute ¶Available disk space on the node.
height: int | None instance-attribute ¶Current length of longest chain known to daemon.
height_without_bootstrap: int | None instance-attribute ¶Current length of the local chain of the daemon.
is_busy_syncing: bool | None instance-attribute ¶States if new blocks are being added (True) or not (False).
is_offline: bool | None instance-attribute ¶States if the node is offline (True) or online (False).
is_restricted: bool | None instance-attribute ¶Indicates that the node RPC interface is restricted (True) or not (False).
is_synchronized: bool | None instance-attribute ¶States if the node is synchronized (True) or not (False).
network_type: MoneroNetworkType | None instance-attribute ¶Network type (MAINNET, TESTNET, or STAGENET).
num_alt_blocks: int | None instance-attribute ¶Number of alternative blocks to main chain.
num_incoming_connections: int | None instance-attribute ¶Number of peers connected to and pulling from your node.
num_offline_peers: int | None instance-attribute ¶Number of peers that are marked as not reacheable on the network.
num_online_peers: int | None instance-attribute ¶Number of peers that are marked as reacheble on the network.
num_outgoing_connections: int | None instance-attribute ¶Number of peers that you are connected to and getting information from.
num_rpc_connections: int | None instance-attribute ¶Number of RPC client connected to the daemon (Including this RPC request).
num_txs: int | None instance-attribute ¶Total number of non-coinbase transactions in the chain.
num_txs_pool: int | None instance-attribute ¶Number of transactions that have been broadcast but not included in a block.
start_timestamp: int | None instance-attribute ¶Start time of the daemon, as UNIX time.
target: int | None instance-attribute ¶Current target for next proof of work.
target_height: int | None instance-attribute ¶The height of the next block in the chain.
top_block_hash: str | None instance-attribute ¶Hash of the highest block in the chain.
update_available: bool | None instance-attribute ¶States if a newer Monero software version is available.
version: str | None instance-attribute ¶The version of the Monero software the node is running.
was_bootstrap_ever_used: bool | None instance-attribute ¶States if a bootstrap node has ever been used since the daemon started.
__init__() ¶Initiliaze a Monero daemon info.
MoneroDaemonSyncInfo ¶Models daemon synchronization information.
credits: int | None instance-attribute ¶If payment for RPC is enabled, the number of credits available to the requesting client.
height: int | None instance-attribute ¶Daemon blockchain height.
next_needed_pruning_seed: int | None instance-attribute ¶The next pruning seed needed for pruned sync.
overview: str | None instance-attribute ¶Overview of current block queue where each character in the string represents a block set in the queue. '.' = requested but not received, 'o' = set received, 'm' = received set that matches the next blocks needed
peers: list[MoneroPeer] instance-attribute ¶List of peers connected to the node
spans: list[MoneroConnectionSpan] instance-attribute ¶Currently connected peers to download blocks from.
target_height: int | None instance-attribute ¶Target height the node is syncing from (will be 0 if node is fully synced).
top_block_hash: str | None instance-attribute ¶Hash of the highest block in the chain.
__init__() ¶Initialize a Monero daemon sync info.
MoneroHardForkInfo ¶Models a Monero look up information regarding hard fork voting and readiness.
credits: int | None instance-attribute ¶If payment for RPC is enabled, the number of credits available to the requesting client.
earliest_height: int | None instance-attribute ¶Block height at which hard fork would be enabled if voted in.
is_enabled: bool | None instance-attribute ¶Tells if hard fork is enforced.
num_votes: int | None instance-attribute ¶Number of votes towards hard fork.
state: int | None instance-attribute ¶Current hard fork state. 0 (There is likely a hard fork), 1 (An update is needed to fork properly), or 2 (Everything looks good).
threshold: int | None instance-attribute ¶Minimum percent of votes to trigger hard fork. Default is 80.
top_block_hash: str | None instance-attribute ¶If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty.
version: int | None instance-attribute ¶The major block version for the fork.
voting: int | None instance-attribute ¶Hard fork voting status.
window: int | None instance-attribute ¶Number of blocks over which current votes are cast. Default is 10080 blocks.
__init__() ¶Initialize a Monero hard fork info.
MoneroDaemonListener ¶Receives notifications as a daemon is updated.
last_header: MoneroBlockHeader | None instance-attribute ¶Last block header added to the chain.
__init__() ¶Initialize a Monero daemon listener.
on_block_header(header) ¶Called when a new block is added to the chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
header | MoneroBlockHeader | is the header of the block added to the chain. | required |
MoneroWalletConfig ¶Configures a wallet to create.
account_lookahead: int | None instance-attribute ¶Account index look ahead.
is_multisig: bool | None instance-attribute ¶Indicates if the wallet is a multisignature wallet.
language: str | None instance-attribute ¶The wallet language.
network_type: MoneroNetworkType | None instance-attribute ¶The wallet network type.
password: str | None instance-attribute ¶The wallet password.
path: str | None instance-attribute ¶The wallet path on file system.
primary_address: str | None instance-attribute ¶The wallet standard address.
private_spend_key: str | None instance-attribute ¶The wallet private spend key.
private_view_key: str | None instance-attribute ¶The wallet private view key.
restore_height: int | None instance-attribute ¶The wallet restore height.
save_current: bool | None instance-attribute ¶Save the wallet.
seed: str | None instance-attribute ¶The wallet mnemonic.
seed_offset: str | None instance-attribute ¶The wallet custom seed offset.
server: MoneroRpcConnection | None instance-attribute ¶The wallet RPC connection.
subaddress_lookahead: int | None instance-attribute ¶Subaddress index look ahead.
copy() ¶deserialize(config_json) staticmethod ¶Deserialize a Monero wallet config from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_json | str | JSON string. | required |
Returns:
| Type | Description |
|---|---|
MoneroWalletConfig | The deserialized wallet config. |
MoneroSyncResult ¶ Bases: SerializableStruct
Models a result of syncing a wallet.
MoneroSubaddress ¶ Bases: SerializableStruct
Models a Monero subaddress.
account_index: int | None instance-attribute ¶The subaddress account index.
address: str | None instance-attribute ¶Public address.
balance: int | None instance-attribute ¶The subaddress balance.
index: int | None instance-attribute ¶The subaddress index.
is_used: bool | None instance-attribute ¶Indicates if subaddress has been used in receiving funds.
label: str | None instance-attribute ¶The subaddress label.
num_blocks_to_unlock: int | None instance-attribute ¶Number of blocks to unlock receveid outputs.
num_unspent_outputs: int | None instance-attribute ¶The number of unspent outputs in this subaddress.
unlocked_balance: int | None instance-attribute ¶The subaddress unlocked balance.
__init__() ¶Initialize a Monero subaddress.
MoneroAccount ¶ Bases: SerializableStruct
Models a Monero account.
balance: int | None instance-attribute ¶The account balance.
index: int | None instance-attribute ¶The account index.
primary_address: str | None instance-attribute ¶The account primary address.
subaddresses: list[MoneroSubaddress] instance-attribute ¶List of account subaddresses.
tag: str | None instance-attribute ¶The account tag.
unlocked_balance: int | None instance-attribute ¶The account unlocked balance.
__init__() ¶Initialize a Monero account.
MoneroDestination ¶Models an outgoing transfer destination.
address: str | None instance-attribute ¶Address of the receiver.
amount: int | None instance-attribute ¶Amount sent to this destination.
copy() ¶Copy current outgoing transfer destination.
Returns:
| Type | Description |
|---|---|
MoneroDestination | outgoing transfer destination copy. |
MoneroTransfer ¶ Bases: SerializableStruct
Models a base transfer of funds to or from the wallet.
account_index: int | None instance-attribute ¶Index of the account related to this transfer.
amount: int | None instance-attribute ¶Transfer amount in atomic-units.
tx: MoneroTxWallet instance-attribute ¶Related wallet transaction.
__init__() ¶Initialize a Monero transfer.
copy() ¶is_incoming() ¶Indicates if it is an incoming transfer (True) or not (False). Default None.
Returns:
| Type | Description |
|---|---|
bool | None |
|
is_outgoing() ¶Indicates if it is an outgoing transfer (True) or not (False). Default None.
Returns:
| Type | Description |
|---|---|
bool | None |
|
merge(other) ¶Merge current transfer with another one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | MoneroTransfer | other transfer to merge with. | required |
MoneroIncomingTransfer ¶ Bases: MoneroTransfer
Models an incoming transfer of funds to the wallet.
address: str | None instance-attribute ¶The address that received funds within this transfer.
num_suggested_confirmations: int | None instance-attribute ¶The number of suggested confirmations before moving funds.
subaddress_index: int | None instance-attribute ¶The subaddress index that received funds within this transfer.
__init__() ¶Initialize a Monero incoming transfer.
copy() ¶Copy current incoming transfer.
Returns:
| Type | Description |
|---|---|
MoneroIncomingTransfer | incoming transfer copy. |
MoneroOutgoingTransfer ¶ Bases: MoneroTransfer
Models an outgoing transfer of funds from the wallet.
addresses: list[str] instance-attribute ¶Addresses from which the transfer originated.
destinations: list[MoneroDestination] instance-attribute ¶Outgoing transfer destinations.
subaddress_indices: list[int] instance-attribute ¶Subaddresses from which the transfer originated.
copy() ¶Copy current outgoing transfer.
Returns:
| Type | Description |
|---|---|
MoneroOutgoingTransfer | outgoing transfer copy. |
MoneroTransferQuery ¶ Bases: MoneroTransfer
Configures a query to retrieve transfers.
All transfers are returned except those that do not meet the criteria defined in this query.
address: str | None instance-attribute ¶Select transfers involving particular address. Empty for all.
addresses: list[str] instance-attribute ¶Select transfers involving particular addresses. Empty for all.
destinations: list[MoneroDestination] instance-attribute ¶Select transfers involving particular destinations. Empty for all.
has_destinations: bool | None instance-attribute ¶Filter transfers with or without destinations. None for all.
incoming: bool | None instance-attribute ¶Filter incoming or outgoing transfers. None for all.
outgoing: bool | None instance-attribute ¶Filter incoming or outgoing transfers. None for all.
subaddress_index: int | None instance-attribute ¶Filter by subaddress index. None for all.
subaddress_indices: list[int] instance-attribute ¶Select transfers involving particular subaddresses. Empty for all.
tx_query: MoneroTxQuery | None instance-attribute ¶Related transaction query.
__init__() ¶Initialize a Monero transfer query.
copy() ¶deserialize_from_block(transfer_query_json) staticmethod ¶Deserialize transfer query from json block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transfer_query_json | str | json block with serialized transfer query. | required |
Returns:
| Type | Description |
|---|---|
MoneroTransferQuery | deserialized transfer query. |
meets_criteria(transfer, query_parent=True) ¶Check if transfer meets all the criteria defined in this query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transfer | MoneroTransfer | transfer to check if meets criteria. | required |
query_parent | bool | query parent tx query (default | True |
Returns:
| Type | Description |
|---|---|
bool |
|
MoneroOutputWallet ¶ Bases: MoneroOutput
Models a Monero output with wallet extensions.
account_index: int | None instance-attribute ¶The index of the account that owns this output.
is_frozen: bool | None instance-attribute ¶Indicates if the output is frozen (True) or not (False).
is_spent: bool | None instance-attribute ¶Indicates if the output is spent (True) or not (False).
subaddress_index: int | None instance-attribute ¶The index of the subaddress that owns this output.
__init__() ¶Initialize a Monero wallet output.
copy() ¶MoneroOutputQuery ¶ Bases: MoneroOutputWallet
Configures a query to retrieve wallet outputs (i.e. outputs that the wallet has or had the ability to spend).
All outputs are returned except those that do not meet the criteria defined in this query.
max_amount: int | None instance-attribute ¶Filter outputs above this amount.
min_amount: int | None instance-attribute ¶Filter outputs below this amount.
subaddress_indices: list[int] instance-attribute ¶Subadress indices to select (empty for all).
tx_query: MoneroTxQuery | None property ¶Related transaction query.
__init__() ¶Initialize a Monero output query.
copy() ¶deserialize_from_block(output_query_json) staticmethod ¶Deserialize output query from block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_query_json | str | json query block. | required |
Returns:
| Type | Description |
|---|---|
MoneroOutputQuery | deserialized output query. |
meets_criteria(output, query_parent=True) ¶Indicates if the output meets all the criteria defined within this query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output | MoneroOutputWallet | Output to check. | required |
query_parent | bool | Query also parent. | True |
Returns:
| Type | Description |
|---|---|
bool |
|
set_tx_query(tx_query, output_query) ¶Set related transaction query.
This method sets query references constitutively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_query | Optional[MoneroTxQuery] | Tx query to set. | required |
output_query | bool | If | required |
MoneroTxWallet ¶ Bases: MoneroTx
Models a Monero transaction in the context of a wallet.
change_address: str | None instance-attribute ¶Address to which the change amount of the transaction was sent.
change_amount: int | None instance-attribute ¶Change amount of the transaction.
extra_hex: str | None instance-attribute ¶Extra information about the transaction in hexadecimal format.
incoming_transfers: list[MoneroIncomingTransfer] instance-attribute ¶List of incoming transfer.
input_sum: int | None instance-attribute ¶Total input sum.
is_incoming: bool | None instance-attribute ¶Indicates if the transaction has incoming transfers.
is_locked: bool | None instance-attribute ¶Indicates if the transaction is locked.
is_outgoing: bool | None instance-attribute ¶Indicated if the transaction has outgoing transfer.
note: str | None instance-attribute ¶Transaction note.
num_dummy_outputs: int | None instance-attribute ¶Number of decoys of the transactions.
outgoing_transfer: MoneroOutgoingTransfer | None instance-attribute ¶The outgoing transfer related to this transaction.
output_sum: int | None instance-attribute ¶The total output amount sum originated from this transaction.
tx_set: MoneroTxSet | None instance-attribute ¶Set of transactions related to current tx.
__init__() ¶Initialize a new Monero tx wallet.
copy() ¶filter_outputs_wallet(query) ¶Get outputs filtered by query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | MoneroOutputQuery | query to filter outputs with. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroOutputWallet] | outputs that meets all criteria defined in |
filter_transfers(query) ¶Get transfers filtered by query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | MoneroTransferQuery | query to filter transfers with. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroTransfer] | transfers that meets all criteria defined in |
get_incoming_amount() ¶Get total amount received in current tx.
Returns:
| Type | Description |
|---|---|
int | total amount received in current wallet tx. |
get_inputs_wallet(query=None) ¶Get wallet inputs filtered by query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | MoneroOutputQuery | query to filter outputs with. | None |
Returns:
| Type | Description |
|---|---|
list[MoneroOutputWallet] | wallet outputs filtered by query. |
get_outgoing_amount() ¶Get total amount spent in current tx.
Returns:
| Type | Description |
|---|---|
int | total amount spent in current wallet tx. |
MoneroTxQuery ¶ Bases: MoneroTxWallet
Configures a query to retrieve transactions.
All transactions are returned except those that do not meet the criteria defined in this query.
has_payment_id: bool | None instance-attribute ¶Get transactions that have a payment id.
hashes: list[str] instance-attribute ¶Get transactions by hashes.
height: int | None instance-attribute ¶Get transactions by height.
include_outputs: int | None instance-attribute ¶Include outputs in transaction data.
input_query: MoneroOutputQuery | None instance-attribute ¶Query to apply on transaction inputs.
is_incoming: bool | None instance-attribute ¶Include incoming transactions.
is_outgoing: bool | None instance-attribute ¶Include outgoing transactions.
max_height: int | None instance-attribute ¶Get transactions below max height.
min_height: int | None instance-attribute ¶Get transactions above max height.
output_query: MoneroOutputQuery | None instance-attribute ¶Query to apply on transaction outputs.
payment_ids: list[str] instance-attribute ¶Get transactions with specific payment ids.
transfer_query: MoneroTransferQuery | None instance-attribute ¶Query to apply on transaction wallet transfer.
__init__() ¶Initiliaze a new Monero transaction query.
copy() ¶deserialize_from_block(tx_query_json) staticmethod ¶Deserialize transaction query from JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_query_json | str | tx query as JSON string. | required |
Returns:
| Type | Description |
|---|---|
MoneroTxQuery | deserialized tx query. |
meets_criteria(tx, query_children=False) ¶Check if transaction wallet meets all criteria defined in this query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx | MoneroTxWallet | Tx to check if meets criteria defined in this query. | required |
query_children | bool | Query child data. | False |
Returns:
| Type | Description |
|---|---|
bool |
|
MoneroTxSet ¶ Bases: SerializableStruct
Groups transactions who share common hex data which is needed in order to sign and submit the transactions.
For example, multisig transactions created from create_txs() share a common hex string which is needed in order to sign and submit the multisig transactions.
multisig_tx_hex: str | None instance-attribute ¶Multisignature transaction hex.
signed_tx_hex: str | None instance-attribute ¶Signed transaction hex.
txs: list[MoneroTxWallet] instance-attribute ¶List of transactions defined in this set.
unsigned_tx_hex: str | None instance-attribute ¶Unsigned transaction hex.
__init__() ¶Initialize a Monero transaction set.
deserialize(tx_set_json) staticmethod ¶Deserialize a Monero transaction set from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_set_json | str | tx set as JSON string. | required |
Returns:
| Type | Description |
|---|---|
MoneroTxSet | The deseriliazed transaction set. |
MoneroIntegratedAddress ¶ Bases: SerializableStruct
Models a Monero integrated address.
integrated_address: str instance-attribute ¶The integrated address.
payment_id: str instance-attribute ¶The payment id related to this integrated address.
standard_address: str instance-attribute ¶The standard address related to this integrated address.
__init__() ¶Initialize a Monero integrated address.
MoneroTxPriority ¶ Bases: IntEnum
Enumerates Monero transaction priorities.
DEFAULT = 0 class-attribute instance-attribute ¶0 Default transaction priority.
ELEVATED = 3 class-attribute instance-attribute ¶3 Elevated transaction priority.
NORMAL = 2 class-attribute instance-attribute ¶2 Normal transaction priority.
UNIMPORTANT = 1 class-attribute instance-attribute ¶1 Unimportant transaction priority.
MoneroTxConfig ¶ Bases: SerializableStruct
Configures a transaction to send, sweep, or create a payment URI.
account_index: int | None instance-attribute ¶Account index to send funds from.
address: str | None instance-attribute ¶Transaction address destination.
amount: int | None instance-attribute ¶Transaction amount.
below_amount: int | None instance-attribute ¶Ignore output amount below.
can_split: bool | None instance-attribute ¶Indicates if transaction can be splitted in multiple transactions.
destinations: list[MoneroDestination] instance-attribute ¶Transaction outgoing destinations.
fee: int | None instance-attribute ¶Transaction fee.
key_image: str | None instance-attribute ¶Use a particular key image as input for transaction.
note: str | None instance-attribute ¶Transaction note.
payment_id: str | None instance-attribute ¶Transaction payment id.
priority: MoneroTxPriority | None instance-attribute ¶Transaction priority.
recipient_name: str | None instance-attribute ¶Recipient name.
relay: bool | None instance-attribute ¶Indicates if transaction should be relayed (True) or not (False).
ring_size: int | None instance-attribute ¶Transaction ring size
subaddress_indices: list[int] instance-attribute ¶Account subaddresses indices to send funds from.
subtract_fee_from: list[int] instance-attribute ¶Subtract fee from outputs.
sweep_each_subaddress: bool | None instance-attribute ¶Sweep each wallet subbaddress.
copy() ¶deserialize(config_json) staticmethod ¶Deserialize tx config from JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_json | str | tx config in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroTxConfig | deserialized tx config. |
get_normalized_destinations() ¶Get all destinations set in current tx config.
Returns:
| Type | Description |
|---|---|
list[MoneroDestination] | normalized tx config destinations. |
set_address(address) ¶Set the address of a single-destination configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address | str | the address to set for the single destination. | required |
MoneroKeyImageImportResult ¶ Bases: SerializableStruct
Models results from importing key images.
height: int | None instance-attribute ¶Height at which the last key image was imported. Can be 0 if blockchain height is not known.
spent_amount: int | None instance-attribute ¶Amount (in atomic-units) spent from those key images.
unspent_amount: int | None instance-attribute ¶Amount (in atomic-units) still available from those key images.
__init__() ¶Initialize a Monero key image import result.
MoneroMessageSignatureType ¶ Bases: IntEnum
Enumerates the type of a Monero message signature.
SIGN_WITH_SPEND_KEY = 0 class-attribute instance-attribute ¶0 Indicates that the message verification was signed with the wallet private spend key_.
.. _private spend key: https://docs.getmonero.org/cryptography/asymmetric/private-key/#private-spend-key
SIGN_WITH_VIEW_KEY = 1 class-attribute instance-attribute ¶1 Indicates that the message verification was signed with the wallet private view key_.
.. _private view key: https://docs.getmonero.org/cryptography/asymmetric/private-key/#private-spend-key
MoneroMessageSignatureResult ¶ Bases: SerializableStruct
Models results from message verification.
is_good: bool instance-attribute ¶Indicates if the message verification was successful.
is_old: bool instance-attribute ¶Indicates if the message verification used old monero software.
signature_type: MoneroMessageSignatureType instance-attribute ¶Signature type used in the message verification.
version: int instance-attribute ¶Message signature version.
__init__() ¶Initialize a Monero message signature result.
MoneroCheck ¶ Bases: SerializableStruct
Base model for results from checking a transaction or reserve proof.
MoneroCheckTx ¶ Bases: MoneroCheck
Models the results from checking a transaction key.
in_tx_pool: bool | None instance-attribute ¶States if the transaction is in pool (True) or included in a block (False)
num_confirmations: int | None instance-attribute ¶Transaction network confirmations.
received_amount: int | None instance-attribute ¶Amount received in the transaction.
__init__() ¶Initialize a Monero transaction check.
MoneroCheckReserve ¶ Bases: MoneroCheck
Models the results from checking a reserve proof.
MoneroMultisigInfo ¶Models information about a multisig wallet.
is_multisig: bool instance-attribute ¶Indicates if the wallet is multisignature (True), or not (False).
is_ready: bool instance-attribute ¶Indicates if the wallet is ready to support multisignature operations (True) or not (False).
num_participants: int instance-attribute ¶Number of participants of the multisignature wallet.
threshold: int instance-attribute ¶Number of participants need in order to sign a transaction.
__init__() ¶Initialize a Monero multisignature info.
MoneroMultisigInitResult ¶Models the result of initializing a multisig wallet which results in the multisig wallet's address xor another multisig hex to share with participants to create the wallet.
MoneroMultisigSignResult ¶MoneroAddressBookEntry ¶ Bases: SerializableStruct
Monero address book entry model.
MoneroAddressType ¶ Bases: IntEnum
Models a Monero public address type_.
.. _Monero public address type: https://docs.getmonero.org/public-address/
INTEGRATED_ADDRESS = 1 class-attribute instance-attribute ¶1 Indicates that the Monero address format is integrated_.
.. _integrated: https://docs.getmonero.org/public-address/integrated-address/
PRIMARY_ADDRESS = 0 class-attribute instance-attribute ¶0 Indicates that the Monero address format is standard_, also known as primary.
.. _standard: https://docs.getmonero.org/public-address/standard-address/
SUBADDRESS = 2 class-attribute instance-attribute ¶2 Indicates that the Monero address format is subaddress_.
.. _subaddress: https://docs.getmonero.org/public-address/subaddress/
MoneroDecodedAddress ¶Maintains metadata for a decoded address.
address: str instance-attribute ¶The decoded address.
address_type: MoneroAddressType instance-attribute ¶Type of the decoded address.
network_type: MoneroNetworkType instance-attribute ¶Network type of the decoded address.
__init__(address, address_type, network_type) ¶Initialize a Monero decoded address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address | str | The decoded address. | required |
address_type | MoneroAddressType | The type of the decoded address. | required |
network_type | MoneroNetworkType | Network type of the decoded address. | required |
MoneroAccountTag ¶ Bases: SerializableStruct
Models a Monero account tag.
MoneroWalletListener ¶Interface to receive wallet notifications.
__init__() ¶Initialize a wallet listener.
on_balances_changed(new_balance, new_unlocked_balance) ¶Invoked when the wallet's balances change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_balance | int | new balance. | required |
new_unlocked_balance | int | new unlocked balance. | required |
on_new_block(height) ¶Invoked when a new block is processed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height | int | the newly processed block. | required |
on_output_received(output) ¶Invoked when the wallet receives an output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output | MoneroOutputWallet | the received output. | required |
on_output_spent(output) ¶Invoked when the wallet spends an output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output | MoneroOutputWallet | the spent output. | required |
on_sync_progress(height, start_height, end_height, percent_done, message) ¶Invoked when sync progress is made.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height | int | height of the synced block. | required |
start_height | int | starting height of the sync request. | required |
end_height | int | ending height of the sync request. | required |
percent_done | float | sync progress as a percentage. | required |
message | str | human-readable description of the current progress. | required |
MoneroUtils ¶Collection of Monero utilities.
atomic_units_to_xmr(amount_atomic_units) staticmethod ¶Convert atomic units to XMR.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount_atomic_units | int | amount in atomic units to convert to XMR. | required |
Returns:
| Type | Description |
|---|---|
float | amount in XMR. |
configure_logging(path, console) staticmethod ¶Initialize logging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | the path to write logs to. | required |
console | bool | specifies whether or not to write to the console. | required |
dict_to_binary(dictionary) staticmethod ¶Converts a dictionary into binary format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dictionary | dict | The dictionary to convert in binary format. | required |
Returns:
| Type | Description |
|---|---|
bytes | Binary format. |
get_blocks_from_outputs(outputs) staticmethod ¶Get distinct blocks from outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outputs | list[MoneroOutputWallet] | Outputs to get blocks from. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroBlock] | Distinct blocks obtained from outputs. |
get_blocks_from_transfers(transfers) staticmethod ¶Get distinct blocks from transfers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transfers | list[MoneroTransfer] | Transfers to get blocks from. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroBlock] | Distinct blocks obtained from transfers. |
get_blocks_from_txs(txs) staticmethod ¶Get distinct blocks from transactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
txs | list[MoneroTxWallet] | Transactions to get blocks from. | required |
Returns:
| Type | Description |
|---|---|
list[MoneroBlock] | Distinct blocks obtained from transactions. |
get_integrated_address(network_type, standard_address, payment_id='') staticmethod ¶Get an integrated address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
network_type | MoneroNetworkType | is the network type of the integrated address. | required |
standard_address | str | is the address to derive the integrated address from. | required |
payment_id | str | optionally specifies the integrated address's payment id (defaults to random payment id). | '' |
Returns:
| Type | Description |
|---|---|
MoneroIntegratedAddress | the integrated address. |
get_payment_uri(config) staticmethod ¶Creates a payment URI from a tx configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MoneroTxConfig | specifies configuration for a payment URI. | required |
Returns:
| Type | Description |
|---|---|
str | the payment URI. |
get_ring_size() staticmethod ¶Get network-enforced ring size.
Returns:
| Type | Description |
|---|---|
int | network-enforced ring size. |
get_version() staticmethod ¶Get the version of the monero-python library.
Returns:
| Type | Description |
|---|---|
str | the version of this monero-python library |
is_valid_address(address, network_type) staticmethod ¶Determine if the given address is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address | str | is the address to validate. | required |
network_type | MoneroNetworkType | is the address's network type. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
is_valid_language(language) staticmethod ¶Indicates if the given language is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
language | str | is the language to validate | required |
Returns:
| Type | Description |
|---|---|
bool |
|
is_valid_mnemonic(mnemonic) staticmethod ¶Indicates if a mnemonic is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mnemonic | str | is the mnemonic to validate. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
is_valid_payment_id(payment_id) staticmethod ¶Indicates if a payment id is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payment_id | str | is the payment id to validate. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
is_valid_private_spend_key(private_spend_key) staticmethod ¶Indicates if a private spend key is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
private_spend_key | str | is the private spend key to validate. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
is_valid_private_view_key(private_view_key) staticmethod ¶Indicates if a private view key is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
private_view_key | str | is the private view key to validate. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
is_valid_public_spend_key(public_spend_key) staticmethod ¶Indicates if a public spend key is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_spend_key | str | is the public spend key to validate. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
is_valid_public_view_key(public_view_key) staticmethod ¶Indicates if a public view key is valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_view_key | str | is the public view key to validate. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
json_to_binary(json) staticmethod ¶Convert a JSON string into binary format.
Returns:
| Type | Description |
|---|---|
bytes | Binary format. |
set_log_level(loglevel) staticmethod ¶Set the library's log level with 0 being least verbose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loglevel | int | the library's log level. | required |
validate_address(address, network_type) staticmethod ¶Validates the given address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address | str | is the address to validate. | required |
network_type | MoneroNetworkType | is the address's network type. | required |
validate_mnemonic(mnemonic) staticmethod ¶Validates the given mnemonic phrase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mnemonic | str | is the mnemonic to validate. | required |
Raises:
| Type | Description |
|---|---|
MoneroError | if the given mnemonic is invalid. |
validate_payment_id(payment_id) staticmethod ¶Validate a payment id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payment_id | str | is the payment id to validate. | required |
Raises:
| Type | Description |
|---|---|
MoneroError | if the given payment id is invalid. |
validate_private_spend_key(private_spend_key) staticmethod ¶Validate a private spend key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
private_spend_key | str | is the private spend key to validate. | required |
Raises:
| Type | Description |
|---|---|
MoneroError | if the given private spend key is invalid. |
validate_private_view_key(private_view_key) staticmethod ¶Validate a private view key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
private_view_key | str | is the private view key to validate. | required |
Raises:
| Type | Description |
|---|---|
MoneroError | if the given private view key is invalid. |
validate_public_spend_key(public_spend_key) staticmethod ¶Validate a public spend key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_spend_key | str | is the public spend key to validate. | required |
Raises:
| Type | Description |
|---|---|
MoneroError | if the given public spend key is invalid. |
validate_public_view_key(public_view_key) staticmethod ¶Validate a public view key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_view_key | str | is the public view key to validate. | required |
Raises:
| Type | Description |
|---|---|
MoneroError | if the given public view key is invalid. |
xmr_to_atomic_units(amount_xmr) staticmethod ¶Convert XMR to atomic units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount_xmr | float | amount in XMR to convert to atomic units. | required |
Returns:
| Type | Description |
|---|---|
int | amount in atomic units. |
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 |
|
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 |
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 | 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 | 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() ¶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 |
|
is_connected_to_daemon() ¶Indicates if the wallet is connected a daemon.
Returns:
| Type | Description |
|---|---|
bool |
|
is_daemon_trusted() ¶Indicates if the daemon is trusted or untrusted.
Returns:
| Type | Description |
|---|---|
bool |
|
is_multisig() ¶Indicates if this wallet is a multisig wallet.
Returns:
| Type | Description |
|---|---|
bool |
|
is_multisig_import_needed() ¶Indicates if importing multisig data is needed for returning a correct balance.
Returns:
| Type | Description |
|---|---|
bool |
|
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 |
|
is_synced() ¶Indicates if the wallet is synced with the daemon.
Returns:
| Type | Description |
|---|---|
bool |
|
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 |
|
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 |
subaddress_idx | int | the subaddress index of the message signature (default | 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 |
background_mining | Optional[bool] | specifies if mining should occur in the background (default | None |
ignore_battery | Optional[bool] | specifies if the battery should be ignored for mining (default | 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 | 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 | 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 |
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. |
MoneroWalletFull ¶ Bases: MoneroWallet
Monero wallet implementation which uses monero-project's wallet2.
create_wallet(config) staticmethod ¶Create a new wallet with the given configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MoneroWalletConfig | the wallet configuration. | required |
Returns:
| Type | Description |
|---|---|
MoneroWalletFull | reference to the wallet instance. |
get_cache_file_buffer() ¶Get wallet cache file without using filesystem.
Returns:
| Type | Description |
|---|---|
str | Cache file buffer. |
get_keys_file_buffer(password, view_only) ¶Get wallet keys file without using filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password | str | The wallet password. | required |
view_only | bool | Get view-only keys. | required |
Returns:
| Type | Description |
|---|---|
str | Keys file buffer. |
get_seed_languages() staticmethod ¶Get a list of available languages for the wallet's seed.
Returns:
| Type | Description |
|---|---|
list[str] | the available languages for the wallet's seed. |
open_wallet(path, password, nettype) staticmethod ¶Open an existing wallet from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | is the path to the wallet file to open. | required |
password | str | is the password of the wallet file to open. | required |
nettype | MoneroNetworkType | is the wallet's network type. | required |
Returns:
| Type | Description |
|---|---|
MoneroWalletFull | reference to the wallet instance. |
wallet_exists(path) staticmethod ¶Indicates if a wallet exists at the given path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | is the path to check for a wallet. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
MoneroWalletKeys ¶ Bases: MoneroWallet
Implements a Monero wallet to provide basic key management.
create_wallet_from_keys(config) staticmethod ¶Create a wallet from an address, view key, and spend key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MoneroWalletConfig | is the wallet configuration (network type, address, view key, spend key, language). | required |
Returns:
| Type | Description |
|---|---|
MoneroWalletKeys | reference to the wallet instance. |
create_wallet_from_seed(config) staticmethod ¶Create a wallet from an existing mnemonic phrase or seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MoneroWalletConfig | is the wallet configuration (network type, seed, seed offset, is_multisig). | required |
Returns:
| Type | Description |
|---|---|
MoneroWalletKeys | reference to the wallet instance. |
create_wallet_random(config) staticmethod ¶Create a new wallet with a randomly generated seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MoneroWalletConfig | is the wallet configuration (network type and language). | required |
Returns:
| Type | Description |
|---|---|
MoneroWalletKeys | reference to the wallet instance. |
get_seed_languages() staticmethod ¶Get a list of available languages for the wallet's seed.
Returns:
| Type | Description |
|---|---|
list[str] | The available languages for the wallet's seed. |
MoneroWalletRpc ¶ Bases: MoneroWallet
Implements a Monero wallet using monero-wallet-rpc_.
.. _monero-wallet-rpc: https://docs.getmonero.org/rpc-library/wallet-rpc/
create_wallet(config) ¶Create and open a wallet on the monero-wallet-rpc server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MoneroWalletConfig | configures the wallet to create. | required |
get_rpc_connection() ¶Get the wallet's RPC connection.
Returns:
| Type | Description |
|---|---|
MoneroRpcConnection | None | the wallet's rpc connection. |
get_seed_languages() ¶Get all supported wallet seed languages.
Returns:
| Type | Description |
|---|---|
list[str] | wallet's supported languages. |
stop() ¶Save and close the current wallet and stop the RPC server.
0&&i[i.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return i}function B(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o