Skip to content
module

neo3.network.message

P2P network message classes.

Classes
  • Message P2P network message container.
class

neo3.network.message.Message(msg_type, payload=None)

Bases
neo3.core.serialization.ISerializable

P2P network message container.

Attributes
  • type (MessageType) MessageType: an identifier specifying the purpose of the message.
Methods
  • __len__() Get the total size in bytes of the object.
  • 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__()

Get the total size in bytes of the object.

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.message.MessageConfig()

Bases
enum.IntFlag int enum.ReprEnum enum.Flag enum.Enum

P2P network message config flags.

Members
  • COMPRESSED (int) 0x1
  • NONE (int) 0x0
enum

neo3.network.message.MessageType()

Bases
enum.IntEnum int enum.ReprEnum enum.Enum

P2P network message types.

Members
  • ADDR (int) 0x11
  • ALERT (int) 0x40
  • BLOCK (int) 0x2c
  • CONSENSUS (int) 0x2d
  • DEFAULT (int) 0xff
  • EXTENSIBLE (int) 0x2e
  • FILTERADD (int) 0x31
  • FILTERCLEAR (int) 0x32
  • FILTERLOAD (int) 0x30
  • GETADDR (int) 0x10
  • GETBLOCKBYINDEX (int) 0x29
  • GETBLOCKS (int) 0x24
  • GETDATA (int) 0x28
  • GETHEADERS (int) 0x20
  • HEADERS (int) 0x21
  • INV (int) 0x27
  • MEMPOOL (int) 0x25
  • MERKLEBLOCK (int) 0x38
  • NOTFOUND (int) 0x2a
  • PING (int) 0x18
  • PONG (int) 0x19
  • REJECT (int) 0x2f
  • TRANSACTION (int) 0x2b
  • VERACK (int) 0x1
  • VERSION (int) 0x0