types
Classes:
Represents a 160-bit unsigned integer. |
|
Represents a 256-bit unsigned integer. |
|
Represents a coordinate pair for elliptic curve cryptography (ECC) structures. |
|
Describes an action that happened in the blockchain. |
|
A type used only to indicate that a parameter or return on the manifest should be treated as an Address. |
|
A type used only to indicate that a parameter or return on the manifest should be treated as a BlockHash. |
|
A type used only to indicate that a parameter or return on the manifest should be treated as a PublicKey. |
|
A type used only to indicate that a parameter or return on the manifest should be treated as a ScriptHash. |
|
A type used only to indicate that a parameter or return on the manifest should be treated as a ScriptHashLittleEndian. |
|
A type used only to indicate that a parameter or return on the manifest should be treated as a TransactionId. |
|
Represents a block. |
|
Represents a signer. |
|
Represents a witness rule. |
|
Represents a witness condition. |
|
Determine the rules for a smart contract |
|
Represents a transaction. |
|
Represents a contract that can be invoked. |
|
Represents the manifest of a smart contract. |
|
Represents a permission of a contract. |
|
Indicates which contracts are authorized to be called. |
|
Represents a set of mutually trusted contracts. |
|
Represents the ABI of a smart contract. |
|
Represents a method in a smart contract ABI. |
|
Represents an event in a smart contract ABI. |
|
Represents a parameter of an event or method in ABI. |
|
Opcodes are similar to instructions in assembly language. |
|
Represents the options you can use when trying to find a set of values inside the storage. |
|
Represents the named curve used in ECDSA. |
|
Represents the roles in the NEO system. |
|
Represents a notification. |
|
Represents the triggers for running smart contracts. |
|
Represents the VM execution state. |
|
Defines special behaviors allowed when invoking smart contracts, e.g., chain calls, sending notifications and modifying states. |
|
Represents the response code for the oracle request. |
|
Represents the account state of NEO token in the NEO system. |
|
Represents the TransactionAttributeType for running smart contracts. |
- class ECPoint(arg: bytes)
Bases:
bytes
Represents a coordinate pair for elliptic curve cryptography (ECC) structures.
Methods:
Converts a data to a script hash.
- class Event
Bases:
object
Describes an action that happened in the blockchain. Neo3-Boa compiler won’t recognize the __init__ of this class. To create a new Event, use the method CreateNewEvent:
Check out Neo’s Documentation to learn more about Events.
>>> from boa3.sc.utils import CreateNewEvent ... new_event: Event = CreateNewEvent( # create a new Event with the CreateNewEvent method ... [ ... ('name', str), ... ('amount', int) ... ], ... 'New Event' ... )
- Address
A type used only to indicate that a parameter or return on the manifest should be treated as an Address. Same as str.
- BlockHash
A type used only to indicate that a parameter or return on the manifest should be treated as a BlockHash. Same as UInt256.
- PublicKey
A type used only to indicate that a parameter or return on the manifest should be treated as a PublicKey. Same as ECPoint.
- ScriptHash
A type used only to indicate that a parameter or return on the manifest should be treated as a ScriptHash. Same as UInt160.
- ScriptHashLittleEndian
A type used only to indicate that a parameter or return on the manifest should be treated as a ScriptHashLittleEndian. Same as UInt160.
- TransactionId
A type used only to indicate that a parameter or return on the manifest should be treated as a TransactionId. Same as UInt256.
- class Block
Bases:
object
Represents a block.
Check out Neo’s Documentation to learn more about Blocks.
- Variables:
hash (boa3.sc.types.UInt256) – a unique identifier based on the unsigned data portion of the object
version (int) – the data structure version of the block
previous_hash (boa3.sc.types.UInt256) – the hash of the previous block
merkle_root (boa3.sc.types.UInt256) – the merkle root of the transactions
timestamp (int) – UTC timestamp of the block in milliseconds
nonce (int) – a random number used once in the cryptography
index (int) – the index of the block
next_consensus (boa3.sc.types.UInt160) – the script hash of the consensus nodes that generates the next block
transaction_count (int) – the number of transactions on this block
- class Signer
Bases:
object
Represents a signer.
Check out Neo’s Documentation to learn more about Signers.
- Variables:
account (boa3.sc.types.UInt160)
scopes (WitnessScope)
allowed_contracts (list[boa3.sc.types.UInt160])
allowed_groups (list[boa3.sc.types.UInt160])
rules (list[WitnessRule])
- class WitnessRule
Bases:
object
Represents a witness rule.
Check out Neo’s Documentation to learn more about WitnessRules.
- Variables:
action (WitnessRuleAction)
condition (WitnessCondition)
- class WitnessCondition
Bases:
object
Represents a witness condition.
Check out Neo’s Documentation to learn more about WitnessConditions.
- Variables:
type (WitnessConditionType)
- class WitnessScope(value)
Bases:
IntFlag
Determine the rules for a smart contract
CheckWitness()
sys call.Attributes:
No Contract was witnessed.
Allow the witness if the current calling script hash equals the entry script hash into the virtual machine.
Allow the witness if called from a smart contract that is whitelisted in the signer
allowed_contracts
attribute.Allow the witness if any public key is in the signer
allowed_groups
attribute is whitelisted in the contracts manifest.groups array.Allow the witness if the specified
rules
are satisfiedAllow the witness in all context.
- NONE = 0
No Contract was witnessed. Only sign the transaction.
- CALLED_BY_ENTRY = 1
Allow the witness if the current calling script hash equals the entry script hash into the virtual machine. Using this prevents passing
CheckWitness()
in a smart contract called via another smart contract.
- CUSTOM_CONTRACTS = 16
Allow the witness if called from a smart contract that is whitelisted in the signer
allowed_contracts
attribute.
- CUSTOM_GROUPS = 32
Allow the witness if any public key is in the signer
allowed_groups
attribute is whitelisted in the contracts manifest.groups array.
- WITNESS_RULES = 64
Allow the witness if the specified
rules
are satisfied
- GLOBAL = 128
Allow the witness in all context. Equal to NEO 2.x’s default behaviour.
- class Transaction
Bases:
object
Represents a transaction.
Check out Neo’s Documentation to learn more about Transactions.
- Variables:
hash (boa3.sc.types.UInt256) – a unique identifier based on the unsigned data portion of the object
version (int) – the data structure version of the transaction
nonce (int) – a random number used once in the cryptography
sender (boa3.sc.types.UInt160) – the sender is the first signer of the transaction, they will pay the fees of the transaction
system_fee (int) – the fee paid for executing the script
network_fee (int) – the fee paid for the validation and inclusion of the transaction in a block by the consensus node
valid_until_block (int) – indicates that the transaction is only valid before this block height
script (bytes) – the array of instructions to be executed on the transaction chain by the virtual machine
- class Contract
Bases:
object
Represents a contract that can be invoked.
Check out Neo’s Documentation to learn about Smart Contracts.
- Variables:
id (int) – the serial number of the contract
update_counter (int) – the number of times the contract was updated
hash (boa3.sc.types.UInt160) – the hash of the contract
nef (bytes) – the serialized Neo Executable Format (NEF) object holding of the smart contract code and compiler information
manifest (ContractManifest) – the manifest of the contract
- class ContractManifest
Bases:
object
Represents the manifest of a smart contract.
When a smart contract is deployed, it must explicitly declare the features and permissions it will use.
When it is running, it will be limited by its declared list of features and permissions, and cannot make any behavior beyond the scope of the list.
For more details, check out NEP-15 or Neo’s Documentation.
- Variables:
name (str) – The name of the contract.
groups (list[ContractGroup]) – The groups of the contract.
supported_standards (list[str]) – Indicates which standards the contract supports. It can be a list of NEPs.
abi (ContractAbi) – The ABI of the contract.
permissions (list[ContractPermission]) – The permissions of the contract.
trusts (list[ContractPermissionDescriptor] or None) –
The trusted contracts and groups of the contract.
If a contract is trusted, the user interface will not give any warnings when called by the contract.
extras (str) – Custom user data as a json string.
- class ContractPermission
Bases:
object
Represents a permission of a contract. It describes which contracts may be invoked and which methods are called.
If a contract invokes a contract or method that is not declared in the manifest at runtime, the invocation will fail.
- Variables:
contract (ContractPermissionDescriptor or None) –
Indicates which contract to be invoked.
It can be a hash of a contract, a public key of a group, or a wildcard *.
If it specifies a hash of a contract, then the contract will be invoked; If it specifies a public key of a group, then any contract in this group may be invoked; If it specifies a wildcard *, then any contract may be invoked.
Indicates which methods to be called.
It can also be assigned with a wildcard *. If it is a wildcard *, then it means that any method can be called.
- class ContractPermissionDescriptor
Bases:
object
Indicates which contracts are authorized to be called.
- Variables:
hash (boa3.sc.types.UInt160 or None) – The hash of the contract.
group (boa3.sc.types.ECPoint or None) – The group of the contracts.
- class ContractGroup
Bases:
object
Represents a set of mutually trusted contracts.
A contract will trust and allow any contract in the same group to invoke it, and the user interface will not give any warnings.
A group is identified by a public key and must be accompanied by a signature for the contract hash to prove that the contract is indeed included in the group.
- Variables:
pubkey (boa3.sc.types.ECPoint) – The public key of the group.
signature (bytes) – The signature of the contract hash which can be verified by pubkey.
- class ContractAbi
Bases:
object
Represents the ABI of a smart contract.
For more details, check out NEP-14 or Neo’s Documentation.
- Variables:
methods (list[ContractMethodDescriptor]) – Gets the methods in the ABI.
events (list[ContractEventDescriptor]) – Gets the events in the ABI.
- class ContractMethodDescriptor
Bases:
object
Represents a method in a smart contract ABI.
- Variables:
name (str) – The name of the method.
parameters (list[ContractParameterDefinition]) – The parameters of the method.
return_type (ContractParameterType) – Indicates the return type of the method.
offset (int) – The position of the method in the contract script.
safe (bool) –
Indicates whether the method is a safe method.
If a method is marked as safe, the user interface will not give any warnings when it is called by other contracts.
- class ContractEventDescriptor
Bases:
object
Represents an event in a smart contract ABI.
- Variables:
name (str) – The name of the event.
parameters (list[ContractParameterDefinition]) – The parameters of the event.
- class ContractParameterDefinition
Bases:
object
Represents a parameter of an event or method in ABI.
- Variables:
name (str) – The name of the parameter.
type (ContractParameterType) – The type of the parameter.
- class Opcode(value)
-
Opcodes are similar to instructions in assembly language.
Attributes:
Pushes a 1-byte signed integer onto the stack.
Pushes a 2-byte signed integer onto the stack.
Pushes a 4-byte signed integer onto the stack.
Pushes a 8-byte signed integer onto the stack.
Pushes a 16-byte signed integer onto the stack.
Pushes a 32-byte signed integer onto the stack.
Pushes the boolean value True onto the stack.
Pushes the boolean value False onto the stack.
Converts the 4-bytes offset to a Pointer, and pushes it onto the stack.
The item null is pushed onto the stack.
The next byte contains the number of bytes to be pushed onto the stack.
The next two bytes contain the number of bytes to be pushed onto the stack.
The next four bytes contain the number of bytes to be pushed onto the stack.
The number -1 is pushed onto the stack.
The number 0 is pushed onto the stack.
The number 1 is pushed onto the stack.
The number 2 is pushed onto the stack.
The number 3 is pushed onto the stack.
The number 4 is pushed onto the stack.
The number 5 is pushed onto the stack.
The number 6 is pushed onto the stack.
The number 7 is pushed onto the stack.
The number 8 is pushed onto the stack.
The number 9 is pushed onto the stack.
The number 10 is pushed onto the stack.
The number 11 is pushed onto the stack.
The number 12 is pushed onto the stack.
The number 13 is pushed onto the stack.
The number 14 is pushed onto the stack.
The number 15 is pushed onto the stack.
The number 16 is pushed onto the stack.
The NOP operation does nothing.
Unconditionally transfers control to a target instruction.
Unconditionally transfers control to a target instruction.
Transfers control to a target instruction if the value is True, not null, or non-zero.
Transfers control to a target instruction if the value is True, not null, or non-zero.
Transfers control to a target instruction if the value is False, a null reference, or zero.
Transfers control to a target instruction if the value is False, a null reference, or zero.
Transfers control to a target instruction if two values are equal.
Transfers control to a target instruction if two values are equal.
Transfers control to a target instruction when two values are not equal.
Transfers control to a target instruction when two values are not equal.
Transfers control to a target instruction if the first value is greater than the second value.
Transfers control to a target instruction if the first value is greater than the second value.
Transfers control to a target instruction if the first value is greater than or equal to the second value.
Transfers control to a target instruction if the first value is greater than or equal to the second value.
Transfers control to a target instruction if the first value is less than the second value.
Transfers control to a target instruction if the first value is less than the second value.
Transfers control to a target instruction if the first value is less than or equal to the second value.
Transfers control to a target instruction if the first value is less than or equal to the second value.
Calls the function at the target address which is represented as a 1-byte signed offset from the beginning of the current instruction.
Calls the function at the target address which is represented as a 4-bytes signed offset from the beginning of the current instruction.
Pop the address of a function from the stack, and call the function.
Calls the function which is described by the token.
It turns the vm state to FAULT immediately, and cannot be caught.
Pop the top value of the stack, if it false, then exit vm execution and set vm state to FAULT.
Pop the top value of the stack, and throw it.
TRY CatchOffset(sbyte) FinallyOffset(sbyte).
TRY_L CatchOffset(int) FinallyOffset(int).
Ensures that the appropriate surrounding finally blocks are executed.
Ensures that the appropriate surrounding finally blocks are executed.
End finally, If no exception happen or be catched, vm will jump to the target instruction of ENDTRY/ENDTRY_L.
Returns from the current method.
Calls to an interop service.
Puts the number of stack items onto the stack.
Removes the top stack item.
Removes the second-to-top stack item.
The item n back in the main stack is removed.
Clear the stack
Duplicates the top stack item.
Copies the second-to-top stack item to the top.
The item n back in the stack is copied to the top.
The item at the top of the stack is copied and inserted before the second-to-top item.
The top two items on the stack are swapped.
The top three items on the stack are rotated to the left.
The item n back in the stack is moved to the top.
Reverse the order of the top 3 items on the stack.
Reverse the order of the top 4 items on the stack.
Pop the number N on the stack, and reverse the order of the top N items on the stack.
Initialize the static field list for the current execution context.
Initialize the argument slot and the local variable list for the current execution context.
Loads the static field at index 0 onto the evaluation stack.
Loads the static field at index 1 onto the evaluation stack.
Loads the static field at index 2 onto the evaluation stack.
Loads the static field at index 3 onto the evaluation stack.
Loads the static field at index 4 onto the evaluation stack.
Loads the static field at index 5 onto the evaluation stack.
Loads the static field at index 6 onto the evaluation stack.
Loads the static field at a specified index onto the evaluation stack.
Stores the value on top of the evaluation stack in the static field list at index 0.
Stores the value on top of the evaluation stack in the static field list at index 1.
Stores the value on top of the evaluation stack in the static field list at index 2.
Stores the value on top of the evaluation stack in the static field list at index 3.
Stores the value on top of the evaluation stack in the static field list at index 4.
Stores the value on top of the evaluation stack in the static field list at index 5.
Stores the value on top of the evaluation stack in the static field list at index 6.
Stores the value on top of the evaluation stack in the static field list at a specified index.
Loads the local variable at index 0 onto the evaluation stack.
Loads the local variable at index 1 onto the evaluation stack.
Loads the local variable at index 2 onto the evaluation stack.
Loads the local variable at index 3 onto the evaluation stack.
Loads the local variable at index 4 onto the evaluation stack.
Loads the local variable at index 5 onto the evaluation stack.
Loads the local variable at index 6 onto the evaluation stack.
Loads the local variable at a specified index onto the evaluation stack.
Stores the value on top of the evaluation stack in the local variable list at index 0.
Stores the value on top of the evaluation stack in the local variable list at index 1.
Stores the value on top of the evaluation stack in the local variable list at index 2.
Stores the value on top of the evaluation stack in the local variable list at index 3.
Stores the value on top of the evaluation stack in the local variable list at index 4.
Stores the value on top of the evaluation stack in the local variable list at index 5.
Stores the value on top of the evaluation stack in the local variable list at index 6.
Stores the value on top of the evaluation stack in the local variable list at a specified index.
Loads the argument at index 0 onto the evaluation stack.
Loads the argument at index 1 onto the evaluation stack.
Loads the argument at index 2 onto the evaluation stack.
Loads the argument at index 3 onto the evaluation stack.
Loads the argument at index 4 onto the evaluation stack.
Loads the argument at index 5 onto the evaluation stack.
Loads the argument at index 6 onto the evaluation stack.
Loads the argument at a specified index onto the evaluation stack.
Stores the value on top of the evaluation stack in the argument slot at index 0.
Stores the value on top of the evaluation stack in the argument slot at index 1.
Stores the value on top of the evaluation stack in the argument slot at index 2.
Stores the value on top of the evaluation stack in the argument slot at index 3.
Stores the value on top of the evaluation stack in the argument slot at index 4.
Stores the value on top of the evaluation stack in the argument slot at index 5.
Stores the value on top of the evaluation stack in the argument slot at index 6.
Stores the value on top of the evaluation stack in the argument slot at a specified index.
Creates a new Buffer and pushes it onto the stack.
Copies a range of bytes from one Buffer to another.
Concatenates two strings.
Returns a section of a string.
Keeps only characters left of the specified point in a string.
Keeps only characters right of the specified point in a string.
Flips all of the bits in the input.
Boolean and between each bit in the inputs.
Boolean or between each bit in the inputs.
Boolean exclusive or between each bit in the inputs.
Returns 1 if the inputs are exactly equal, 0 otherwise.
Returns 1 if the inputs are not equal, 0 otherwise.
Puts the sign of top stack item on top of the main stack.
The input is made positive.
The sign of the input is flipped.
1 is added to the input.
1 is subtracted from the input.
a is added to b.
b is subtracted from a.
a is multiplied by b.
a is divided by b.
Returns the remainder after dividing a by b.
The result of raising value to the exponent power.
Returns the square root of a specified number.
Performs modulus division on a number multiplied by another number.
Performs modulus division on a number raised to the power of another number.
Shifts a left b bits, preserving sign.
Shifts a right b bits, preserving sign.
If the input is 0 or 1, it is flipped.
If both a and b are not 0, the output is 1.
If a or b is not 0, the output is 1.
Returns 0 if the input is 0.
Returns 1 if the numbers are equal, 0 otherwise.
Returns 1 if the numbers are not equal, 0 otherwise.
Returns 1 if a is less than b, 0 otherwise.
Returns 1 if a is less than or equal to b, 0 otherwise.
Returns 1 if a is greater than b, 0 otherwise.
Returns 1 if a is greater than or equal to b, 0 otherwise.
Returns the smaller of a and b.
Returns the larger of a and b.
Returns 1 if x is within the specified range (left-inclusive), 0 otherwise.
A value n is taken from top of main stack.
A value n is taken from top of main stack.
A value n is taken from top of main stack.
A collection is removed from top of the main stack.
An empty array (with size 0) is put on top of the main stack.
A value n is taken from top of main stack.
A value n is taken from top of main stack.
An empty struct (with size 0) is put on top of the main stack.
A value n is taken from top of main stack.
A Map is created and put on top of the main stack.
An array is removed from top of the main stack.
An input index n (or key) and an array (or map) are removed from the top of the main stack.
A map is taken from top of the main stack.
A map is taken from top of the main stack.
An input index n (or key) and an array (or map) are taken from main stack.
The item on top of main stack is removed and appended to the second item on top of the main stack.
A value v, index n (or key) and an array (or map) are taken from main stack.
An array is removed from the top of the main stack and its elements are reversed.
An input index n (or key) and an array (or map) are removed from the top of the main stack.
Remove all the items from the compound-type.
Remove the last element from an array, and push it onto the stack.
Returns true if the input is null;
Returns true if the top item of the stack is of the specified type;
Returns true if the input is null;
Turns the vm state to FAULT immediately, and cannot be caught.
Pop the top value of the stack, if it false, then exit vm execution and set vm state to FAULT.
- PUSHINT8
Pushes a 1-byte signed integer onto the stack.
- PUSHINT16
Pushes a 2-byte signed integer onto the stack.
- PUSHINT32
Pushes a 4-byte signed integer onto the stack.
- PUSHINT64
Pushes a 8-byte signed integer onto the stack.
- PUSHINT128
Pushes a 16-byte signed integer onto the stack.
- PUSHINT256
Pushes a 32-byte signed integer onto the stack.
- PUSHT
Pushes the boolean value True onto the stack.
- PUSHF
Pushes the boolean value False onto the stack.
- PUSHA
Converts the 4-bytes offset to a Pointer, and pushes it onto the stack.
- PUSHNULL
The item null is pushed onto the stack.
- PUSHDATA1
The next byte contains the number of bytes to be pushed onto the stack.
- PUSHDATA2
The next two bytes contain the number of bytes to be pushed onto the stack.
- PUSHDATA4
The next four bytes contain the number of bytes to be pushed onto the stack.
- PUSHM1
The number -1 is pushed onto the stack.
- PUSH0
The number 0 is pushed onto the stack.
- PUSH1
The number 1 is pushed onto the stack.
- PUSH2
The number 2 is pushed onto the stack.
- PUSH3
The number 3 is pushed onto the stack.
- PUSH4
The number 4 is pushed onto the stack.
- PUSH5
The number 5 is pushed onto the stack.
- PUSH6
The number 6 is pushed onto the stack.
- PUSH7
The number 7 is pushed onto the stack.
- PUSH8
The number 8 is pushed onto the stack.
- PUSH9
The number 9 is pushed onto the stack.
- PUSH10
The number 10 is pushed onto the stack.
- PUSH11
The number 11 is pushed onto the stack.
- PUSH12
The number 12 is pushed onto the stack.
- PUSH13
The number 13 is pushed onto the stack.
- PUSH14
The number 14 is pushed onto the stack.
- PUSH15
The number 15 is pushed onto the stack.
- PUSH16
The number 16 is pushed onto the stack.
- NOP
The NOP operation does nothing. It is intended to fill in space if opcodes are patched.
- JMP
Unconditionally transfers control to a target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMP_L
Unconditionally transfers control to a target instruction. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPIF
Transfers control to a target instruction if the value is True, not null, or non-zero. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPIF_L
Transfers control to a target instruction if the value is True, not null, or non-zero. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPIFNOT
Transfers control to a target instruction if the value is False, a null reference, or zero. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPIFNOT_L
Transfers control to a target instruction if the value is False, a null reference, or zero. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPEQ
Transfers control to a target instruction if two values are equal. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPEQ_L
Transfers control to a target instruction if two values are equal. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPNE
Transfers control to a target instruction when two values are not equal. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPNE_L
Transfers control to a target instruction when two values are not equal. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPGT
Transfers control to a target instruction if the first value is greater than the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPGT_L
Transfers control to a target instruction if the first value is greater than the second value. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPGE
Transfers control to a target instruction if the first value is greater than or equal to the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPGE_L
Transfers control to a target instruction if the first value is greater than or equal to the second value. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPLT
Transfers control to a target instruction if the first value is less than the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPLT_L
Transfers control to a target instruction if the first value is less than the second value. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- JMPLE
Transfers control to a target instruction if the first value is less than or equal to the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction.
- JMPLE_L
Transfers control to a target instruction if the first value is less than or equal to the second value. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction.
- CALL
Calls the function at the target address which is represented as a 1-byte signed offset from the beginning of the current instruction.
- CALL_L
Calls the function at the target address which is represented as a 4-bytes signed offset from the beginning of the current instruction.
- CALLA
Pop the address of a function from the stack, and call the function.
- CALLT
Calls the function which is described by the token.
- ABORT
It turns the vm state to FAULT immediately, and cannot be caught.
- ASSERT
Pop the top value of the stack, if it false, then exit vm execution and set vm state to FAULT.
- THROW
Pop the top value of the stack, and throw it.
- TRY
TRY CatchOffset(sbyte) FinallyOffset(sbyte). If there’s no catch body, set CatchOffset 0. If there’s no finally body, set FinallyOffset 0.
- TRY_L
TRY_L CatchOffset(int) FinallyOffset(int). If there’s no catch body, set CatchOffset 0. If there’s no finally body, set FinallyOffset 0.
- ENDTRY
Ensures that the appropriate surrounding finally blocks are executed. And then unconditionally transfers control to the specific target instruction, represented as a 1-byte signed offset from the beginning of the current instruction.
- ENDTRY_L
Ensures that the appropriate surrounding finally blocks are executed. And then unconditionally transfers control to the specific target instruction, represented as a 4-byte signed offset from the beginning of the current instruction.
- ENDFINALLY
End finally, If no exception happen or be catched, vm will jump to the target instruction of ENDTRY/ENDTRY_L. Otherwise vm will rethrow the exception to upper layer.
- RET
Returns from the current method.
- SYSCALL
Calls to an interop service.
- DEPTH
Puts the number of stack items onto the stack.
- DROP
Removes the top stack item.
- NIP
Removes the second-to-top stack item.
- XDROP
The item n back in the main stack is removed.
- CLEAR
Clear the stack
- DUP
Duplicates the top stack item.
- OVER
Copies the second-to-top stack item to the top.
- PICK
The item n back in the stack is copied to the top.
- TUCK
The item at the top of the stack is copied and inserted before the second-to-top item.
- SWAP
The top two items on the stack are swapped.
- ROT
The top three items on the stack are rotated to the left.
- ROLL
The item n back in the stack is moved to the top.
- REVERSE3
Reverse the order of the top 3 items on the stack.
- REVERSE4
Reverse the order of the top 4 items on the stack.
- REVERSEN
Pop the number N on the stack, and reverse the order of the top N items on the stack.
- INITSSLOT
Initialize the static field list for the current execution context.
- INITSLOT
Initialize the argument slot and the local variable list for the current execution context.
- LDSFLD0
Loads the static field at index 0 onto the evaluation stack.
- LDSFLD1
Loads the static field at index 1 onto the evaluation stack.
- LDSFLD2
Loads the static field at index 2 onto the evaluation stack.
- LDSFLD3
Loads the static field at index 3 onto the evaluation stack.
- LDSFLD4
Loads the static field at index 4 onto the evaluation stack.
- LDSFLD5
Loads the static field at index 5 onto the evaluation stack.
- LDSFLD6
Loads the static field at index 6 onto the evaluation stack.
- LDSFLD
Loads the static field at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer.
- STSFLD0
Stores the value on top of the evaluation stack in the static field list at index 0.
- STSFLD1
Stores the value on top of the evaluation stack in the static field list at index 1.
- STSFLD2
Stores the value on top of the evaluation stack in the static field list at index 2.
- STSFLD3
Stores the value on top of the evaluation stack in the static field list at index 3.
- STSFLD4
Stores the value on top of the evaluation stack in the static field list at index 4.
- STSFLD5
Stores the value on top of the evaluation stack in the static field list at index 5.
- STSFLD6
Stores the value on top of the evaluation stack in the static field list at index 6.
- STSFLD
Stores the value on top of the evaluation stack in the static field list at a specified index. The index is represented as a 1-byte unsigned integer.
- LDLOC0
Loads the local variable at index 0 onto the evaluation stack.
- LDLOC1
Loads the local variable at index 1 onto the evaluation stack.
- LDLOC2
Loads the local variable at index 2 onto the evaluation stack.
- LDLOC3
Loads the local variable at index 3 onto the evaluation stack.
- LDLOC4
Loads the local variable at index 4 onto the evaluation stack.
- LDLOC5
Loads the local variable at index 5 onto the evaluation stack.
- LDLOC6
Loads the local variable at index 6 onto the evaluation stack.
- LDLOC
Loads the local variable at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer.
- STLOC0
Stores the value on top of the evaluation stack in the local variable list at index 0.
- STLOC1
Stores the value on top of the evaluation stack in the local variable list at index 1.
- STLOC2
Stores the value on top of the evaluation stack in the local variable list at index 2.
- STLOC3
Stores the value on top of the evaluation stack in the local variable list at index 3.
- STLOC4
Stores the value on top of the evaluation stack in the local variable list at index 4.
- STLOC5
Stores the value on top of the evaluation stack in the local variable list at index 5.
- STLOC6
Stores the value on top of the evaluation stack in the local variable list at index 6.
- STLOC
Stores the value on top of the evaluation stack in the local variable list at a specified index. The index is represented as a 1-byte unsigned integer.
- LDARG0
Loads the argument at index 0 onto the evaluation stack.
- LDARG1
Loads the argument at index 1 onto the evaluation stack.
- LDARG2
Loads the argument at index 2 onto the evaluation stack.
- LDARG3
Loads the argument at index 3 onto the evaluation stack.
- LDARG4
Loads the argument at index 4 onto the evaluation stack.
- LDARG5
Loads the argument at index 5 onto the evaluation stack.
- LDARG6
Loads the argument at index 6 onto the evaluation stack.
- LDARG
Loads the argument at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer.
- STARG0
Stores the value on top of the evaluation stack in the argument slot at index 0.
- STARG1
Stores the value on top of the evaluation stack in the argument slot at index 1.
- STARG2
Stores the value on top of the evaluation stack in the argument slot at index 2.
- STARG3
Stores the value on top of the evaluation stack in the argument slot at index 3.
- STARG4
Stores the value on top of the evaluation stack in the argument slot at index 4.
- STARG5
Stores the value on top of the evaluation stack in the argument slot at index 5.
- STARG6
Stores the value on top of the evaluation stack in the argument slot at index 6.
- STARG
Stores the value on top of the evaluation stack in the argument slot at a specified index. The index is represented as a 1-byte unsigned integer.
- NEWBUFFER
Creates a new Buffer and pushes it onto the stack.
- MEMCPY
Copies a range of bytes from one Buffer to another.
- CAT
Concatenates two strings.
- SUBSTR
Returns a section of a string.
- LEFT
Keeps only characters left of the specified point in a string.
- RIGHT
Keeps only characters right of the specified point in a string.
- INVERT
Flips all of the bits in the input.
- AND
Boolean and between each bit in the inputs.
- OR
Boolean or between each bit in the inputs.
- XOR
Boolean exclusive or between each bit in the inputs.
- EQUAL
Returns 1 if the inputs are exactly equal, 0 otherwise.
- NOTEQUAL
Returns 1 if the inputs are not equal, 0 otherwise.
- SIGN
Puts the sign of top stack item on top of the main stack. If value is negative, put -1; if positive, put 1; if value is zero, put 0.
- ABS
The input is made positive.
- NEGATE
The sign of the input is flipped.
- INC
1 is added to the input.
- DEC
1 is subtracted from the input.
- ADD
a is added to b.
- SUB
b is subtracted from a.
- MUL
a is multiplied by b.
- DIV
a is divided by b.
- MOD
Returns the remainder after dividing a by b.
- POW
The result of raising value to the exponent power.
- SQRT
Returns the square root of a specified number.
- MODMUL
Performs modulus division on a number multiplied by another number.
- MODPOW
Performs modulus division on a number raised to the power of another number. If the exponent is -1, it will have the calculation of the modular inverse.
- SHL
Shifts a left b bits, preserving sign.
- SHR
Shifts a right b bits, preserving sign.
- NOT
If the input is 0 or 1, it is flipped. Otherwise the output will be 0.
- BOOLAND
If both a and b are not 0, the output is 1. Otherwise 0.
- BOOLOR
If a or b is not 0, the output is 1. Otherwise 0.
- NZ
Returns 0 if the input is 0. 1 otherwise.
- NUMEQUAL
Returns 1 if the numbers are equal, 0 otherwise.
- NUMNOTEQUAL
Returns 1 if the numbers are not equal, 0 otherwise.
- LT
Returns 1 if a is less than b, 0 otherwise.
- LE
Returns 1 if a is less than or equal to b, 0 otherwise.
- GT
Returns 1 if a is greater than b, 0 otherwise.
- GE
Returns 1 if a is greater than or equal to b, 0 otherwise.
- MIN
Returns the smaller of a and b.
- MAX
Returns the larger of a and b.
- WITHIN
Returns 1 if x is within the specified range (left-inclusive), 0 otherwise.
- PACKMAP
A value n is taken from top of main stack. The next n*2 items on main stack are removed, put inside n-sized map and this map is put on top of the main stack.
- PACKSTRUCT
A value n is taken from top of main stack. The next n items on main stack are removed, put inside n-sized struct and this struct is put on top of the main stack.
- PACK
A value n is taken from top of main stack. The next n items on main stack are removed, put inside n-sized array and this array is put on top of the main stack.
- UNPACK
A collection is removed from top of the main stack. Its elements are put on top of the main stack (in reverse order) and the collection size is also put on main stack.
- NEWARRAY0
An empty array (with size 0) is put on top of the main stack.
- NEWARRAY
A value n is taken from top of main stack. A null-filled array with size n is put on top of the main stack.
- NEWARRAY_T
A value n is taken from top of main stack. An array of type T with size n is put on top of the main stack.
- NEWSTRUCT0
An empty struct (with size 0) is put on top of the main stack.
- NEWSTRUCT
A value n is taken from top of main stack. A zero-filled struct with size n is put on top of the main stack.
- NEWMAP
A Map is created and put on top of the main stack.
- SIZE
An array is removed from top of the main stack. Its size is put on top of the main stack.
- HASKEY
An input index n (or key) and an array (or map) are removed from the top of the main stack. Puts True on top of main stack if array[n] (or map[n]) exist, and False otherwise.
- KEYS
A map is taken from top of the main stack. The keys of this map are put on top of the main stack.
- VALUES
A map is taken from top of the main stack. The values of this map are put on top of the main stack.
- PICKITEM
An input index n (or key) and an array (or map) are taken from main stack. Element array[n] (or map[n]) is put on top of the main stack.
- APPEND
The item on top of main stack is removed and appended to the second item on top of the main stack.
- SETITEM
A value v, index n (or key) and an array (or map) are taken from main stack. Attribution array[n]=v (or map[n]=v) is performed.
- REVERSEITEMS
An array is removed from the top of the main stack and its elements are reversed.
- REMOVE
An input index n (or key) and an array (or map) are removed from the top of the main stack. Element array[n] (or map[n]) is removed.
- CLEARITEMS
Remove all the items from the compound-type.
- POPITEM
Remove the last element from an array, and push it onto the stack.
- ISNULL
Returns true if the input is null;
- ISTYPE
Returns true if the top item of the stack is of the specified type;
- CONVERT
Returns true if the input is null;
- ABORTMSG
Turns the vm state to FAULT immediately, and cannot be caught. Includes a reason.
- ASSERTMSG
Pop the top value of the stack, if it false, then exit vm execution and set vm state to FAULT. Includes a reason.
- class FindOptions(value)
Bases:
IntEnum
Represents the options you can use when trying to find a set of values inside the storage.
Check out Neo’s Documentation to learn more about the FindOption class.
Attributes:
No option is set.
Indicates that only keys need to be returned.
Indicates that the prefix byte of keys should be removed before return.
Indicates that only values need to be returned.
Indicates that values should be deserialized before return.
Indicates that only the field 0 of the deserialized values need to be returned.
Indicates that only the field 1 of the deserialized values need to be returned.
Indicates that results should be returned in backwards (descending) order.
- NONE
No option is set. The results will be an iterator of (key, value).
- KEYS_ONLY
Indicates that only keys need to be returned. The results will be an iterator of keys.
- REMOVE_PREFIX
Indicates that the prefix byte of keys should be removed before return.
- VALUES_ONLY
Indicates that only values need to be returned. The results will be an iterator of values.
- DESERIALIZE_VALUES
Indicates that values should be deserialized before return.
- PICK_FIELD_0
Indicates that only the field 0 of the deserialized values need to be returned. This flag must be set together with DESERIALIZE_VALUES, e.g., DESERIALIZE_VALUES | PICK_FIELD_0
- PICK_FIELD_1
Indicates that only the field 1 of the deserialized values need to be returned. This flag must be set together with DESERIALIZE_VALUES, e.g., DESERIALIZE_VALUES | PICK_FIELD_1
- BACKWARDS
Indicates that results should be returned in backwards (descending) order.
- class NamedCurveHash(value)
Bases:
IntFlag
Represents the named curve used in ECDSA.
Check out Neo’s Documentation to learn more about ECDSA signing.
Attributes:
The secp256k1 curve and SHA256 hash algorithm.
The secp256r1 curve, which known as prime256v1 or nistP-256, and SHA256 hash algorithm.
The secp256k1 curve and Keccak256 hash algorithm.
The secp256r1 curve, which known as prime256v1 or nistP-256, and Keccak256 hash algorithm.
- SECP256K1SHA256
The secp256k1 curve and SHA256 hash algorithm.
- SECP256R1SHA256
The secp256r1 curve, which known as prime256v1 or nistP-256, and SHA256 hash algorithm.
- SECP256K1KECCAK256
The secp256k1 curve and Keccak256 hash algorithm.
- SECP256R1KECCAK256
The secp256r1 curve, which known as prime256v1 or nistP-256, and Keccak256 hash algorithm.
- class Role(value)
Bases:
IntFlag
Represents the roles in the NEO system. They are the permission types of the native contract RoleManagement.
Attributes:
The validators of state.
The nodes used to process Oracle requests.
NeoFS Alphabet nodes.
- STATE_VALIDATOR
The validators of state. Used to generate and sign the state root.
- ORACLE
The nodes used to process Oracle requests.
- NEO_FS_ALPHABET_NODE
NeoFS Alphabet nodes.
- class Notification
Bases:
object
Represents a notification.
- Variables:
script_hash (boa3.sc.types.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.
- class TriggerType(value)
Bases:
IntFlag
Represents the triggers for running smart contracts. Triggers enable the contract to execute different logic under different usage scenarios.
Check out Neo’s Documentation to learn more about TriggerTypes.
Attributes:
Indicate that the contract is triggered by the system to execute the OnPersist method of the native contracts.
Indicate that the contract is triggered by the system to execute the PostPersist method of the native contracts.
The combination of all system triggers.
Indicates that the contract is triggered by the verification of a IVerifiable.
Indicates that the contract is triggered by the execution of transactions.
The combination of all triggers.
- 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.
- class VMState(value)
Bases:
IntEnum
Represents the VM execution state.
Attributes:
Indicates that the execution is in progress or has not yet begun.
Indicates that the execution has been completed successfully.
Indicates that the execution has ended, and an exception that cannot be caught is thrown.
Indicates that a breakpoint is currently being hit.
- NONE
Indicates that the execution is in progress or has not yet begun.
- HALT
Indicates that the execution has been completed successfully.
- FAULT
Indicates that the execution has ended, and an exception that cannot be caught is thrown.
- BREAK
Indicates that a breakpoint is currently being hit.
- class CallFlags(value)
Bases:
IntFlag
Defines special behaviors allowed when invoking smart contracts, e.g., chain calls, sending notifications and modifying states.
Check out Neo’s Documentation to learn more about CallFlags.
Attributes:
Special behaviors of the invoked contract are not allowed, such as chain calls, sending notifications, modifying state, etc.
Indicates that the called contract is allowed to read states.
Indicates that the called contract is allowed to write states.
Indicates that the called contract is allowed to call another contract.
Indicates that the called contract is allowed to send notifications.
Indicates that the called contract is allowed to read or write states.
Indicates that the called contract is allowed to read states or call another contract.
All behaviors of the invoked contract are allowed.
- NONE
Special behaviors of the invoked contract are not allowed, such as chain calls, sending notifications, modifying state, etc.
- READ_STATES
Indicates that the called contract is allowed to read states.
- WRITE_STATES
Indicates that the called contract is allowed to write states.
- ALLOW_CALL
Indicates that the called contract is allowed to call another contract.
- ALLOW_NOTIFY
Indicates that the called contract is allowed to send notifications.
- STATES
Indicates that the called contract is allowed to read or write states.
- READ_ONLY
Indicates that the called contract is allowed to read states or call another contract.
- ALL
All behaviors of the invoked contract are allowed.
- class OracleResponseCode(value)
Bases:
IntFlag
Represents the response code for the oracle request.
Attributes:
Indicates that the request has been successfully completed.
Indicates that the protocol of the request is not supported.
Indicates that the oracle nodes cannot reach a consensus on the result of the request.
Indicates that the requested Uri does not exist.
Indicates that the request was not completed within the specified time.
Indicates that there is no permission to request the resource.
Indicates that the data for the response is too large.
Indicates that the request failed due to insufficient balance.
Indicates that the content-type of the request is not supported.
Indicates that the request failed due to other errors.
- SUCCESS
Indicates that the request has been successfully completed.
- PROTOCOL_NOT_SUPPORTED
Indicates that the protocol of the request is not supported.
- CONSENSUS_UNREACHABLE
Indicates that the oracle nodes cannot reach a consensus on the result of the request.
- NOT_FOUND
Indicates that the requested Uri does not exist.
- TIME_OUT
Indicates that the request was not completed within the specified time.
- FORBIDDEN
Indicates that there is no permission to request the resource.
- RESPONSE_TOO_LARGE
Indicates that the data for the response is too large.
- INSUFFICIENT_FUNDS
Indicates that the request failed due to insufficient balance.
- CONTENT_TYPE_NOT_SUPPORTED
Indicates that the content-type of the request is not supported.
- ERROR
Indicates that the request failed due to other errors.
- class NeoAccountState
Bases:
object
Represents the account state of NEO token in the NEO system.
- Variables:
balance (int) – the current account balance, which equals to the votes cast
height (int) – the height of the block where the balance changed last time
vote_to (boa3.sc.types.ECPoint) – the voting target of the account
- class TransactionAttributeType(value)
Bases:
IntFlag
Represents the TransactionAttributeType for running smart contracts.
Attributes:
Indicates that the transaction is of high priority.
Indicates that the transaction is an oracle response
Indicates that the transaction is not valid before height.
Indicates that the transaction conflicts with hash.
- HIGH_PRIORITY
Indicates that the transaction is of high priority.
- ORACLE_RESPONSE
Indicates that the transaction is an oracle response
- NOT_VALID_BEFORE
Indicates that the transaction is not valid before height.
- CONFLICTS
Indicates that the transaction conflicts with hash.