Forks

Frontier

FrontierVM

class eth.vm.forks.frontier.FrontierVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
block_class

alias of FrontierBlock

add_receipt_to_header(old_header: BlockHeaderAPI, receipt: ReceiptAPI) BlockHeaderAPI

Apply the receipt to the old header, and return the resulting header. This may have storage-related side-effects. For example, pre-Byzantium, the state root hash is included in the receipt, and so must be stored into the database.

classmethod calculate_net_gas_refund(consumed_gas: int, gross_refund: int) int
static compute_difficulty(parent_header: BlockHeaderAPI, timestamp: int) int

Computes the difficulty for a frontier block based on the parent block.

configure_header(**header_params: Any) BlockHeader

Setup the current header with the provided parameters. This can be used to set fields like the gas limit or timestamp to value different than their computed defaults.

static create_header_from_parent(parent_header: BlockHeaderAPI, **header_params: Any) BlockHeader

Creates and initializes a new block header from the provided parent_header.

classmethod finalize_gas_used(transaction: SignedTransactionAPI, computation: ComputationAPI) int
static get_block_reward() int

Return the amount in wei that should be given to a miner as a reward for this block.

Note

This is an abstract method that must be implemented in subclasses

classmethod get_nephew_reward() int

Return the reward which should be given to the miner of the given nephew.

Note

This is an abstract method that must be implemented in subclasses

static get_uncle_reward(block_number: int, uncle: BlockHeaderAPI) int

Return the reward which should be given to the miner of the given uncle.

Note

This is an abstract method that must be implemented in subclasses

increment_blob_gas_used(old_header: BlockHeaderAPI, transaction: TransactionFieldsAPI) BlockHeaderAPI

Update the header by incrementing the blob_gas_used for the transaction.

classmethod make_receipt(base_header: BlockHeaderAPI, transaction: SignedTransactionAPI, computation: ComputationAPI, state: StateAPI) ReceiptAPI

Generate the receipt resulting from applying the transaction.

Parameters:
  • base_header – the header of the block before the transaction was applied.

  • transaction – the transaction used to generate the receipt

  • computation – the result of running the transaction computation

  • state – the resulting state, after executing the computation

Returns:

receipt

validate_transaction_against_header(base_header: BlockHeaderAPI, transaction: SignedTransactionAPI) None

Validate that the given transaction is valid to apply to the given header.

Parameters:
  • base_header – header before applying the transaction

  • transaction – the transaction to validate

Raises:

ValidationError if the transaction is not valid to apply

fork: str = 'frontier'

FrontierState

class eth.vm.forks.frontier.state.FrontierState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
account_db_class

alias of AccountDB

computation_class

alias of FrontierComputation

transaction_context_class

alias of FrontierTransactionContext

transaction_executor_class

alias of FrontierTransactionExecutor

apply_transaction(transaction: SignedTransactionAPI) ComputationAPI

Apply transaction to the vm state

Parameters:

transaction – the transaction to apply

Returns:

the computation

validate_transaction(transaction: SignedTransactionAPI) None

Validate the given transaction.

execution_context: ExecutionContextAPI

FrontierComputation

class eth.vm.forks.frontier.computation.FrontierComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the Frontier fork. Inherits from BaseComputation

classmethod apply_create_message(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI, parent_computation: ComputationAPI | None = None) ComputationAPI

Execute a VM message to create a new contract. This is where the VM-specific create logic exists.

classmethod apply_message(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI, parent_computation: ComputationAPI | None = None) ComputationAPI

Execute a VM message. This is where the VM-specific call logic exists.

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

Homestead

HomesteadVM

class eth.vm.forks.homestead.HomesteadVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
block_class

alias of HomesteadBlock

static compute_difficulty(parent_header: BlockHeaderAPI, timestamp: int) int

Computes the difficulty for a homestead block based on the parent block.

configure_header(**header_params: Any) BlockHeader

Setup the current header with the provided parameters. This can be used to set fields like the gas limit or timestamp to value different than their computed defaults.

static create_header_from_parent(parent_header: BlockHeaderAPI, **header_params: Any) BlockHeader

Creates and initializes a new block header from the provided parent_header.

fork: str = 'homestead'

HomesteadState

class eth.vm.forks.homestead.state.HomesteadState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
computation_class

alias of HomesteadComputation

validate_transaction(transaction: SignedTransactionAPI) None

Validate the given transaction.

execution_context: ExecutionContextAPI

HomesteadComputation

class eth.vm.forks.homestead.computation.HomesteadComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the Frontier fork. Inherits from FrontierComputation

classmethod apply_create_message(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI, parent_computation: ComputationAPI | None = None) ComputationAPI

Execute a VM message to create a new contract. This is where the VM-specific create logic exists.

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 255: <eth.vm.opcode._FastOpcode object>}

TangerineWhistle

TangerineWhistleVM

class eth.vm.forks.tangerine_whistle.TangerineWhistleVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
fork: str = 'tangerine-whistle'
support_dao_fork = False

TangerineWhistleState

class eth.vm.forks.tangerine_whistle.state.TangerineWhistleState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
computation_class

alias of TangerineWhistleComputation

execution_context: ExecutionContextAPI

TangerineWhistleComputation

class eth.vm.forks.tangerine_whistle.computation.TangerineWhistleComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the TangerineWhistle fork. Inherits from HomesteadComputation

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 255: <eth.vm.opcode._FastOpcode object>}

SpuriousDragon

SpuriousDragonVM

class eth.vm.forks.spurious_dragon.SpuriousDragonVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
block_class

alias of SpuriousDragonBlock

fork: str = 'spurious-dragon'

SpuriousDragonState

class eth.vm.forks.spurious_dragon.state.SpuriousDragonState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
computation_class

alias of SpuriousDragonComputation

transaction_executor_class

alias of SpuriousDragonTransactionExecutor

execution_context: ExecutionContextAPI

SpuriousDragonComputation

class eth.vm.forks.spurious_dragon.computation.SpuriousDragonComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the SpuriousDragon fork. Inherits from HomesteadComputation

classmethod apply_create_message(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI, parent_computation: ComputationAPI | None = None) ComputationAPI

Execute a VM message to create a new contract. This is where the VM-specific create logic exists.

classmethod validate_contract_code(contract_code: bytes) None
classmethod validate_create_message(message: MessageAPI) None

Class method for validating a create message.

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 255: <eth.vm.opcode._FastOpcode object>}

Byzantium

ByzantiumVM

class eth.vm.forks.byzantium.ByzantiumVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
block_class

alias of ByzantiumBlock

add_receipt_to_header(old_header: BlockHeaderAPI, receipt: ReceiptAPI) BlockHeaderAPI

Apply the receipt to the old header, and return the resulting header. This may have storage-related side-effects. For example, pre-Byzantium, the state root hash is included in the receipt, and so must be stored into the database.

static get_block_reward() int

Return the amount in wei that should be given to a miner as a reward for this block.

Note

This is an abstract method that must be implemented in subclasses

classmethod make_receipt(base_header: BlockHeaderAPI, transaction: SignedTransactionAPI, computation: ComputationAPI, state: StateAPI) ReceiptAPI

Generate the receipt resulting from applying the transaction.

Parameters:
  • base_header – the header of the block before the transaction was applied.

  • transaction – the transaction used to generate the receipt

  • computation – the result of running the transaction computation

  • state – the resulting state, after executing the computation

Returns:

receipt

classmethod validate_receipt(receipt: ReceiptAPI) None

Validate the given receipt.

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'byzantium'
get_uncle_reward

ByzantiumState

class eth.vm.forks.byzantium.state.ByzantiumState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
computation_class

alias of ByzantiumComputation

execution_context: ExecutionContextAPI

ByzantiumComputation

class eth.vm.forks.byzantium.computation.ByzantiumComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the Byzantium fork. Inherits from SpuriousDragonComputation

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 61: <eth.vm.opcode._FastOpcode object>, 62: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 250: <abc.opcode:STATICCALL object>, 253: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

Constantinople

ConstantinopleVM

class eth.vm.forks.constantinople.ConstantinopleVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
block_class

alias of ConstantinopleBlock

static get_block_reward() int

Return the amount in wei that should be given to a miner as a reward for this block.

Note

This is an abstract method that must be implemented in subclasses

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'constantinople'
get_uncle_reward

ConstantinopleState

class eth.vm.forks.constantinople.state.ConstantinopleState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
computation_class

alias of ConstantinopleComputation

execution_context: ExecutionContextAPI

ConstantinopleComputation

class eth.vm.forks.constantinople.computation.ConstantinopleComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the Constantinople fork. Inherits from ByzantiumComputation

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 27: <eth.vm.opcode._FastOpcode object>, 28: <eth.vm.opcode._FastOpcode object>, 29: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 61: <eth.vm.opcode._FastOpcode object>, 62: <eth.vm.opcode._FastOpcode object>, 63: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 245: <abc.opcode:CREATE2 object>, 250: <abc.opcode:STATICCALL object>, 253: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

Petersburg

PetersburgVM

class eth.vm.forks.petersburg.PetersburgVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
block_class

alias of PetersburgBlock

static get_block_reward() int

Return the amount in wei that should be given to a miner as a reward for this block.

Note

This is an abstract method that must be implemented in subclasses

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'petersburg'
get_uncle_reward

PetersburgState

class eth.vm.forks.petersburg.state.PetersburgState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
computation_class

alias of PetersburgComputation

execution_context: ExecutionContextAPI

PetersburgComputation

class eth.vm.forks.petersburg.computation.PetersburgComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the Petersburg fork. Inherits from ByzantiumComputation

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 27: <eth.vm.opcode._FastOpcode object>, 28: <eth.vm.opcode._FastOpcode object>, 29: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 61: <eth.vm.opcode._FastOpcode object>, 62: <eth.vm.opcode._FastOpcode object>, 63: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 245: <abc.opcode:CREATE2 object>, 250: <abc.opcode:STATICCALL object>, 253: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

Istanbul

IstanbulVM

class eth.vm.forks.istanbul.IstanbulVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)
block_class

alias of IstanbulBlock

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'istanbul'

IstanbulState

class eth.vm.forks.istanbul.state.IstanbulState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)
computation_class

alias of IstanbulComputation

execution_context: ExecutionContextAPI

IstanbulComputation

class eth.vm.forks.istanbul.computation.IstanbulComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

A class for all execution message computations in the Istanbul fork. Inherits from PetersburgComputation

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 27: <eth.vm.opcode._FastOpcode object>, 28: <eth.vm.opcode._FastOpcode object>, 29: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 61: <eth.vm.opcode._FastOpcode object>, 62: <eth.vm.opcode._FastOpcode object>, 63: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 70: <eth.vm.opcode._FastOpcode object>, 71: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 245: <abc.opcode:CREATE2 object>, 250: <abc.opcode:STATICCALL object>, 253: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

Muir Glacier

Submodules

eth.vm.forks.muir_glacier.blocks module

class eth.vm.forks.muir_glacier.blocks.MuirGlacierBlock(header: BlockHeaderAPI, transactions: Sequence[SignedTransactionAPI] | None = None, uncles: Sequence[BlockHeaderAPI] | None = None)

Bases: IstanbulBlock

transaction_builder

alias of MuirGlacierTransaction

property header
property transactions
property uncles
withdrawals: Tuple[WithdrawalAPI, ...]

eth.vm.forks.muir_glacier.computation module

class eth.vm.forks.muir_glacier.computation.MuirGlacierComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

Bases: IstanbulComputation

A class for all execution message computations in the MuirGlacier fork. Inherits from IstanbulComputation

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 27: <eth.vm.opcode._FastOpcode object>, 28: <eth.vm.opcode._FastOpcode object>, 29: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 61: <eth.vm.opcode._FastOpcode object>, 62: <eth.vm.opcode._FastOpcode object>, 63: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 70: <eth.vm.opcode._FastOpcode object>, 71: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 245: <abc.opcode:CREATE2 object>, 250: <abc.opcode:STATICCALL object>, 253: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

eth.vm.forks.muir_glacier.headers module

eth.vm.forks.muir_glacier.opcodes module

eth.vm.forks.muir_glacier.state module

class eth.vm.forks.muir_glacier.state.MuirGlacierState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)

Bases: IstanbulState

computation_class

alias of MuirGlacierComputation

execution_context: ExecutionContextAPI

eth.vm.forks.muir_glacier.transactions module

class eth.vm.forks.muir_glacier.transactions.MuirGlacierTransaction(*args, **kwargs)

Bases: IstanbulTransaction

classmethod create_unsigned_transaction(*, nonce: int, gas_price: int, gas: int, to: Address, value: int, data: bytes) MuirGlacierUnsignedTransaction

Create an unsigned transaction.

property data
property gas
property gas_price

Will raise AttributeError if get or set on a 1559 transaction.

property nonce
property r
property s
property to
property v

In old transactions, this v field combines the y_parity bit and the chain ID. All new usages should prefer accessing those fields directly. But if you must access the original v, then you can cast to this API first (after checking that type_id is None).

property value
class eth.vm.forks.muir_glacier.transactions.MuirGlacierUnsignedTransaction(*args, **kwargs)

Bases: IstanbulUnsignedTransaction

as_signed_transaction(private_key: PrivateKey, chain_id: int | None = None) MuirGlacierTransaction

Return a version of this transaction which has been signed using the provided private_key

property data
property gas
property gas_price
property nonce
property to
property value

Module contents

class eth.vm.forks.muir_glacier.MuirGlacierVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)

Bases: IstanbulVM

block_class

alias of MuirGlacierBlock

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'muir-glacier'

Berlin

Submodules

eth.vm.forks.berlin.blocks module

class eth.vm.forks.berlin.blocks.BerlinBlock(header: BlockHeaderAPI, transactions: Sequence[SignedTransactionAPI] | None = None, uncles: Sequence[BlockHeaderAPI] | None = None)

Bases: MuirGlacierBlock

receipt_builder

alias of BerlinReceiptBuilder

transaction_builder

alias of BerlinTransactionBuilder

property header
property transactions
property uncles

eth.vm.forks.berlin.computation module

class eth.vm.forks.berlin.computation.BerlinComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

Bases: MuirGlacierComputation

A class for all execution message computations in the Berlin fork. Inherits from MuirGlacierComputation

opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 27: <eth.vm.opcode._FastOpcode object>, 28: <eth.vm.opcode._FastOpcode object>, 29: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 61: <eth.vm.opcode._FastOpcode object>, 62: <eth.vm.opcode._FastOpcode object>, 63: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 70: <eth.vm.opcode._FastOpcode object>, 71: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 245: <abc.opcode:CREATE2 object>, 250: <abc.opcode:STATICCALL object>, 253: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

eth.vm.forks.berlin.constants module

eth.vm.forks.berlin.headers module

eth.vm.forks.berlin.logic module

class eth.vm.forks.berlin.logic.CallCodeEIP2929

Bases: LoadFeeByCacheWarmth, CallCodeEIP150

class eth.vm.forks.berlin.logic.CallEIP2929

Bases: LoadFeeByCacheWarmth, CallByzantium

class eth.vm.forks.berlin.logic.Create2EIP2929

Bases: Create2

generate_contract_address(stack_data: CreateOpcodeStackData, call_data: bytes, computation: ComputationAPI) Address
class eth.vm.forks.berlin.logic.CreateEIP2929

Bases: CreateByzantium

generate_contract_address(stack_data: CreateOpcodeStackData, call_data: bytes, computation: ComputationAPI) Address
class eth.vm.forks.berlin.logic.DelegateCallEIP2929

Bases: LoadFeeByCacheWarmth, DelegateCallEIP150

class eth.vm.forks.berlin.logic.LoadFeeByCacheWarmth

Bases: object

get_account_load_fee(computation: ComputationAPI, code_address: Address) int
class eth.vm.forks.berlin.logic.StaticCallEIP2929

Bases: LoadFeeByCacheWarmth, StaticCall

eth.vm.forks.berlin.logic.balance_eip2929(computation: ComputationAPI) None
eth.vm.forks.berlin.logic.extcodecopy_eip2929(computation: ComputationAPI) None
eth.vm.forks.berlin.logic.extcodehash_eip2929(computation: ComputationAPI) None

Return the code hash for a given address. EIP: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1052.md

eth.vm.forks.berlin.logic.extcodesize_eip2929(computation: ComputationAPI) None
eth.vm.forks.berlin.logic.selfdestruct_eip2929(computation: ComputationAPI) None
eth.vm.forks.berlin.logic.sload_eip2929(computation: ComputationAPI) None
eth.vm.forks.berlin.logic.sstore_eip2929(computation: ComputationAPI = '__no__default__') int
eth.vm.forks.berlin.logic.sstore_eip2929_generic(gas_schedule: NetSStoreGasSchedule = '__no__default__', computation: ComputationAPI = '__no__default__') int

eth.vm.forks.berlin.opcodes module

eth.vm.forks.berlin.receipts module

class eth.vm.forks.berlin.receipts.BerlinReceiptBuilder

Bases: ReceiptBuilderAPI

legacy_sedes

alias of Receipt

typed_receipt_class

alias of TypedReceipt

classmethod decode(encoded: bytes) ReceiptAPI

This decodes a receipt that is encoded to either a typed receipt, a legacy receipt, or the body of a typed receipt. It assumes that typed receipts are not rlp-encoded first.

If dealing with an object that is always rlp encoded, then use this instead:

rlp.decode(encoded, sedes=ReceiptBuilderAPI)

For example, you may receive a list of receipts via a devp2p request. Each receipt is either a (legacy) rlp list, or a (new-style) bytestring. Even if the receipt is a bytestring, it’s wrapped in an rlp bytestring, in that context. New-style receipts will not be wrapped in an RLP bytestring in other contexts. They will just be an EIP-2718 type-byte plus payload of concatenated bytes, which cannot be decoded as RLP. This happens for example, when calculating the receipt root hash.

classmethod deserialize(encoded: bytes | List[bytes]) ReceiptAPI

Extract a receipt from an encoded RLP object.

This method is used by rlp.decode(…, sedes=ReceiptBuilderAPI).

classmethod serialize(obj: ReceiptAPI) bytes | List[bytes]

Encode a receipt to a series of bytes used by RLP.

In the case of legacy receipt, it will actually be a list of bytes. That doesn’t show up here, because pyrlp doesn’t export type annotations.

This method is used by rlp.encode(obj).

class eth.vm.forks.berlin.receipts.TypedReceipt(type_id: int, proxy_target: ReceiptAPI)

Bases: ReceiptAPI, ReceiptDecoderAPI

copy(*args: Any, **kwargs: Any) ReceiptAPI

Return a copy of the receipt, optionally overwriting any of its properties.

classmethod decode(encoded: bytes) ReceiptAPI

This decodes a receipt that is encoded to either a typed receipt, a legacy receipt, or the body of a typed receipt. It assumes that typed receipts are not rlp-encoded first.

If dealing with an object that is always rlp encoded, then use this instead:

rlp.decode(encoded, sedes=ReceiptBuilderAPI)

For example, you may receive a list of receipts via a devp2p request. Each receipt is either a (legacy) rlp list, or a (new-style) bytestring. Even if the receipt is a bytestring, it’s wrapped in an rlp bytestring, in that context. New-style receipts will not be wrapped in an RLP bytestring in other contexts. They will just be an EIP-2718 type-byte plus payload of concatenated bytes, which cannot be decoded as RLP. This happens for example, when calculating the receipt root hash.

classmethod deserialize(encoded_unchecked: bytes | List[bytes]) ReceiptAPI
encode() bytes

This encodes a receipt, no matter if it’s: a legacy receipt, a typed receipt, or the payload of a typed receipt. See more context in decode.

classmethod get_payload_codec(type_id: int) Type[ReceiptDecoderAPI]
classmethod serialize(obj: TypedReceipt) bytes | List[bytes]
property bloom: int
property bloom_filter: BloomFilter
codecs = {1: <class 'eth.rlp.receipts.Receipt'>}
property gas_used: int
property logs: Sequence[LogAPI]
rlp_type = <rlp.sedes.binary.Binary object>
property state_root: bytes
type_id: int

eth.vm.forks.berlin.state module

class eth.vm.forks.berlin.state.BerlinState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)

Bases: MuirGlacierState

computation_class

alias of BerlinComputation

transaction_executor_class

alias of BerlinTransactionExecutor

execution_context: ExecutionContextAPI
class eth.vm.forks.berlin.state.BerlinTransactionExecutor(vm_state: StateAPI)

Bases: SpuriousDragonTransactionExecutor

build_computation(message: MessageAPI, transaction: SignedTransactionAPI) ComputationAPI

Apply the message to the VM and use the given transaction to retrieve the context from.

eth.vm.forks.berlin.transactions module

class eth.vm.forks.berlin.transactions.AccessListPayloadDecoder

Bases: TransactionDecoderAPI

classmethod decode(payload: bytes) SignedTransactionAPI

This decodes a transaction that is encoded to either a typed transaction or a legacy transaction, or even the payload of one of the transaction types. It assumes that typed transactions are not rlp-encoded first.

If dealing with an object that is rlp encoded first, then use this instead:

rlp.decode(encoded, sedes=TransactionBuilderAPI)

For example, you may receive a list of transactions via a devp2p request. Each transaction is either a (legacy) rlp list, or a (new-style) bytestring. Even if the transaction is a bytestring, it’s wrapped in an rlp bytestring, in that context. New-style transactions will not be wrapped in an RLP bytestring in other contexts. They will just be an EIP-2718 type-byte plus payload of concatenated bytes, which cannot be decoded as RLP. An example context for this is calculating the transaction root hash.

class eth.vm.forks.berlin.transactions.AccessListTransaction(*args, **kwargs)

Bases: Serializable, SignedTransactionMethods, SignedTransactionAPI

check_signature_validity() None

Check if the signature is valid. Raise a ValidationError if the signature is invalid.

encode() bytes

This encodes a transaction, no matter if it’s: a legacy transaction, a typed transaction, or the payload of a typed transaction. See more context in decode.

get_intrinsic_gas() int

Return the intrinsic gas for the transaction which is defined as the amount of gas that is needed before any code runs.

get_message_for_signing() bytes

Return the bytestring that should be signed in order to create a signed transaction.

get_sender() Address

Get the 20-byte address which sent this transaction.

This can be a slow operation. transaction.sender is always preferred.

make_receipt(status: bytes, gas_used: int, log_entries: Tuple[Tuple[bytes, Tuple[int, ...], bytes], ...]) ReceiptAPI

Build a receipt for this transaction.

Transactions have this responsibility because there are different types of transactions, which have different types of receipts. (See access-list transactions, which change the receipt encoding)

Parameters:
  • status – success or failure (used to be the state root after execution)

  • gas_used – cumulative usage of this transaction and the previous ones in the header

  • log_entries – logs generated during execution

property access_list

Get addresses to be accessed by a transaction, and their storage slots.

property blob_versioned_hashes: Hash32
property chain_id
property data
property gas
property gas_price

Will raise AttributeError if get or set on a 1559 transaction.

hash
property max_fee_per_blob_gas: int
property max_fee_per_gas: int

Will default to gas_price if this is a pre-1559 transaction.

property max_priority_fee_per_gas: int

Will default to gas_price if this is a pre-1559 transaction.

property nonce
property r
property s
property to
property value
property y_parity

The bit used to disambiguate elliptic curve signatures.

The only values this method will return are 0 or 1.

class eth.vm.forks.berlin.transactions.AccountAccesses(*args, **kwargs)

Bases: Serializable

property account
property storage_keys
class eth.vm.forks.berlin.transactions.BerlinLegacyTransaction(*args, **kwargs)

Bases: MuirGlacierTransaction

property data
property gas
property gas_price

Will raise AttributeError if get or set on a 1559 transaction.

property nonce
property r
property s
property to
property v

In old transactions, this v field combines the y_parity bit and the chain ID. All new usages should prefer accessing those fields directly. But if you must access the original v, then you can cast to this API first (after checking that type_id is None).

property value
class eth.vm.forks.berlin.transactions.BerlinTransactionBuilder

Bases: TransactionBuilderAPI

Responsible for serializing transactions of ambiguous type.

It dispatches to either the legacy transaction type or the new typed transaction, depending on the nature of the encoded/decoded transaction.

legacy_signed

alias of BerlinLegacyTransaction

legacy_unsigned

alias of BerlinUnsignedLegacyTransaction

typed_transaction

alias of TypedTransaction

classmethod create_unsigned_transaction(*, nonce: int, gas_price: int, gas: int, to: Address, value: int, data: bytes) UnsignedTransactionAPI

Create an unsigned transaction.

classmethod decode(encoded: bytes) SignedTransactionAPI

This decodes a transaction that is encoded to either a typed transaction or a legacy transaction, or even the payload of one of the transaction types. It assumes that typed transactions are not rlp-encoded first.

If dealing with an object that is rlp encoded first, then use this instead:

rlp.decode(encoded, sedes=TransactionBuilderAPI)

For example, you may receive a list of transactions via a devp2p request. Each transaction is either a (legacy) rlp list, or a (new-style) bytestring. Even if the transaction is a bytestring, it’s wrapped in an rlp bytestring, in that context. New-style transactions will not be wrapped in an RLP bytestring in other contexts. They will just be an EIP-2718 type-byte plus payload of concatenated bytes, which cannot be decoded as RLP. An example context for this is calculating the transaction root hash.

classmethod deserialize(encoded: bytes | List[bytes]) SignedTransactionAPI

Extract a transaction from an encoded RLP object.

This method is used by rlp.decode(…, sedes=TransactionBuilderAPI).

classmethod new_access_list_transaction(chain_id: int, nonce: int, gas_price: int, gas: int, to: Address, value: int, data: bytes, access_list: Sequence[Tuple[Address, Sequence[int]]], y_parity: int, r: int, s: int) TypedTransaction
classmethod new_transaction(nonce: int, gas_price: int, gas: int, to: Address, value: int, data: bytes, v: int, r: int, s: int) SignedTransactionAPI

Create a signed transaction.

classmethod new_unsigned_access_list_transaction(chain_id: int, nonce: int, gas_price: int, gas: int, to: Address, value: int, data: bytes, access_list: Sequence[Tuple[Address, Sequence[int]]]) UnsignedAccessListTransaction
classmethod serialize(obj: SignedTransactionAPI) bytes | List[bytes]

Encode a transaction to a series of bytes used by RLP.

In the case of legacy transactions, it will actually be a list of bytes. That doesn’t show up here, because pyrlp doesn’t export type annotations.

This method is used by rlp.encode(obj).

class eth.vm.forks.berlin.transactions.BerlinUnsignedLegacyTransaction(*args, **kwargs)

Bases: MuirGlacierUnsignedTransaction

as_signed_transaction(private_key: PrivateKey, chain_id: int | None = None) BerlinLegacyTransaction

Return a version of this transaction which has been signed using the provided private_key

property data
property gas
property gas_price
property nonce
property to
property value
class eth.vm.forks.berlin.transactions.TypedTransaction(type_id: int, proxy_target: SignedTransactionAPI)

Bases: SignedTransactionMethods, SignedTransactionAPI, TransactionDecoderAPI

receipt_builder

alias of BerlinReceiptBuilder

check_signature_validity() None

Check if the signature is valid. Raise a ValidationError if the signature is invalid.

copy(**overrides: Any) TypedTransaction

Return a copy of the transaction.

classmethod decode(encoded: bytes) SignedTransactionAPI

This decodes a transaction that is encoded to either a typed transaction or a legacy transaction, or even the payload of one of the transaction types. It assumes that typed transactions are not rlp-encoded first.

If dealing with an object that is rlp encoded first, then use this instead:

rlp.decode(encoded, sedes=TransactionBuilderAPI)

For example, you may receive a list of transactions via a devp2p request. Each transaction is either a (legacy) rlp list, or a (new-style) bytestring. Even if the transaction is a bytestring, it’s wrapped in an rlp bytestring, in that context. New-style transactions will not be wrapped in an RLP bytestring in other contexts. They will just be an EIP-2718 type-byte plus payload of concatenated bytes, which cannot be decoded as RLP. An example context for this is calculating the transaction root hash.

classmethod deserialize(encoded_unchecked: bytes | List[bytes]) SignedTransactionAPI
encode() bytes

This encodes a transaction, no matter if it’s: a legacy transaction, a typed transaction, or the payload of a typed transaction. See more context in decode.

get_intrinsic_gas() int

Return the intrinsic gas for the transaction which is defined as the amount of gas that is needed before any code runs.

get_message_for_signing() bytes

Return the bytestring that should be signed in order to create a signed transaction.

classmethod get_payload_codec(type_id: int) Type[TransactionDecoderAPI]
get_sender() Address

Get the 20-byte address which sent this transaction.

This can be a slow operation. transaction.sender is always preferred.

make_receipt(status: bytes, gas_used: int, log_entries: Tuple[Tuple[bytes, Tuple[int, ...], bytes], ...]) ReceiptAPI

Build a receipt for this transaction.

Transactions have this responsibility because there are different types of transactions, which have different types of receipts. (See access-list transactions, which change the receipt encoding)

Parameters:
  • status – success or failure (used to be the state root after execution)

  • gas_used – cumulative usage of this transaction and the previous ones in the header

  • log_entries – logs generated during execution

classmethod serialize(obj: TypedTransaction) bytes | List[bytes]
property access_list: Sequence[Tuple[Address, Sequence[int]]]

Get addresses to be accessed by a transaction, and their storage slots.

property blob_versioned_hashes: Hash32
property chain_id: int
property data: bytes
decoders: Dict[int, Type[TransactionDecoderAPI]] = {1: <class 'eth.vm.forks.berlin.transactions.AccessListPayloadDecoder'>}
property gas: int
property gas_price: int

Will raise AttributeError if get or set on a 1559 transaction.

hash
property max_fee_per_blob_gas: int
property max_fee_per_gas: int

Will default to gas_price if this is a pre-1559 transaction.

property max_priority_fee_per_gas: int

Will default to gas_price if this is a pre-1559 transaction.

property nonce: int
property r: int
rlp_type = <rlp.sedes.binary.Binary object>
property s: int
property to: Address
property value: int
property y_parity: int

The bit used to disambiguate elliptic curve signatures.

The only values this method will return are 0 or 1.

class eth.vm.forks.berlin.transactions.UnsignedAccessListTransaction(*args, **kwargs)

Bases: Serializable, UnsignedTransactionAPI

as_signed_transaction(private_key: PrivateKey, chain_id: int | None = None) TypedTransaction

Return a version of this transaction which has been signed using the provided private_key

gas_used_by(computation: ComputationAPI) int

Return the gas used by the given computation. In Frontier, for example, this is sum of the intrinsic cost and the gas used during computation.

get_intrinsic_gas() int

Return the intrinsic gas for the transaction which is defined as the amount of gas that is needed before any code runs.

get_message_for_signing() bytes
validate() None

Hook called during instantiation to ensure that all transaction parameters pass validation rules.

property access_list

Get addresses to be accessed by a transaction, and their storage slots.

property chain_id
property data
property gas
property gas_price
property intrinsic_gas: int

Convenience property for the return value of get_intrinsic_gas

property max_fee_per_gas: int
property max_priority_fee_per_gas: int
property nonce
property to
property value

Module contents

class eth.vm.forks.berlin.BerlinVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)

Bases: MuirGlacierVM

block_class

alias of BerlinBlock

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'berlin'

London

Submodules

eth.vm.forks.london.blocks module

class eth.vm.forks.london.blocks.LondonBackwardsHeader

Bases: BlockHeaderSedesAPI

An rlp sedes class for block headers.

It can serialize and deserialize both London and pre-London headers.

classmethod deserialize(encoded: List[bytes]) BlockHeaderAPI

Extract a header from an encoded RLP object.

This method is used by rlp.decode(…, sedes=TransactionBuilderAPI).

classmethod serialize(obj: BlockHeaderAPI) List[bytes]

Encode a header to a series of bytes used by RLP.

This method is used by rlp.encode(obj).

class eth.vm.forks.london.blocks.LondonBlock(header: BlockHeaderAPI, transactions: Sequence[SignedTransactionAPI] | None = None, uncles: Sequence[BlockHeaderAPI] | None = None)

Bases: BerlinBlock

receipt_builder

alias of LondonReceiptBuilder

transaction_builder

alias of LondonTransactionBuilder

property header
property transactions
property uncles
class eth.vm.forks.london.blocks.LondonBlockHeader(difficulty: int, block_number: BlockNumber, gas_limit: int, timestamp: int | None = None, coinbase: Address = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', parent_hash: Hash32 = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', uncles_hash: Hash32 = b'\x1d\xccM\xe8\xde\xc7]z\xab\x85\xb5g\xb6\xcc\xd4\x1a\xd3\x12E\x1b\x94\x8at\x13\xf0\xa1B\xfd@\xd4\x93G', state_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', transaction_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', receipt_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', bloom: int = 0, gas_used: int = 0, extra_data: bytes = b'', mix_hash: Hash32 = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', nonce: bytes = b'\x00\x00\x00\x00\x00\x00\x00B', base_fee_per_gas: int = 0)

Bases: Serializable, BlockHeaderAPI

property base_fee_per_gas

Return the base fee per gas of the block.

Set to None in pre-EIP-1559 (London) header.

property blob_gas_used: int

Return blob gas used.

property block_number
property bloom
property coinbase
property difficulty
property excess_blob_gas: int

Return excess blob gas.

property extra_data
property gas_limit
property gas_used
property hash: Hash32

Return the hash of the block header.

property hex_hash: str

Return the hash as a hex string.

property is_genesis: bool

Return True if this header represents the genesis block of the chain, otherwise False.

property mining_hash: Hash32

Return the mining hash of the block header.

property mix_hash
property nonce
property parent_beacon_block_root: Hash32 | None

Return the hash of the parent beacon block.

property parent_hash
property receipt_root
property state_root
property timestamp
property transaction_root
property uncles_hash
property withdrawals_root: Hash32 | None

Return the withdrawals root of the block.

Set to None in pre-Shanghai header.

class eth.vm.forks.london.blocks.LondonMiningHeader(*args, **kwargs)

Bases: Serializable, MiningHeaderAPI

property base_fee_per_gas

Return the base fee per gas of the block.

Set to None in pre-EIP-1559 (London) header.

property block_number
property bloom
property coinbase
property difficulty
property extra_data
property gas_limit
property gas_used
property parent_hash
property receipt_root
property state_root
property timestamp
property transaction_root
property uncles_hash

eth.vm.forks.london.computation module

class eth.vm.forks.london.computation.LondonComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

Bases: BerlinComputation

A class for all execution message computations in the London fork. Inherits from BerlinComputation

classmethod validate_contract_code(contract_code: bytes) None
opcodes: Dict[int, OpcodeAPI] = {0: <eth.vm.opcode._FastOpcode object>, 1: <eth.vm.opcode._FastOpcode object>, 2: <eth.vm.opcode._FastOpcode object>, 3: <eth.vm.opcode._FastOpcode object>, 4: <eth.vm.opcode._FastOpcode object>, 5: <eth.vm.opcode._FastOpcode object>, 6: <eth.vm.opcode._FastOpcode object>, 7: <eth.vm.opcode._FastOpcode object>, 8: <eth.vm.opcode._FastOpcode object>, 9: <eth.vm.opcode._FastOpcode object>, 10: <eth.vm.opcode._FastOpcode object>, 11: <eth.vm.opcode._FastOpcode object>, 16: <eth.vm.opcode._FastOpcode object>, 17: <eth.vm.opcode._FastOpcode object>, 18: <eth.vm.opcode._FastOpcode object>, 19: <eth.vm.opcode._FastOpcode object>, 20: <eth.vm.opcode._FastOpcode object>, 21: <eth.vm.opcode._FastOpcode object>, 22: <eth.vm.opcode._FastOpcode object>, 23: <eth.vm.opcode._FastOpcode object>, 24: <eth.vm.opcode._FastOpcode object>, 25: <eth.vm.opcode._FastOpcode object>, 26: <eth.vm.opcode._FastOpcode object>, 27: <eth.vm.opcode._FastOpcode object>, 28: <eth.vm.opcode._FastOpcode object>, 29: <eth.vm.opcode._FastOpcode object>, 32: <eth.vm.opcode._FastOpcode object>, 48: <eth.vm.opcode._FastOpcode object>, 49: <eth.vm.opcode._FastOpcode object>, 50: <eth.vm.opcode._FastOpcode object>, 51: <eth.vm.opcode._FastOpcode object>, 52: <eth.vm.opcode._FastOpcode object>, 53: <eth.vm.opcode._FastOpcode object>, 54: <eth.vm.opcode._FastOpcode object>, 55: <eth.vm.opcode._FastOpcode object>, 56: <eth.vm.opcode._FastOpcode object>, 57: <eth.vm.opcode._FastOpcode object>, 58: <eth.vm.opcode._FastOpcode object>, 59: <eth.vm.opcode._FastOpcode object>, 60: <eth.vm.opcode._FastOpcode object>, 61: <eth.vm.opcode._FastOpcode object>, 62: <eth.vm.opcode._FastOpcode object>, 63: <eth.vm.opcode._FastOpcode object>, 64: <eth.vm.opcode._FastOpcode object>, 65: <eth.vm.opcode._FastOpcode object>, 66: <eth.vm.opcode._FastOpcode object>, 67: <eth.vm.opcode._FastOpcode object>, 68: <eth.vm.opcode._FastOpcode object>, 69: <eth.vm.opcode._FastOpcode object>, 70: <eth.vm.opcode._FastOpcode object>, 71: <eth.vm.opcode._FastOpcode object>, 72: <eth.vm.opcode._FastOpcode object>, 80: <eth.vm.opcode._FastOpcode object>, 81: <eth.vm.opcode._FastOpcode object>, 82: <eth.vm.opcode._FastOpcode object>, 83: <eth.vm.opcode._FastOpcode object>, 84: <eth.vm.opcode._FastOpcode object>, 85: <eth.vm.opcode._FastOpcode object>, 86: <eth.vm.opcode._FastOpcode object>, 87: <eth.vm.opcode._FastOpcode object>, 88: <eth.vm.opcode._FastOpcode object>, 89: <eth.vm.opcode._FastOpcode object>, 90: <eth.vm.opcode._FastOpcode object>, 91: <eth.vm.opcode._FastOpcode object>, 96: <eth.vm.opcode._FastOpcode object>, 97: <eth.vm.opcode._FastOpcode object>, 98: <eth.vm.opcode._FastOpcode object>, 99: <eth.vm.opcode._FastOpcode object>, 100: <eth.vm.opcode._FastOpcode object>, 101: <eth.vm.opcode._FastOpcode object>, 102: <eth.vm.opcode._FastOpcode object>, 103: <eth.vm.opcode._FastOpcode object>, 104: <eth.vm.opcode._FastOpcode object>, 105: <eth.vm.opcode._FastOpcode object>, 106: <eth.vm.opcode._FastOpcode object>, 107: <eth.vm.opcode._FastOpcode object>, 108: <eth.vm.opcode._FastOpcode object>, 109: <eth.vm.opcode._FastOpcode object>, 110: <eth.vm.opcode._FastOpcode object>, 111: <eth.vm.opcode._FastOpcode object>, 112: <eth.vm.opcode._FastOpcode object>, 113: <eth.vm.opcode._FastOpcode object>, 114: <eth.vm.opcode._FastOpcode object>, 115: <eth.vm.opcode._FastOpcode object>, 116: <eth.vm.opcode._FastOpcode object>, 117: <eth.vm.opcode._FastOpcode object>, 118: <eth.vm.opcode._FastOpcode object>, 119: <eth.vm.opcode._FastOpcode object>, 120: <eth.vm.opcode._FastOpcode object>, 121: <eth.vm.opcode._FastOpcode object>, 122: <eth.vm.opcode._FastOpcode object>, 123: <eth.vm.opcode._FastOpcode object>, 124: <eth.vm.opcode._FastOpcode object>, 125: <eth.vm.opcode._FastOpcode object>, 126: <eth.vm.opcode._FastOpcode object>, 127: <eth.vm.opcode._FastOpcode object>, 128: <eth.vm.opcode._FastOpcode object>, 129: <eth.vm.opcode._FastOpcode object>, 130: <eth.vm.opcode._FastOpcode object>, 131: <eth.vm.opcode._FastOpcode object>, 132: <eth.vm.opcode._FastOpcode object>, 133: <eth.vm.opcode._FastOpcode object>, 134: <eth.vm.opcode._FastOpcode object>, 135: <eth.vm.opcode._FastOpcode object>, 136: <eth.vm.opcode._FastOpcode object>, 137: <eth.vm.opcode._FastOpcode object>, 138: <eth.vm.opcode._FastOpcode object>, 139: <eth.vm.opcode._FastOpcode object>, 140: <eth.vm.opcode._FastOpcode object>, 141: <eth.vm.opcode._FastOpcode object>, 142: <eth.vm.opcode._FastOpcode object>, 143: <eth.vm.opcode._FastOpcode object>, 144: <eth.vm.opcode._FastOpcode object>, 145: <eth.vm.opcode._FastOpcode object>, 146: <eth.vm.opcode._FastOpcode object>, 147: <eth.vm.opcode._FastOpcode object>, 148: <eth.vm.opcode._FastOpcode object>, 149: <eth.vm.opcode._FastOpcode object>, 150: <eth.vm.opcode._FastOpcode object>, 151: <eth.vm.opcode._FastOpcode object>, 152: <eth.vm.opcode._FastOpcode object>, 153: <eth.vm.opcode._FastOpcode object>, 154: <eth.vm.opcode._FastOpcode object>, 155: <eth.vm.opcode._FastOpcode object>, 156: <eth.vm.opcode._FastOpcode object>, 157: <eth.vm.opcode._FastOpcode object>, 158: <eth.vm.opcode._FastOpcode object>, 159: <eth.vm.opcode._FastOpcode object>, 160: <eth.vm.opcode._FastOpcode object>, 161: <eth.vm.opcode._FastOpcode object>, 162: <eth.vm.opcode._FastOpcode object>, 163: <eth.vm.opcode._FastOpcode object>, 164: <eth.vm.opcode._FastOpcode object>, 240: <abc.opcode:CREATE object>, 241: <abc.opcode:CALL object>, 242: <abc.opcode:CALLCODE object>, 243: <eth.vm.opcode._FastOpcode object>, 244: <abc.opcode:DELEGATECALL object>, 245: <abc.opcode:CREATE2 object>, 250: <abc.opcode:STATICCALL object>, 253: <eth.vm.opcode._FastOpcode object>, 255: <eth.vm.opcode._FastOpcode object>}

eth.vm.forks.london.constants module

eth.vm.forks.london.headers module

class eth.vm.forks.london.headers.LondonBackwardsHeader

Bases: BlockHeaderSedesAPI

An rlp sedes class for block headers.

It can serialize and deserialize both London and pre-London headers.

classmethod deserialize(encoded: List[bytes]) BlockHeaderAPI

Extract a header from an encoded RLP object.

This method is used by rlp.decode(…, sedes=TransactionBuilderAPI).

classmethod serialize(obj: BlockHeaderAPI) List[bytes]

Encode a header to a series of bytes used by RLP.

This method is used by rlp.encode(obj).

eth.vm.forks.london.headers.calculate_expected_base_fee_per_gas(parent_header: BlockHeaderAPI) int
eth.vm.forks.london.headers.create_london_header_from_parent(difficulty_fn: Callable[[BlockHeaderAPI, int], int] = '__no__default__', parent_header: BlockHeaderAPI | None = '__no__default__', **header_params: Any) BlockHeaderAPI

eth.vm.forks.london.opcodes module

eth.vm.forks.london.receipts module

class eth.vm.forks.london.receipts.LondonReceiptBuilder

Bases: BerlinReceiptBuilder

typed_receipt_class

alias of LondonTypedReceipt

class eth.vm.forks.london.receipts.LondonTypedReceipt(type_id: int, proxy_target: ReceiptAPI)

Bases: TypedReceipt

codecs: Dict[int, Type[Receipt]] = {1: <class 'eth.rlp.receipts.Receipt'>, 2: <class 'eth.rlp.receipts.Receipt'>}

eth.vm.forks.london.state module

class eth.vm.forks.london.state.LondonState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)

Bases: BerlinState

computation_class

alias of LondonComputation

transaction_executor_class

alias of LondonTransactionExecutor

get_gas_price(transaction: SignedTransactionAPI) int

Return the gas price of the given transaction.

Factor in the current block’s base gas price, if appropriate. (See EIP-1559)

get_tip(transaction: SignedTransactionAPI) int

Return the gas price that gets allocated to the miner/validator.

Pre-EIP-1559 that would be the full transaction gas price. After, it would be the tip price (potentially reduced, if the base fee is so high that it surpasses the transaction’s maximum gas price after adding the tip).

get_transaction_context(transaction: SignedTransactionAPI) TransactionContextAPI

London-specific transaction context creation, where gas_price includes the block base fee

validate_transaction(transaction: SignedTransactionAPI) None

Validate the given transaction.

property base_fee: int

Return the current base_fee from the current execution_context

Raises a NotImplementedError if called in an execution context prior to the London hard fork.

execution_context: ExecutionContextAPI
class eth.vm.forks.london.state.LondonTransactionExecutor(vm_state: StateAPI)

Bases: BerlinTransactionExecutor

build_evm_message(transaction: SignedTransactionAPI) MessageAPI

Build and return a MessageAPI from the given transaction.

classmethod calculate_gas_refund(computation: ComputationAPI, gas_used: int) int

eth.vm.forks.london.storage module

eth.vm.forks.london.transactions module

class eth.vm.forks.london.transactions.DynamicFeePayloadDecoder

Bases: TransactionDecoderAPI

classmethod decode(payload: bytes) SignedTransactionAPI

This decodes a transaction that is encoded to either a typed transaction or a legacy transaction, or even the payload of one of the transaction types. It assumes that typed transactions are not rlp-encoded first.

If dealing with an object that is rlp encoded first, then use this instead:

rlp.decode(encoded, sedes=TransactionBuilderAPI)

For example, you may receive a list of transactions via a devp2p request. Each transaction is either a (legacy) rlp list, or a (new-style) bytestring. Even if the transaction is a bytestring, it’s wrapped in an rlp bytestring, in that context. New-style transactions will not be wrapped in an RLP bytestring in other contexts. They will just be an EIP-2718 type-byte plus payload of concatenated bytes, which cannot be decoded as RLP. An example context for this is calculating the transaction root hash.

class eth.vm.forks.london.transactions.DynamicFeeTransaction(*args, **kwargs)

Bases: Serializable, SignedTransactionMethods, SignedTransactionAPI

check_signature_validity() None

Check if the signature is valid. Raise a ValidationError if the signature is invalid.

encode() bytes

This encodes a transaction, no matter if it’s: a legacy transaction, a typed transaction, or the payload of a typed transaction. See more context in decode.

get_intrinsic_gas() int

Return the intrinsic gas for the transaction which is defined as the amount of gas that is needed before any code runs.

get_message_for_signing() bytes

Return the bytestring that should be signed in order to create a signed transaction.

get_sender() Address

Get the 20-byte address which sent this transaction.

This can be a slow operation. transaction.sender is always preferred.

make_receipt(status: bytes, gas_used: int, log_entries: Tuple[Tuple[bytes, Tuple[int, ...], bytes], ...]) ReceiptAPI

Build a receipt for this transaction.

Transactions have this responsibility because there are different types of transactions, which have different types of receipts. (See access-list transactions, which change the receipt encoding)

Parameters:
  • status – success or failure (used to be the state root after execution)

  • gas_used – cumulative usage of this transaction and the previous ones in the header

  • log_entries – logs generated during execution

property access_list

Get addresses to be accessed by a transaction, and their storage slots.

property blob_versioned_hashes: Hash32
property chain_id
property data
property gas
property gas_price: None

Will raise AttributeError if get or set on a 1559 transaction.

hash
property max_fee_per_blob_gas: int
property max_fee_per_gas

Will default to gas_price if this is a pre-1559 transaction.

property max_priority_fee_per_gas

Will default to gas_price if this is a pre-1559 transaction.

property nonce
property r
property s
property to
property value
property y_parity

The bit used to disambiguate elliptic curve signatures.

The only values this method will return are 0 or 1.

class eth.vm.forks.london.transactions.LondonLegacyTransaction(*args, **kwargs)

Bases: BerlinLegacyTransaction

property data
property gas
property gas_price

Will raise AttributeError if get or set on a 1559 transaction.

property nonce
property r
property s
property to
property v

In old transactions, this v field combines the y_parity bit and the chain ID. All new usages should prefer accessing those fields directly. But if you must access the original v, then you can cast to this API first (after checking that type_id is None).

property value
class eth.vm.forks.london.transactions.LondonTransactionBuilder

Bases: BerlinTransactionBuilder

legacy_signed

alias of LondonLegacyTransaction

legacy_unsigned

alias of LondonUnsignedLegacyTransaction

typed_transaction

alias of LondonTypedTransaction

classmethod new_dynamic_fee_transaction(chain_id: int, nonce: int, max_priority_fee_per_gas: int, max_fee_per_gas: int, gas: int, to: Address, value: int, data: bytes, access_list: Sequence[Tuple[Address, Sequence[int]]], y_parity: int, r: int, s: int) LondonTypedTransaction
classmethod new_unsigned_dynamic_fee_transaction(chain_id: int, nonce: int, max_priority_fee_per_gas: int, max_fee_per_gas: int, gas: int, to: Address, value: int, data: bytes, access_list: Sequence[Tuple[Address, Sequence[int]]]) UnsignedDynamicFeeTransaction
class eth.vm.forks.london.transactions.LondonTypedTransaction(type_id: int, proxy_target: SignedTransactionAPI)

Bases: TypedTransaction

receipt_builder

alias of LondonReceiptBuilder

decoders: Dict[int, Type[TransactionDecoderAPI]] = {1: <class 'eth.vm.forks.berlin.transactions.AccessListPayloadDecoder'>, 2: <class 'eth.vm.forks.london.transactions.DynamicFeePayloadDecoder'>}
class eth.vm.forks.london.transactions.LondonUnsignedLegacyTransaction(*args, **kwargs)

Bases: BerlinUnsignedLegacyTransaction

as_signed_transaction(private_key: PrivateKey, chain_id: int | None = None) LondonLegacyTransaction

Return a version of this transaction which has been signed using the provided private_key

property data
property gas
property gas_price
property nonce
property to
property value
class eth.vm.forks.london.transactions.UnsignedDynamicFeeTransaction(*args, **kwargs)

Bases: Serializable, UnsignedTransactionAPI

as_signed_transaction(private_key: PrivateKey, chain_id: int | None = None) TypedTransaction

Return a version of this transaction which has been signed using the provided private_key

gas_used_by(computation: ComputationAPI) int

Return the gas used by the given computation. In Frontier, for example, this is sum of the intrinsic cost and the gas used during computation.

get_intrinsic_gas() int

Return the intrinsic gas for the transaction which is defined as the amount of gas that is needed before any code runs.

get_message_for_signing() bytes
validate() None

Hook called during instantiation to ensure that all transaction parameters pass validation rules.

property access_list

Get addresses to be accessed by a transaction, and their storage slots.

property chain_id
property data
property gas
property intrinsic_gas: int

Convenience property for the return value of get_intrinsic_gas

property max_fee_per_gas
property max_priority_fee_per_gas
property nonce
property to
property value

eth.vm.forks.london.validation module

eth.vm.forks.london.validation.validate_london_normalized_transaction(state: StateAPI, transaction: SignedTransactionAPI) None

Validates a London normalized transaction.

Raise eth.exceptions.ValidationError if the sender cannot afford to send this transaction.

Module contents

class eth.vm.forks.london.LondonVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)

Bases: BerlinVM

block_class

alias of LondonBlock

classmethod calculate_net_gas_refund(consumed_gas: int, gross_refund: int) int
classmethod validate_gas(header: BlockHeaderAPI, parent_header: BlockHeaderAPI) None
compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'london'

Arrow Glacier

Submodules

eth.vm.forks.arrow_glacier.blocks module

class eth.vm.forks.arrow_glacier.blocks.ArrowGlacierBlock(header: BlockHeaderAPI, transactions: Sequence[SignedTransactionAPI] | None = None, uncles: Sequence[BlockHeaderAPI] | None = None)

Bases: LondonBlock

transaction_builder

alias of ArrowGlacierTransactionBuilder

property header
property transactions
property uncles
class eth.vm.forks.arrow_glacier.blocks.ArrowGlacierBlockHeader(difficulty: int, block_number: BlockNumber, gas_limit: int, timestamp: int | None = None, coinbase: Address = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', parent_hash: Hash32 = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', uncles_hash: Hash32 = b'\x1d\xccM\xe8\xde\xc7]z\xab\x85\xb5g\xb6\xcc\xd4\x1a\xd3\x12E\x1b\x94\x8at\x13\xf0\xa1B\xfd@\xd4\x93G', state_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', transaction_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', receipt_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', bloom: int = 0, gas_used: int = 0, extra_data: bytes = b'', mix_hash: Hash32 = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', nonce: bytes = b'\x00\x00\x00\x00\x00\x00\x00B', base_fee_per_gas: int = 0)

Bases: LondonBlockHeader, ABC

property base_fee_per_gas

Return the base fee per gas of the block.

Set to None in pre-EIP-1559 (London) header.

property block_number
property bloom
property coinbase
property difficulty
property extra_data
property gas_limit
property gas_used
property mix_hash
property nonce
property parent_hash
property receipt_root
property state_root
property timestamp
property transaction_root
property uncles_hash
class eth.vm.forks.arrow_glacier.blocks.ArrowGlacierMiningHeader(*args, **kwargs)

Bases: LondonMiningHeader, ABC

property base_fee_per_gas

Return the base fee per gas of the block.

Set to None in pre-EIP-1559 (London) header.

property block_number
property bloom
property coinbase
property difficulty
property extra_data
property gas_limit
property gas_used
property parent_hash
property receipt_root
property state_root
property timestamp
property transaction_root
property uncles_hash

eth.vm.forks.arrow_glacier.computation module

class eth.vm.forks.arrow_glacier.computation.ArrowGlacierComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

Bases: LondonComputation

A class for all execution message computations in the ArrowGlacier fork. Inherits from LondonComputation

eth.vm.forks.arrow_glacier.headers module

eth.vm.forks.arrow_glacier.headers.create_arrow_glacier_header_from_parent(difficulty_fn: Callable[[BlockHeaderAPI, int], int] = '__no__default__', parent_header: BlockHeaderAPI | None = '__no__default__', **header_params: Any) BlockHeaderAPI

eth.vm.forks.arrow_glacier.state module

class eth.vm.forks.arrow_glacier.state.ArrowGlacierState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)

Bases: LondonState

computation_class

alias of ArrowGlacierComputation

transaction_executor_class

alias of ArrowGlacierTransactionExecutor

execution_context: ExecutionContextAPI
class eth.vm.forks.arrow_glacier.state.ArrowGlacierTransactionExecutor(vm_state: StateAPI)

Bases: LondonTransactionExecutor

eth.vm.forks.arrow_glacier.transactions module

class eth.vm.forks.arrow_glacier.transactions.ArrowGlacierLegacyTransaction(*args, **kwargs)

Bases: LondonLegacyTransaction, ABC

property data
property gas
property gas_price

Will raise AttributeError if get or set on a 1559 transaction.

property nonce
property r
property s
property to
property v

In old transactions, this v field combines the y_parity bit and the chain ID. All new usages should prefer accessing those fields directly. But if you must access the original v, then you can cast to this API first (after checking that type_id is None).

property value
class eth.vm.forks.arrow_glacier.transactions.ArrowGlacierTransactionBuilder

Bases: LondonTransactionBuilder

legacy_signed

alias of ArrowGlacierLegacyTransaction

legacy_unsigned

alias of ArrowGlacierUnsignedLegacyTransaction

class eth.vm.forks.arrow_glacier.transactions.ArrowGlacierUnsignedLegacyTransaction(*args, **kwargs)

Bases: LondonUnsignedLegacyTransaction

as_signed_transaction(private_key: PrivateKey, chain_id: int | None = None) ArrowGlacierLegacyTransaction

Return a version of this transaction which has been signed using the provided private_key

property data
property gas
property gas_price
property nonce
property to
property value

Module contents

class eth.vm.forks.arrow_glacier.ArrowGlacierVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)

Bases: LondonVM

block_class

alias of ArrowGlacierBlock

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'arrow-glacier'

Gray Glacier

Submodules

eth.vm.forks.gray_glacier.blocks module

class eth.vm.forks.gray_glacier.blocks.GrayGlacierBlock(header: BlockHeaderAPI, transactions: Sequence[SignedTransactionAPI] | None = None, uncles: Sequence[BlockHeaderAPI] | None = None)

Bases: ArrowGlacierBlock

transaction_builder

alias of GrayGlacierTransactionBuilder

property header
property transactions
property uncles
class eth.vm.forks.gray_glacier.blocks.GrayGlacierBlockHeader(difficulty: int, block_number: BlockNumber, gas_limit: int, timestamp: int | None = None, coinbase: Address = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', parent_hash: Hash32 = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', uncles_hash: Hash32 = b'\x1d\xccM\xe8\xde\xc7]z\xab\x85\xb5g\xb6\xcc\xd4\x1a\xd3\x12E\x1b\x94\x8at\x13\xf0\xa1B\xfd@\xd4\x93G', state_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', transaction_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', receipt_root: Hash32 = b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!', bloom: int = 0, gas_used: int = 0, extra_data: bytes = b'', mix_hash: Hash32 = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', nonce: bytes = b'\x00\x00\x00\x00\x00\x00\x00B', base_fee_per_gas: int = 0)

Bases: ArrowGlacierBlockHeader, ABC

property base_fee_per_gas

Return the base fee per gas of the block.

Set to None in pre-EIP-1559 (London) header.

property block_number
property bloom
property coinbase
property difficulty
property extra_data
property gas_limit
property gas_used
property mix_hash
property nonce
property parent_hash
property receipt_root
property state_root
property timestamp
property transaction_root
property uncles_hash
class eth.vm.forks.gray_glacier.blocks.GrayGlacierMiningHeader(*args, **kwargs)

Bases: ArrowGlacierMiningHeader, ABC

property base_fee_per_gas

Return the base fee per gas of the block.

Set to None in pre-EIP-1559 (London) header.

property block_number
property bloom
property coinbase
property difficulty
property extra_data
property gas_limit
property gas_used
property parent_hash
property receipt_root
property state_root
property timestamp
property transaction_root
property uncles_hash

eth.vm.forks.gray_glacier.computation module

class eth.vm.forks.gray_glacier.computation.GrayGlacierComputation(state: StateAPI, message: MessageAPI, transaction_context: TransactionContextAPI)

Bases: ArrowGlacierComputation

A class for all execution message computations in the GrayGlacier fork. Inherits from ArrowGlacierComputation

eth.vm.forks.gray_glacier.headers module

eth.vm.forks.gray_glacier.headers.create_gray_glacier_header_from_parent(difficulty_fn: Callable[[BlockHeaderAPI, int], int] = '__no__default__', parent_header: BlockHeaderAPI | None = '__no__default__', **header_params: Any) BlockHeaderAPI

eth.vm.forks.gray_glacier.state module

class eth.vm.forks.gray_glacier.state.GrayGlacierState(db: AtomicDatabaseAPI, execution_context: ExecutionContextAPI, state_root: Hash32)

Bases: ArrowGlacierState

computation_class

alias of GrayGlacierComputation

transaction_executor_class

alias of GrayGlacierTransactionExecutor

execution_context: ExecutionContextAPI
class eth.vm.forks.gray_glacier.state.GrayGlacierTransactionExecutor(vm_state: StateAPI)

Bases: ArrowGlacierTransactionExecutor

eth.vm.forks.gray_glacier.transactions module

class eth.vm.forks.gray_glacier.transactions.GrayGlacierLegacyTransaction(*args, **kwargs)

Bases: ArrowGlacierLegacyTransaction, ABC

property data
property gas
property gas_price

Will raise AttributeError if get or set on a 1559 transaction.

property nonce
property r
property s
property to
property v

In old transactions, this v field combines the y_parity bit and the chain ID. All new usages should prefer accessing those fields directly. But if you must access the original v, then you can cast to this API first (after checking that type_id is None).

property value
class eth.vm.forks.gray_glacier.transactions.GrayGlacierTransactionBuilder

Bases: ArrowGlacierTransactionBuilder

legacy_signed

alias of GrayGlacierLegacyTransaction

legacy_unsigned

alias of GrayGlacierUnsignedLegacyTransaction

class eth.vm.forks.gray_glacier.transactions.GrayGlacierUnsignedLegacyTransaction(*args, **kwargs)

Bases: ArrowGlacierUnsignedLegacyTransaction

as_signed_transaction(private_key: PrivateKey, chain_id: int | None = None) GrayGlacierLegacyTransaction

Return a version of this transaction which has been signed using the provided private_key

property data
property gas
property gas_price
property nonce
property to
property value

Module contents

class eth.vm.forks.gray_glacier.GrayGlacierVM(header: BlockHeaderAPI, chaindb: ChainDatabaseAPI, chain_context: ChainContextAPI, consensus_context: ConsensusContextAPI)

Bases: ArrowGlacierVM

block_class

alias of GrayGlacierBlock

compute_difficulty

https://github.com/ethereum/EIPs/issues/100

configure_header
create_header_from_parent
fork: str = 'gray-glacier'