capabilities — Node services

This module describes the services supported by a node.

A node can provide a variety of services such as a Websocket server or TCP/IPv4 server. These capabilities are shared with a remote node through a VersionPayload during the handshake sequence when setting up a connection. Over time additional services are expected to be added by the NEO Core team.

The ServerCapability tells a node which communication layers (TCP or Websocket) are support for exchanging NEO specific messages. For more information on what information can be requested and how refer to the message module.

Note

This SDK only supports communicating at the TCP transport layer, not on the higher level Websocket application layer.

Where ServerCapability shares the details where the general information can be retrieved from, the FullNodeCapability indicates that the endpoint maintains full blockchain data and support relaying of data.

class neo3.network.capabilities.NodeCapability(n_type)

Bases: neo3.core.serialization.ISerializable

Capability base class.

deserialize(reader)

Deserialize the object from a binary stream.

Parameters

reader (BinaryReader) – instance.

Return type

None

static deserialize_from(reader)
Return type

NodeCapability

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.

abstract deserialize_without_type(reader)

Deserialize from a buffer without reading the type member.

Return type

None

serialize(writer)

Serialize the object into a binary stream.

Parameters

writer (BinaryWriter) – instance.

Return type

None

abstract serialize_without_type(writer)

Serialize into a buffer without including the type member.

Return type

None

to_array()

Serialize the object into a bytearray.

Return type

bytes

class neo3.network.capabilities.ServerCapability(n_type, port=0)

Bases: neo3.network.capabilities.NodeCapability

A capability expressing node support for TCP or Websocket services.

deserialize(reader)

Deserialize the object from a binary stream.

Parameters

reader (BinaryReader) – instance.

Return type

None

static deserialize_from(reader)
Return type

NodeCapability

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_without_type(reader)

Deserialize the object from a binary stream without deserializing the base class type property.

Parameters

reader (BinaryReader) – instance.

Return type

None

serialize(writer)

Serialize the object into a binary stream.

Parameters

writer (BinaryWriter) – instance.

Return type

None

serialize_without_type(writer)

Serialize the object into a binary stream without serializing the base class type property.

Parameters

writer (BinaryWriter) – instance.

Return type

None

to_array()

Serialize the object into a bytearray.

Return type

bytes

class neo3.network.capabilities.FullNodeCapability(start_height=0)

Bases: neo3.network.capabilities.NodeCapability

A capability expressing the node has full blockchain data and accepts relaying.

deserialize(reader)

Deserialize the object from a binary stream.

Parameters

reader (BinaryReader) – instance.

Return type

None

static deserialize_from(reader)
Return type

NodeCapability

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_without_type(reader)

Deserialize the object from a binary stream without deserializing the base class type property.

Parameters

reader (BinaryReader) – instance.

Return type

None

serialize(writer)

Serialize the object into a binary stream.

Parameters

writer (BinaryWriter) – instance.

Return type

None

serialize_without_type(writer)

Serialize the object into a binary stream without serializing the base class type property.

Parameters

writer (BinaryWriter) – instance.

Return type

None

to_array()

Serialize the object into a bytearray.

Return type

bytes

class neo3.network.capabilities.NodeCapabilityType(value)

Bases: enum.IntEnum

An enumeration.

FULLNODE = 16

Server has full chain data

TCPSERVER = 1

Server has TCP listening capabilities

WSSERVER = 2

Server has WebSocket listening capabilities