Currently if one wants to discover available network services like RPC or REST you need to know about http://monitor.cityofzion.io/, https://happynodes.f27.ventures/ or something alike.
A solution to discover such services via the network would be to extend the VersionPayload with RPCPort, RESTPort and Websocket port (the most common ones currently missing). Then turn the Services into a flag that indicates which services are enabled.
https://github.com/neo-project/neo/blob/5222283c9f718217d550ca789a32c383d17749d3/neo/Network/P2P/Payloads/VersionPayload.cs#L10
This allows one to connect to the network and discover available services via the nodes (through a combination of PeerInfo requests and VersionPayload's). The aforementioned websites could also discover more available services improving the overall user experience.
The VersionPayload.Services field is basically designed for this purpose.
That's what I expected, but we miss the port information elsewhere
Once we add the Services flags, we can extend the VersionPayload structure.
is this planned for 3.0 or perhaps sooner?
Example:
c#
void ISerializable.Deserialize(BinaryReader reader)
{
Version = reader.ReadUInt32();
Services = (ServicesFlags)reader.ReadUInt64();
Timestamp = reader.ReadUInt32();
Port = reader.ReadUInt16();
Nonce = reader.ReadUInt32();
UserAgent = reader.ReadVarString(1024);
StartHeight = reader.ReadUInt32();
Relay = reader.ReadBoolean();
if (Services.HasFlag(ServicesFlags.Websocket))
{
WebsocketPort = reader.ReadUInt16();
}
...
}
Looks good
We should add protocol version, and the possibility to negotiate other protocols, in the future we should consider to use UDP for receive messages.
Done with the Capabilities
Done with the Capabilities
@shargon @lock9 please reopen as capabilities do not seem to be intended for the purpose of sharing RPC or REST services according to https://github.com/neo-project/neo/issues/1342#issuecomment-563196531
Most helpful comment
Example:
c# void ISerializable.Deserialize(BinaryReader reader) { Version = reader.ReadUInt32(); Services = (ServicesFlags)reader.ReadUInt64(); Timestamp = reader.ReadUInt32(); Port = reader.ReadUInt16(); Nonce = reader.ReadUInt32(); UserAgent = reader.ReadVarString(1024); StartHeight = reader.ReadUInt32(); Relay = reader.ReadBoolean(); if (Services.HasFlag(ServicesFlags.Websocket)) { WebsocketPort = reader.ReadUInt16(); } ... }