graphenecommon.block module

class graphenecommon.block.Block(*args, use_cache=False, **kwargs)

Bases: graphenecommon.blockchainobject.BlockchainObject, graphenecommon.instance.AbstractBlockchainInstanceProvider

Read a single block from the chain

Parameters:
  • block (int) – block number
  • blockchain_instance (instance) – instance to use when accesing a RPC
  • lazy (bool) – Use lazy loading

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

from block import Block
block = Block(1)
print(block)

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().

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

type_id = 'n/a'
class graphenecommon.block.BlockHeader(*args, use_cache=False, **kwargs)

Bases: graphenecommon.blockchainobject.BlockchainObject, graphenecommon.instance.AbstractBlockchainInstanceProvider

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

type_id = 'n/a'