evm.chains package

Submodules

evm.chains.chain module

class evm.chains.chain.Chain(chaindb, header=None)

Bases: object

An Chain is a combination of one or more VM classes. Each VM is associated with a range of blocks. The Chain class acts as a wrapper around these other VM classes, delegating operations to the appropriate VM depending on the current block number.

apply_transaction(transaction)

Apply the transaction to the current head block of the Chain.

classmethod configure(name, vm_configuration, **overrides)
create_header_from_parent(parent_header, **header_params)

Passthrough helper to the VM class of the block descending from the given header.

create_transaction(*args, **kwargs)

Passthrough helper to the current VM class.

create_unsigned_transaction(*args, **kwargs)

Passthrough helper to the current VM class.

classmethod from_genesis(chaindb, genesis_params, genesis_state=None)

Initialize the Chain from a genesis state.

classmethod from_genesis_header(chaindb, genesis_header)
get_ancestors(limit)
get_block()

Passthrough helper to the current VM class.

get_block_by_hash(block_hash)

Returns the requested block as specified by block hash.

get_block_header_by_hash(block_hash)

Returns the requested block header as specified by block hash.

Raises BlockNotFound if there’s no block header with the given hash in the db.

get_canonical_block_by_number(block_number)

Returns the block with the given number in the canonical chain.

Raises BlockNotFound if there’s no block with the given number in the canonical chain.

get_canonical_head()

Returns the block header at the canonical chain head.

Raises CanonicalHeadNotFound if there’s no head defined for the canonical chain.

get_chain_at_block_parent(block)

Returns a Chain instance with the given block’s parent at the chain head.

get_vm(header=None)

Return the vm instance for the given block number.

get_vm_class_for_block_number(block_number)

Return the vm class for the given block number.

header = None
import_block(block, perform_validation=True)

Import a complete block.

logger = <logging.Logger object>
mine_block(*args, **kwargs)

Mines the current block.

network_id = None
validate_block(block)

Performs validation on a block that is either being mined or imported.

Since block validation (specifically the uncle validation must have access to the ancestor blocks, this validation must occur at the Chain level.

TODO: move the seal validation down into the vm.

validate_seal(header)
validate_uncles(block)
vms_by_range = None

Module contents