Skip to content

Mining

Class What it is From
MoneroMiningStatus whether the daemon mines, with how many threads, to which address get_mining_status
MoneroBlockTemplate, MoneroMinerData what a miner needs to mine the next block get_block_template, get_miner_data
MoneroMinerTxSum the coins and the fees of the blocks of a range get_miner_tx_sum
MoneroGenerateBlocksResult the blocks mined on demand, on regtest generate_blocks
MoneroAuxiliaryPow, MoneroAddAuxiliaryPowResult merged mining: the proof of work of another chain, added to a block add_auxiliary_pow

MoneroMiningStatus

Bases: SerializableStruct

Models a Monero daemon mining status.

address instance-attribute

Account address daemon is mining to. None if not mining.

is_active instance-attribute

Indicates if mining is enabled.

is_background instance-attribute

Indicates if mining is running in background.

num_threads instance-attribute

Number of running mining threads.

speed instance-attribute

Mining power in hashes per seconds.

__init__()

Initialize a Monero daemon mining status.

deserialize(json) staticmethod

Deserialize a MoneroMiningStatus from a JSON string.

Parameters:

Name Type Description Default
json str

MoneroMiningStatus in JSON format.

required

Returns:

Type Description
MoneroMiningStatus

deserialized instance.

MoneroBlockTemplate

Bases: SerializableStruct

Monero block template to mine.

block_hashing_blob instance-attribute

Blob on which to try to find a valid nonce.

block_template_blob instance-attribute

Blob on which to try to mine a new block.

difficulty_high instance-attribute

Network difficulty (Most-significant 64 bits of 128-bit integer).

difficulty_low instance-attribute

Network difficulty (Least-significant 64 bits of 128-bit integer).

expected_reward instance-attribute

Coinbase reward expected to be received if block is successfully mined.

height instance-attribute

Height on which to mine.

next_seed_hash instance-attribute

Hash of the next block to use as seed for Random-X proof-of-work.

prev_hash instance-attribute

Hash of the most recent block on which to mine the next block.

reserved_offset instance-attribute

Byte offset into block_template_blob of the reserve_size scratch bytes the daemon left free in the coinbase transaction's extra field, where a pool writes its own data (e.g. an extra-nonce it varies to search the nonce space).

seed_hash instance-attribute

Hash of block to use as seed for Random-X proof-of-work.

seed_height instance-attribute

Height of block to use as seed for Random-X proof-of-work.

__init__()

Initialize a Monero block template.

deserialize(json) staticmethod

Deserialize a MoneroBlockTemplate from a JSON string.

Parameters:

Name Type Description Default
json str

MoneroBlockTemplate in JSON format.

required

Returns:

Type Description
MoneroBlockTemplate

deserialized instance.

MoneroMinerData

Bases: MoneroRpcPaymentInfo

Data needed to construct a block template for mining, e.g. for a pool that assembles its own block templates.

already_generated_coins instance-attribute

The total coins emitted so far, in atomic-units.

difficulty instance-attribute

The next block's difficulty as a hex string, e.g. "0x1f4".

height instance-attribute

The height of the next block to mine.

major_version instance-attribute

The next block's major version.

median_weight instance-attribute

The median block weight used for penalty calculations.

prev_hash instance-attribute

The hash of the previous (current top) block.

seed_hash instance-attribute

The seed hash used to select the RandomX dataset/cache.

tx_pool_backlog instance-attribute

The transactions currently in the pool eligible for the next block.

__init__()

Initialize a Monero miner data.

deserialize(json) staticmethod

Deserialize a MoneroMinerData from a JSON string.

Parameters:

Name Type Description Default
json str

MoneroMinerData in JSON format.

required

Returns:

Type Description
MoneroMinerData

deserialized instance.

MoneroMinerTxSum

Bases: SerializableStruct

Model for the sum of miner emissions and fees.

emission_sum_high instance-attribute

The new coins emitted in atomic-units. (Most significant 64 bits for 128 bit integer)

emission_sum_low instance-attribute

The new coins emitted in atomic-units. (Least significant 64 bits for 128 bit integer)

fee_sum_high instance-attribute

The sum of fees in atomic-units. (Most significant 64 bits for 128 bit integer)

fee_sum_low instance-attribute

The sum of fees in atomic-units. (Least significant 64 bits for 128 bit integer)

__init__()

Initialize a Monero miner transaction sum.

deserialize(json) staticmethod

Deserialize a MoneroMinerTxSum from a JSON string.

Parameters:

Name Type Description Default
json str

MoneroMinerTxSum in JSON format.

required

Returns:

Type Description
MoneroMinerTxSum

deserialized instance.

MoneroGenerateBlocksResult

Bases: SerializableStruct

Models the result of generating blocks.

block_hashes instance-attribute

Generated block hashes.

height instance-attribute

New chain height.

deserialize(json) staticmethod

Deserialize a MoneroGenerateBlocksResult from a JSON string.

Parameters:

Name Type Description Default
json str

MoneroGenerateBlocksResult in JSON format.

required

Returns:

Type Description
MoneroGenerateBlocksResult

deserialized instance.

MoneroAuxiliaryPow

Bases: SerializableStruct

Identifies an auxiliary chain's block by id and proof-of-work hash for merge mining.

hash instance-attribute

The auxiliary block's proof-of-work hash.

id instance-attribute

The auxiliary chain id.

__init__(*args, **kwargs)

__init__() -> None
__init__(id: str, hash: str) -> None
  • __init__(): Initialize an empty Monero auxiliary proof-of-work.
  • __init__(id, hash): Initialize a Monero auxiliary proof-of-work.

Parameters:

Name Type Description Default
id str

the auxiliary chain id.

required
hash str

the auxiliary block's proof-of-work hash.

required

deserialize(json) staticmethod

Deserialize a MoneroAuxiliaryPow from a JSON string.

Parameters:

Name Type Description Default
json str

MoneroAuxiliaryPow in JSON format.

required

Returns:

Type Description
MoneroAuxiliaryPow

deserialized instance.

MoneroAddAuxiliaryPowResult

Bases: MoneroRpcPaymentInfo

Models the result of adding auxiliary proof-of-work to a block template for merge mining.

aux_pow instance-attribute

The (possibly reordered) auxiliary proof-of-work entries.

block_hashing_blob instance-attribute

The updated block hashing blob.

block_template_blob instance-attribute

The updated block template blob.

merkle_root instance-attribute

The Merkle root committing to the auxiliary blocks.

merkle_tree_depth instance-attribute

The depth of the auxiliary Merkle tree.

__init__()

Initialize a Monero add auxiliary proof-of-work result.

deserialize(json) staticmethod

Deserialize a MoneroAddAuxiliaryPowResult from a JSON string.

Parameters:

Name Type Description Default
json str

MoneroAddAuxiliaryPowResult in JSON format.

required

Returns:

Type Description
MoneroAddAuxiliaryPowResult

deserialized instance.