runtime

check_witness(hash_or_pubkey: Union[boa3.builtin.type.UInt160, boa3.builtin.type.ECPoint])bool

Verifies that the transactions or block of the calling contract has validated the required script hash.

Parameters

hash_or_pubkey (UInt160 or ECPoint) – script hash or public key to validate

Returns

a boolean value that represents whether the script hash was verified

Return type

bool

notify(state: Any, notification_name: Optional[str] = None)

Notifies the client from the executing smart contract.

Parameters
  • state (Any) – the notification message

  • notification_name (str) – name that’ll be linked to the notification

log(message: str)

Show log messages to the client from the executing smart contract.

Parameters

message (str) – the log message

get_trigger()boa3.neo3.contracts.contracttypes.TriggerType

Return the smart contract trigger type.

Returns

a value that represents the contract trigger type

Return type

TriggerType

get_notifications(script_hash: boa3.builtin.type.UInt160 = b'')List[boa3.builtin.interop.runtime.notification.Notification]

This method gets current invocation notifications from specific ‘script_hash’.

Parameters

script_hash (UInt160) – must have 20 bytes, but if it’s all zero 0000…0000 it refers to all existing notifications (like a * wildcard)

Returns

It will return an array of all matched notifications

Return type

List[Notification]

get_network()int

Gets the magic number of the current network.

Returns

the magic number of the current network

Return type

int

burn_gas(gas: int)

Burns GAS to benefit the NEO ecosystem.

Parameters

gas (int) – the amount of GAS that will be burned

Raises

Exception – raised if gas value is negative.

get_random()int

Gets the next random number.

Returns

the next random number

Return type

int

executing_script_hash: boa3.builtin.type.UInt160

Gets the script hash of the current context.

calling_script_hash: boa3.builtin.type.UInt160

Gets the script hash of the calling contract.

time: int

Gets the timestamp of the current block.

gas_left: int

Gets the remaining GAS that can be spent in order to complete the execution.

platform: str

Gets the name of the current platform.

invocation_counter: int

Gets the number of times the current contract has been called during the execution.

entry_script_hash: boa3.builtin.type.UInt160

Gets the script hash of the entry context.

script_container: Any

Gets the current script container.

Notification

class Notification

Bases: object

Represents a notification.

Variables
  • script_hash (UInt160) – the script hash of the notification sender

  • event_name (str) – the notification’s name

  • state (tuple) – a tuple value storing all the notification contents.

Trigger

class TriggerType(value)

Bases: enum.IntFlag

Represents the triggers for running smart contracts. Triggers enable the contract to execute different logic under different usage scenarios.

ON_PERSIST

Indicate that the contract is triggered by the system to execute the OnPersist method of the native contracts.

POST_PERSIST

Indicate that the contract is triggered by the system to execute the PostPersist method of the native contracts.

SYSTEM

The combination of all system triggers.

VERIFICATION

Indicates that the contract is triggered by the verification of a IVerifiable.

APPLICATION

Indicates that the contract is triggered by the execution of transactions.

ALL

The combination of all triggers.