extensible — Customizable payload

This module contains several classes for working with network addresses.

The ExtensiblePayload is used in the consensus mechanism, as well can be used for sending custom messages (i.e. in a plugin).

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

Bases: neo3.network.payloads.inventory.IInventory

deserialize(reader)

Deserialize the object from a binary stream.

Parameters

reader (BinaryReader) – instance.

Raises

ValueError – if the check byte is not 1.

Return type

None

classmethod deserialize_from_bytes(data)

Parse data into an object instance.

Parameters

data (Union[bytes, bytearray]) – hex escaped bytes.

Return type

~ISerializable_T

Returns

a deserialized instance of the class.

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.

Return type

None

get_hash_data(protocol_magic)

Get the unsigned data

Parameters

protocol_magic (int) – network protocol number (NEO MainNet = 5195086, Testnet = 1951352142, private net = ??)

Return type

bytes

get_script_hashes_for_verifying(snapshot)

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

Return type

List[UInt160]

hash()

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

Return type

UInt256

serialize(writer)

Serialize the object into a binary stream.

Parameters

writer (BinaryWriter) – instance.

Return type

None

serialize_unsigned(writer)

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

Parameters

writer (BinaryWriter) – instance.

Return type

None

to_array()

Serialize the object into a bytearray.

Return type

bytes

category

An identifier to which category the data belongs

data

Arbitrary data as required by the payload category

property inventory_type

Inventory type identifier.

Return type

InventoryType

sender

The hash of the account who has send the payload to the network

valid_block_end

Last height height in which the payload is valid

valid_block_start

Starting height in which the payload is valid

witness

The witness of the payload