Create a block context
EVM(chain_id, block_id='latest')
Account state and contract calls are read at this block. For consistent multiple reads, first resolve a block ID and then reuse the same object.
Block queries
Block dictionaries include
id, height, and timestamp. timestamp is Unix time in seconds. Additional fields may vary by chain. Querying another block does not change the object’s own block.
Account state
Contract calls
evm.call(contract, method, args=None, *, from_addr=None)
A single output is returned directly, multiple outputs as a tuple, and no outputs as
(); integers are Python int values. Failures raise exceptions.
Batch contract calls
USDC 6.
Call(contract, method, args=None, *, from_addr=None)
Describes one call, with the same parameters as evm.call(). Construction validates the address, signature, and arguments locally and raises ContractCallInvalidInputError for invalid input without sending a request. The same Call can run against different EVM objects.
evm.call_many(calls, *, raise_on_error=True)
Returns a list of results in input order, each shaped like an evm.call() result; an empty list returns []. By default, any call that fails to execute or decode raises an exception whose call_index identifies the call. With raise_on_error=False, failed calls return None at their positions and other results are unchanged; invalid input, missing blocks, and service errors still raise.
State overrides
set_block_overrides(value) and set_state_overrides(value) set block and account-state overrides for simulated calls. The corresponding get_*_overrides() methods return current settings. Overrides affect contract calls only, not balance, nonce, code, or storage queries, and they do not change on-chain state. See the Leafage source for field definitions and full examples.