beem.block

class beem.block.Block(block, only_ops=False, only_virtual_ops=False, full=True, lazy=False, steem_instance=None)

Bases: beem.blockchainobject.BlockchainObject

Read a single block from the chain

Parameters:
  • block (int) – block number
  • steem_instance (beem.steem.Steem) – Steem instance
  • lazy (bool) – Use lazy loading
  • only_ops (bool) – Includes only operations, when set to True (default: False)
  • only_virtual_ops (bool) – Includes only virtual operations (default: False)

Instances of this class are dictionaries that come with additional methods (see below) that allow dealing with a block and it’s corresponding functions.

When only_virtual_ops is set to True, only_ops is always set to True.

Additionally to the block data, the block number is stored as self[“id”] or self.identifier.

>>> from beem.block import Block
>>> block = Block(1)
>>> print(block)
<Block 1>

Note

This class comes with its own caching function to reduce the load on the API server. Instances of this class can be refreshed with Account.refresh().

block_num

Returns the block number

operations

Returns all block operations as list

ops_statistics(add_to_ops_stat=None)

Retuns a statistic with the occurance of the different operation types

refresh()

Even though blocks never change, you freshly obtain its contents from an API with this method

time()

Return a datatime instance for the timestamp of this block

transactions

Returns all transactions as list

class beem.block.BlockHeader(data, klass=None, space_id=1, object_id=None, lazy=False, use_cache=True, id_item=None, steem_instance=None, *args, **kwargs)

Bases: beem.blockchainobject.BlockchainObject

block_num

Retuns the block number

refresh()

Even though blocks never change, you freshly obtain its contents from an API with this method

time()

Return a datatime instance for the timestamp of this block