Skip to content
module

neo3.network.payloads.address

Node address information.

Classes
class

neo3.network.payloads.address.AddrPayload(addresses)

Bases
neo3.core.serialization.ISerializable

Address payload with list of address information entries.

Methods
  • __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.
  • 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.
method

serialize(writer)

Serialize the object into a binary stream.

Parameters
  • writer (BinaryWriter) instance.
enum

neo3.network.payloads.address.AddressState()

Bases
enum.IntEnum int enum.ReprEnum enum.Enum

Node state

Used for tracking remote address state.

Members
  • CONNECTED (int) 0x1
  • DEAD (int) 0x3
  • NEW (int) 0x0
  • POOR (int) 0x2
enum

neo3.network.payloads.address.DisconnectReason()

Bases
enum.IntEnum int enum.ReprEnum enum.Enum

Reason for disconnecting a node.

Will also be broadcast back to the node when this PR is merged. For now only used internally with logging.

Members
  • HANDSHAKE_VERACK_ERROR (int) 0x5
  • HANDSHAKE_VERSION_ERROR (int) 0x4
  • IPFILTER_NOT_ALLOWED (int) 0x3
  • MAX_CONNECTIONS_REACHED (int) 0x1
  • POOR_PERFORMANCE (int) 0x2
  • SHUTTING_DOWN (int) 0x6
  • UNKNOWN (int) 0x0
class

neo3.network.payloads.address.NetworkAddress(address, capabilities=None, timestamp=None, state=<AddressState.NEW: 0>)

Bases
neo3.core.serialization.ISerializable

Address properties.

Attributes
  • ip (str) Get ip.
  • is_state_connected (bool) Test if state is connected.
  • is_state_dead (bool) Test if state is dead.
  • is_state_new (bool) Test if state is new.
  • is_state_poor (bool) Test if state is poor.
  • port (int) Get port.
Methods
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__()

Get the total size in bytes of the object.

Note

This size is only for the official properties such that it matches C#. Unofficial properties are not accounted for.

method

deserialize(reader)

Deserialize the object from a binary stream.

Parameters
  • reader (BinaryReader) instance.
method

serialize(writer)

Serialize the object into a binary stream.

Parameters
  • writer (BinaryWriter) instance.

Set state attribute to connected.

method

set_state_dead()

Set state attribute to dead.

method

set_state_new()

Set state attribute to new.

method

set_state_poor()

Set state attribute to poor.