neo3.network.payloads.verification
Classes for managing transaction signers and signature scopes.
ConditionAnd
— Match all conditions.ConditionBool
— Fixed value. Can be used to emulate GLOBAL scope.ConditionCalledByContract
— Match hash against caller script hash.ConditionCalledByEntry
— Match hash against entry script hash.ConditionCalledByGroup
— Match key against the caller group.ConditionGroup
— Match group against current script hash.ConditionNot
— Invert condition.ConditionOr
— Match any from a list of conditions.ConditionScriptHash
— Match hash against another script hash.IVerifiable
(
*args
,**kwargs
)
— Verifiable interface.Signer
— A class that specifies the rules of who can passCheckWitness()
verifications in a smart contract.Witness
— An executable verification script that validates a verifiable object like a transaction.WitnessCondition
(
)
— Base class for conditions.WitnessRule
— A firewall like rule with an action to deny or allow if the condition matches. Gives fine-grained control overwhere the signature of the witness is valid inside the system.
neo3.network.payloads.verification.
ConditionAnd
(
expressions
)
Match all conditions.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
ConditionBool
(
value
)
Fixed value. Can be used to emulate GLOBAL scope.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
ConditionCalledByContract
(
hash_
)
Match hash against caller script hash.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
ConditionCalledByEntry
(
)
Match hash against entry script hash.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
from_json
(
json
)
Create object from JSON
__len__
(
)
Return the length of the object in number of bytes.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
to_json
(
)
→ dict
Convert object into JSON representation.
neo3.network.payloads.verification.
ConditionCalledByGroup
(
group
)
Match key against the caller group.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
ConditionGroup
(
group
)
Match group against current script hash.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
ConditionNot
(
expression
)
Invert condition.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
ConditionOr
(
expressions
)
Match any from a list of conditions.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
ConditionScriptHash
(
hash_
)
Match hash against another script hash.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
from_json
(
json
)
Create object from JSON
to_json
(
)
→ dict
Convert object into JSON representation.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
neo3.network.payloads.verification.
IVerifiable
(
*args
, **kwargs
)
Verifiable interface.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.get_script_hashes_for_verifying
(
snapshot
)
(list) — Helper method to get the data used in verifying the object.serialize
(
writer
)
— Serialize the object into a binary stream.get_hash_data
(
protocol_magic
)
(bytes) — Get the unsigned data.to_array
(
)
(bytes) — Serialize the object into a bytearray.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.
__len__
(
)
Return the length of the object in number of bytes.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
get_hash_data
(
protocol_magic
)
→ bytes
Get the unsigned data.
protocol_magic
(int) — network protocol number (NEO MainNet = 860833102, Testnet (T5) = 894710606, private net = ?)
get_script_hashes_for_verifying
(
snapshot
)
→ list
Helper method to get the data used in verifying the object.
neo3.network.payloads.verification.
Signer
(
account
, scope=<WitnessScope.CALLED_BY_ENTRY: 1>
, allowed_contracts=None
, allowed_groups=None
, rules=None
)
A class that specifies the rules of who can pass CheckWitness()
verifications in a smart contract.
account
— The TX sender.allowed_contracts
(list[types.UInt160]) — Whitelist of contract script hashes if used withWitnessScope.CUSTOM_CONTRACTS
.allowed_groups
(list[cryptography.ECPoint]) — Whitelist of public keys if used withWitnessScope.CUSTOM_GROUPS
.rules
— List of rules that must pass for the current execution context when used withWitnessScope.WITNESS_RULES
.scope
(WitnessScope) — The configured validation scope.
get_all_rules
(
)
— Return all witness rules.__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON.
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
from_json
(
json
)
Create object from JSON.
get_all_rules
(
)
Return all witness rules.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
to_json
(
)
→ dict
Convert object into JSON representation.
neo3.network.payloads.verification.
Witness
(
invocation_script
, verification_script
)
An executable verification script that validates a verifiable object like a transaction.
invocation_script
— A set of VM instructions to set up the stack for verification.verification_script
— It is expected to set the result stack to a boolean True if validation passed.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.script_hash
(
)
(UInt160) — Get the script hash based on the verification script.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
from_json
(
json
)
Create object from JSON
script_hash
(
)
→ UInt160
Get the script hash based on the verification script.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
to_json
(
)
→ dict
Convert object into JSON representation.
neo3.network.payloads.verification.
WitnessCondition
(
)
Base class for conditions.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
from_json
(
json
)
Create object from JSON
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
to_json
(
)
→ dict
Convert object into JSON representation.
neo3.network.payloads.verification.
WitnessConditionType
(
)
Type of valid witness conditions.
AND
(int) — 0x2BOOLEAN
(int) — 0x0CALLED_BY_CONTRACT
(int) — 0x28CALLED_BY_ENTRY
(int) — 0x20CALLED_BY_GROUP
(int) — 0x29GROUP
(int) — 0x19NOT
(int) — 0x1OR
(int) — 0x3SCRIPT_HASH
(int) — 0x18
neo3.network.payloads.verification.
WitnessRule
(
action
, condition
)
A firewall like rule with an action to deny or allow if the condition matches. Gives fine-grained control overwhere the signature of the witness is valid inside the system.
__len__
(
)
— Return the length of the object in number of bytes.deserialize
(
reader
)
— Deserialize the object from a binary stream.serialize
(
writer
)
— Serialize the object into a binary stream.to_array
(
)
(bytes) — Serialize the object into a bytearray.to_json
(
)
(dict) — Convert object into JSON representation.deserialize_from_bytes
(
data
)
(ISerializable_T) — Parse data into an object instance.from_json
(
json
)
— Create object from JSON.
deserialize_from_bytes
(
data
)
Parse data into an object instance.
data
(bytes | bytearray) — hex escaped bytes.
a deserialized instance of the class.
to_array
(
)
→ bytes
Serialize the object into a bytearray.
__len__
(
)
Return the length of the object in number of bytes.
deserialize
(
reader
)
Deserialize the object from a binary stream.
reader
(BinaryReader) — instance.
from_json
(
json
)
Create object from JSON.
serialize
(
writer
)
Serialize the object into a binary stream.
writer
(BinaryWriter) — instance.
to_json
(
)
→ dict
Convert object into JSON representation.
neo3.network.payloads.verification.
WitnessRuleAction
(
)
Witness rule execution.
ALLOW
(int) — 0x1DENY
(int) — 0x0
neo3.network.payloads.verification.
WitnessScope
(
)
Flags that determine where in the system the signature is valid. Used by CheckWitness()
sys call.
CALLED_BY_ENTRY
(int) — 0x1CUSTOM_CONTRACTS
(int) — 0x10CUSTOM_GROUPS
(int) — 0x20GLOBAL
(int) — 0x80NONE
(int) — 0x0WITNESS_RULES
(int) — 0x40