nanoblocks.block subpackage

The block subpackage contains classes to manage the blocks in the Nano network.

This subpackage is indirectly handled by the nanoblocks.network.NanoNetwork class.

Block

class nanoblocks.block.block.Block(account, block_definition, nano_network)

Bases: nanoblocks.base.nanoblocks_class.NanoblocksClass

Represents a block in the Nano network.

Gives an easy interface to access the metadata of the block.

property account_owner
property broadcastable

Retrieves whether this block can be broadcasted to the network or not. This will be true in the case it is recently built, signed and has a work hash attached.

property confirmed

Checks whether this block has been confirmed or not. This is a sync method that actively ask the node backend.

classmethod from_dict(dict_data, nano_network, initial_update=True)

Builds the block from a definition dictionary

property hash

Retrieves the hash of this block

property height

Retrieves the height of this block in the account history

property is_first

Retrieves whether this block is the first (all 0s) or not

property local_timestamp

Retrieves the local timestamp of this block.

request_confirmation(wait_time=30)

Forces a request for confirmation of this block to the node.

Parameters

wait_time – Number of seconds to wait for confirmation.

property subtype
to_dict()

Retrieves the dictionary version of this block.

property type
wait_for_confirmation(timeout_seconds=30)

Waits until the block has been confirmed. This method forces a confirmation on the block and waits until it has been solved.

class nanoblocks.block.block_factory.BlockFactory(nano_network)

Bases: nanoblocks.base.nanoblocks_class.NanoblocksClass

BLOCK_PROTO_MAP = {'change': <class 'nanoblocks.block.block_change.BlockChange'>, 'initial': <class 'nanoblocks.block.block.Block'>, 'receive': <class 'nanoblocks.block.block_receive.BlockReceive'>, 'send': <class 'nanoblocks.block.block_send.BlockSend'>, 'state': <class 'nanoblocks.block.block_state.BlockState'>, 'unknown': <class 'nanoblocks.block.block.Block'>}
build(account, block_definition, type_key='type')

Block SEND

class nanoblocks.block.block_send.BlockSend(account, block_definition, nano_network)

Bases: nanoblocks.block.block.Block

Represents a send block.

Gives an easy interface for send blocks.

property amount

Retrieves the amount of Nano received in case the block is read from the ledger.

property destination_account

Retrieves the account target for the amount. It is the account where this amount is sent to.

Block RECEIVE

class nanoblocks.block.block_receive.BlockReceive(account, block_definition, nano_network)

Bases: nanoblocks.block.block.Block

Represents a receive block.

Gives an easy interface for receive blocks.

property amount

Retrieves the amount of Nano received.

property source_account

Retrieves the account source of the amount. It is the account that sent the amount of this block.

Block STATE

class nanoblocks.block.block_state.BlockState(account, block_definition, nano_network)

Bases: nanoblocks.block.block.Block

Represents a state block.

Gives an easy interface for state blocks.

property account
property balance

Retrieves the total balance of the account after block confirmation.

property previous
property representative
property signature
property subtype
property work