beem.block

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

Bases: beem.blockchainobject.BlockchainObject

Read a single block from the chain

Parameters:
  • block (int) – block number
  • steem_instance (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 its corresponding functions.

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

In addition 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

json()
json_operations

Returns all block operations as list, all dates are strings.

json_transactions

Returns all transactions as list, all dates are strings.

operations

Returns all block operations as list

ops_statistics(add_to_ops_stat=None)

Returns a statistic with the occurrence 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 datetime instance for the timestamp of this block

transactions

Returns all transactions as list

class beem.block.BlockHeader(block, full=True, lazy=False, blockchain_instance=None, **kwargs)

Bases: beem.blockchainobject.BlockchainObject

Read a single block header from the chain

Parameters:
  • block (int) – block number
  • steem_instance (Steem) – Steem instance
  • lazy (bool) – Use lazy loading

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

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

Returns the block number

json()
refresh()

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

time()

Return a datetime instance for the timestamp of this block

class beem.block.Blocks(starting_block_num, count=1000, lazy=False, full=True, blockchain_instance=None, **kwargs)

Bases: list

Obtain a list of blocks

Parameters:
  • name_list (list) – list of accounts to fetch
  • count (int) – (optional) maximum number of accounts to fetch per call, defaults to 100
  • blockchain_instance (Steem/Hive) – Steem() or Hive() instance to use when accessing a RPCcreator = Account(creator, blockchain_instance=self)