Skip to content
module

neo3.network.payloads.extensible

Customizable payload.

Classes
class

neo3.network.payloads.extensible.ExtensiblePayload(category, valid_block_start, valid_block_end, sender, data, witness)

Bases
neo3.network.payloads.inventory.IInventory neo3.network.payloads.verification.IVerifiable neo3.core.serialization.ISerializable

A payload that supports arbitrary data.

Attributes
  • category An identifier to which category the data belongs
  • data Arbitrary data as required by the payload category
  • inventory_type (InventoryType) Inventory type identifier.
  • sender The hash of the account who has sent the payload to the network
  • valid_block_end Last height in which the payload is valid
  • valid_block_start Starting height in which the payload is valid
  • witness The witness of the payload
Methods
  • __len__() Return the length of the object in number of bytes.
  • deserialize(reader) Deserialize the object from a binary stream.
  • deserialize_unsigned(reader) Deserialize the unsigned data part of the object from a binary stream.
  • get_hash_data(protocol_magic) (bytes) Get the unsigned data.
  • get_script_hashes_for_verifying(snapshot) (list) Helper method to get the data used in verifying the object.
  • hash() (UInt256) Get a unique identifier based on the unsigned data portion of the object.
  • serialize(writer) Serialize the object into a binary stream.
  • serialize_unsigned(writer) Serialize the unsigned part of the object into a binary stream.
  • to_array() (bytes) Serialize the object into a bytearray.
  • deserialize_from_bytes(data) (ISerializable_T) Parse data into an object instance.
classmethod

deserialize_from_bytes(data)

Parse data into an object instance.

Parameters
  • data (bytes | bytearray) hex escaped bytes.
Returns (ISerializable_T)

a deserialized instance of the class.

method

to_array() → bytes

Serialize the object into a bytearray.

method

__len__()

Return the length of the object in number of bytes.

method

deserialize(reader)

Deserialize the object from a binary stream.

Parameters
  • reader (BinaryReader) instance.
Raises
  • ValueError if the check byte is not 1.
method

deserialize_unsigned(reader)

Deserialize the unsigned data part of the object from a binary stream.

Parameters
  • reader (BinaryReader) instance.
Raises
  • ValueError if the valid_block_start exceeds the valid_block_end field.
method

get_script_hashes_for_verifying(snapshot) → list

Helper method to get the data used in verifying the object.

method

hash() → UInt256

Get a unique identifier based on the unsigned data portion of the object.

method

serialize(writer)

Serialize the object into a binary stream.

Parameters
  • writer (BinaryWriter) instance.
method

serialize_unsigned(writer)

Serialize the unsigned part of the object into a binary stream.

Parameters
  • writer (BinaryWriter) instance.
method

get_hash_data(protocol_magic) → bytes

Get the unsigned data.

Parameters
  • protocol_magic (int) network protocol number (NEO MainNet = 860833102, Testnet (T5) = 894710606, private net = ?)