Blocks and the Chain¶
| Class | What it is | From |
|---|---|---|
MoneroBlockHeader | the header of a block: height, hash, timestamp, difficulty, reward | get_last_block_header, get_block_header_by_height, get_block_headers_by_range |
MoneroBlock | a header with its transactions, txs, and the one of its miner, miner_tx | get_block_by_height, get_blocks_by_range |
MoneroGetBlocksByHashResult, MoneroGetBlockHashesResult | the blocks, or the hashes, that follow the ones given | get_blocks_by_hash, get_block_hashes |
MoneroAltChain | a chain that forks from the main one | get_alt_chains |
MoneroHardForkInfo | the version of the rules of the chain, and the vote for the next one | get_hard_fork_info |
MoneroPruneResult | whether the chain of the daemon is pruned | prune_blockchain |
MoneroBlockHeader ¶
Bases: SerializableStruct
Models a Monero block header which contains information about the block.
cumulative_difficulty_high instance-attribute ¶
Cumulative difficulty of all blocks up to the block in the reply.
cumulative_difficulty_low instance-attribute ¶
Cumulative difficulty of all blocks up to the block in the reply.
depth instance-attribute ¶
The number of blocks succeeding this block on the blockchain. A larger number means an older block.
difficulty_high instance-attribute ¶
The strength of the Monero network based on mining power.
difficulty_low instance-attribute ¶
The strength of the Monero network based on mining power.
hash instance-attribute ¶
The hash of this block.
height instance-attribute ¶
The number of blocks preceding this block on the blockchain.
long_term_weight instance-attribute ¶
The long term block weight, based on the median weight of the preceding 100000 blocks.
major_version instance-attribute ¶
The major version of the monero protocol at this block height.
miner_tx_hash instance-attribute ¶
The hash of this block's coinbase transaction.
minor_version instance-attribute ¶
The minor version of the monero protocol at this block height.
nonce instance-attribute ¶
A cryptographic random one-time number used in mining a Monero block.
num_txs instance-attribute ¶
Number of transactions included in this block.
orphan_status instance-attribute ¶
If True, this block is not part of the longest chain.
pow_hash instance-attribute ¶
The hash, as a hexadecimal string, calculated from the block as proof-of-work.
prev_hash instance-attribute ¶
The hash of the block immediately preceding this block in the chain.
reward 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 instance-attribute ¶
Backward compatibility, same as weight, use that instead.
timestamp instance-attribute ¶
The unix time at which the block was recorded into the blockchain.
weight 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() ¶
deserialize(json) staticmethod ¶
Deserialize a MoneroBlockHeader from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json | str | MoneroBlockHeader in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroBlockHeader | deserialized instance. |
merge(other) ¶
Merge current block header with another one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | MoneroBlockHeader | other block header to merge with. | required |
Raises:
| Type | Description |
|---|---|
Exception | on reconciliation error. |
MoneroBlock ¶
Bases: MoneroBlockHeader
Models a Monero block in the blockchain.
hex instance-attribute ¶
Hexadecimal blob of block information.
miner_tx instance-attribute ¶
Miner transaction information.
tx_hashes instance-attribute ¶
List of hashes of non-coinbase transactions in the block.
txs instance-attribute ¶
List of non-coinbase transactions in the block.
__init__() ¶
Initialize a Monero block.
copy() ¶
deserialize(json) staticmethod ¶
Deserialize a MoneroBlock from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json | str | MoneroBlock in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroBlock | deserialized instance. |
merge(*args, **kwargs) ¶
merge(other: MoneroBlock) -> None
merge(other: MoneroBlockHeader) -> None
merge(other): Merge current block with another one.merge(other): Merge current block with another block header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | MoneroBlock | other block to merge with. | required |
Raises:
| Type | Description |
|---|---|
Exception | on reconciliation error. |
MoneroGetBlocksByHashResult ¶
Bases: SerializableStruct
Models the result of getting blocks by hash.
blocks instance-attribute ¶
The retrieved blocks.
current_height instance-attribute ¶
The daemon's chain height at request time.
__init__() ¶
Initialize a Monero get blocks by hash result.
deserialize(json) staticmethod ¶
Deserialize a MoneroGetBlocksByHashResult from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json | str | MoneroGetBlocksByHashResult in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroGetBlocksByHashResult | deserialized instance. |
MoneroGetBlockHashesResult ¶
Bases: SerializableStruct
Models the result of getting block hashes.
current_height instance-attribute ¶
The daemon's chain height at request time.
hashes instance-attribute ¶
The requested block hashes, starting at (and including) the last block in common with the request.
start_height instance-attribute ¶
The height of the first hash in hashes.
__init__() ¶
Initialize a Monero get block hashes result.
deserialize(json) staticmethod ¶
Deserialize a MoneroGetBlockHashesResult from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json | str | MoneroGetBlockHashesResult in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroGetBlockHashesResult | deserialized instance. |
MoneroAltChain ¶
Bases: SerializableStruct
Models an alternative chain seen by the node.
block_hashes instance-attribute ¶
List of all block hashes in the alternative chain that are not in the main chain.
difficulty_high instance-attribute ¶
Cumulative difficulty of all blocks in the alternative chain (Most-significant 64 bits of the 128-bit integer).
difficulty_low instance-attribute ¶
Cumulative difficulty of all blocks in the alternative chain (Least-significant 64 bits of 128-bit integer).
height instance-attribute ¶
The block height of the first diverging block of this alternative chain.
length instance-attribute ¶
The length in blocks of this alternative chain, after divergence.
main_chain_parent_block_hash 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.
deserialize(json) staticmethod ¶
Deserialize a MoneroAltChain from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json | str | MoneroAltChain in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroAltChain | deserialized instance. |
MoneroHardForkInfo ¶
Bases: MoneroRpcPaymentInfo
Models a Monero look up information regarding hard fork voting and readiness.
earliest_height instance-attribute ¶
Block height at which hard fork would be enabled if voted in.
is_enabled instance-attribute ¶
Tells if hard fork is enforced.
num_votes instance-attribute ¶
Number of votes towards hard fork.
state 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 instance-attribute ¶
Minimum percent of votes to trigger hard fork. Default is 80.
version instance-attribute ¶
The major block version for the fork.
voting instance-attribute ¶
Hard fork voting status.
window instance-attribute ¶
Number of blocks over which current votes are cast. Default is 10080 blocks.
__init__() ¶
Initialize a Monero hard fork info.
deserialize(json) staticmethod ¶
Deserialize a MoneroHardForkInfo from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json | str | MoneroHardForkInfo in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroHardForkInfo | deserialized instance. |
MoneroPruneResult ¶
Bases: SerializableStruct
Models the result of pruning the blockchain.
is_pruned instance-attribute ¶
Indicates if blockchain is pruned.
pruning_seed instance-attribute ¶
Blockheight at which pruning began.
__init__() ¶
Initialize a Monero prune result.
deserialize(json) staticmethod ¶
Deserialize a MoneroPruneResult from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json | str | MoneroPruneResult in JSON format. | required |
Returns:
| Type | Description |
|---|---|
MoneroPruneResult | deserialized instance. |