This document defines a Stratum V2 extension to negotiate support for other protocol extensions between clients and servers.
The mechanism allows clients to request support for a list of extensions immediately after the SetupConnection
message exchange. The server responds with either:
RequestExtensions.Success
, listing the supported extensions.RequestExtensions.Error
, listing the unsupported extensions and extensions required by the receiver.This negotiation ensures that both parties can establish a common set of features before exchanging further protocol messages.
Terms like "MUST," "MUST NOT," "REQUIRED," etc., follow RFC2119 standards.
After the successful SetupConnection exchange, clients MUST send a RequestExtensions
message to indicate the extensions they wish to use. The server responds with:
RequestExtensions.Success
, confirming which extensions are supported.RequestExtensions.Error
, identifying unsupported extensions and required extensions from the responder.Clients MUST NOT use any features from extensions that are not confirmed as supported by the server.
Connection Setup:
Client --- SetupConnection (connection details) ---> Server Client <--- SetupConnection.Success (connection accepted) ---- Server
Copied!
Extension Negotiation:
Client --- RequestExtensions (list of requested U16) ---> Server Server Response: If successful: Client <--- RequestExtensions.Success (list of supported U16) ---- Server If an error occurs: Client <--- RequestExtensions.Error (unsupported U16, requested U16) ---- Server
Copied!
RequestExtensions
(Client -> Server)Field Name | Data Type | Description |
---|---|---|
request_id | U16 | Unique identifier for pairing the response. |
requested_extensions | SEQ0_64K[U16] | List of requested extension identifiers. |
RequestExtensions.Success
(Server -> Client)Field Name | Data Type | Description |
---|---|---|
request_id | U16 | Unique identifier for pairing the response. |
supported_extensions | SEQ0_64K[U16] | List of supported extension identifiers. |
RequestExtensions.Error
(Server -> Client)Field Name | Data Type | Description |
---|---|---|
request_id | U16 | Unique identifier for pairing the response. |
unsupported_extensions | SEQ0_64K[U16] | List of unsupported extension identifiers. |
required_extensions | SEQ0_64K[U16] | List of extension identifiers the server requires but were not requested by the client. |
Message Type (8-bit) | channel_msg_bit | Message Name |
---|---|---|
0x00 | 0 | RequestExtensions |
0x01 | 0 | RequestExtensions.Success |
0x02 | 0 | RequestExtensions.Error |
Error Handling:
RequestExtensions.Error
if none of the requested extensions are supported.requested_extensions
field of RequestExtensions.Error
.Ordering:
RequestExtensions
message MUST be sent immediately after SetupConnection.Success
and before any other protocol-specific messages.RequestExtensions
MUST be received before proceeding with any further protocol-specific messages.Server Behavior:
RequestExtensions
message.Client Behavior:
RequestExtensions.Success
or RequestExtensions.Error
response.RequestExtensions
, wait for a timeout of 2x the initial connection timeThis ensures clients can handle servers that do not implement extensions negotiation gracefully while maintaining reasonable connection times for mining operations.
Example Use Case:
A client requesting support for extensions 0x0002
and 0x0003
:
Client --- RequestExtensions [0x0002, 0x0003] ---> Server Client <--- RequestExtensions.Success [0x0002] ---- Server
Copied!
The client now knows that extension 0x0003
is not supported and must adapt its behavior accordingly.
Example Use Case with Unsupported Extension:
A client requesting only extension 0x0002
, but the server doesn't support it:
Client --- RequestExtensions [0x0002] ---> Server Client <--- RequestExtensions.Error [unsupported: 0x0002, required: []] ---- Server
Copied!
The client now knows that extension 0x0002
is not supported, but since no extensions are required by the server, the client MAY continue without using any extensions.
Example Use Case with Server Requesting Extensions:
A server requiring extension 0x0005
, but the client did not include it in its request:
Client --- RequestExtensions [0x0002, 0x0003] ---> Server Client <--- RequestExtensions.Error [unsupported: 0x0003, required: 0x0005] ---- Server
Copied!
The client now knows that the server requires extension 0x0005
and MAY choose to retry with a modified request. If the client does not retry with the required extension, the server MUST disconnect the client.