Michelson REPL

Interpreter

class pytezos.michelson.repl.Interpreter(extra_primitives: Optional[List[str]] = None, debug: bool = False)[source]

Michelson interpreter reimplemented in Python. Based on the following reference: https://tezos.gitlab.io/michelson-reference/

execute(code: str)pytezos.michelson.repl.InterpreterResult[source]

Execute some code preserving current context and stack

reset()None[source]
static run_code(parameter, storage, script, entrypoint='default', output_mode='readable', amount=None, chain_id=None, source=None, sender=None, balance=None, block_id=None, **kwargs)Tuple[List[dict], Any, List[dict], List[str], Optional[Exception]][source]
static run_tzt(script, amount=None, chain_id=None, source=None, sender=None, balance=None, block_id=None, **kwargs)None[source]
static run_view(entrypoint, parameter, storage, context: pytezos.context.impl.ExecutionContext)Tuple[Any, List[str], Optional[Exception]][source]
class pytezos.michelson.repl.InterpreterResult(*, stdout: List[str], error: Optional[Exception] = None, instructions: Optional[pytezos.michelson.micheline.MichelineSequence] = None, stack: Optional[pytezos.michelson.stack.MichelsonStack] = None)[source]
error: Optional[Exception]
instructions: Optional[pytezos.michelson.micheline.MichelineSequence]
lazy_diff = None
operations = None
stack: Optional[pytezos.michelson.stack.MichelsonStack]
stdout: List[str]
storage = None

Michelson stack

class pytezos.michelson.stack.MichelsonStack(items: Optional[List[pytezos.michelson.types.base.MichelsonType]] = None)[source]
clear()[source]
dump(count: int)[source]
classmethod from_items(items: List[pytezos.michelson.types.base.MichelsonType])[source]
peek()pytezos.michelson.types.base.MichelsonType[source]
pop(count: int)List[pytezos.michelson.types.base.MichelsonType][source]
pop1()pytezos.michelson.types.base.MichelsonType[source]
pop2()Tuple[pytezos.michelson.types.base.MichelsonType, pytezos.michelson.types.base.MichelsonType][source]
pop3()Tuple[pytezos.michelson.types.base.MichelsonType, pytezos.michelson.types.base.MichelsonType, pytezos.michelson.types.base.MichelsonType][source]
protect(count: int)[source]
push(item: pytezos.michelson.types.base.MichelsonType)[source]
restore(count: int)[source]

Execution context

class pytezos.context.impl.ExecutionContext(amount=None, chain_id=None, source=None, sender=None, balance=None, block_id=None, now=None, level=None, voting_power=None, total_voting_power=None, key=None, shell=None, address=None, counter=None, script=None, tzt=False, mode=None, ipfs_gateway=None)[source]
property constants
get_amount()int[source]
get_amount_expr()[source]
get_balance()int[source]
get_balance_expr()[source]
get_big_map_diff(ptr: int)Tuple[Optional[int], int, str][source]
get_big_map_value(ptr: int, key_hash: str)[source]
get_big_maps_expr()[source]
get_chain_id()str[source]
get_chain_id_expr()[source]
get_code_expr()[source]
get_counter()int[source]
get_counter_offset()int[source]

Return current count of pending transactions in mempool.

get_dummy_address()str[source]
get_dummy_chain_id()str[source]
get_dummy_key_hash()str[source]
get_dummy_lambda()[source]
get_dummy_public_key()str[source]
get_dummy_signature()str[source]
get_input_expr()[source]
get_level()int[source]
get_now()int[source]
get_now_expr()[source]
get_operations_ttl()int[source]
get_originated_address()str[source]
get_output_expr()[source]
get_parameter_expr(address=None)Optional[str][source]
get_sapling_state_diff(offset_commitment=0, offset_nullifier=0)Tuple[int, list][source]
get_self_address()str[source]
get_self_expr()[source]
get_sender()str[source]
get_sender_expr()[source]
get_source()str[source]
get_source_expr()[source]
get_storage_expr()[source]
get_tmp_big_map_id()int[source]
get_tmp_sapling_state_id()int[source]
get_total_voting_power()int[source]
get_voting_power(address: str)int[source]
register_big_map(ptr: int, copy=False)int[source]
register_sapling_state(ptr: int)[source]
reset()[source]
property sandboxed
property script
set_big_maps_expr(expr)[source]
set_chain_id_expr(expr)[source]
set_code_expr(expr)[source]
set_counter(counter: int)[source]
set_input_expr(expr)[source]
set_output_expr(expr)[source]
set_parameter_expr(expr)[source]
set_source_expr(expr)[source]
set_storage_expr(expr)[source]
set_total_voting_power(total_voting_power: int)[source]
set_voting_power(address: str, voting_power: int)[source]
spend_balance(amount: int)[source]