Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: wetblanket on January 16, 2018, 10:13:51 PM



Title: Help with stratum protocol/transport questions
Post by: wetblanket on January 16, 2018, 10:13:51 PM
As an exercise, I'm toying with building a stratum proxy. I know they already exist, but I'm looking to experiment with some more recent tech and this seems like a good project.

This BCT thread (https://bitcointalk.org/index.php?topic=557866.0) is a good starting point for the stratum protocol. Along with the 'canonical' stratum protocol google doc (https://docs.google.com/document/d/17zHy1SUlhgtCMbypO8cHgpWH73V5iUQKk_0rWvMqSNs/edit?hl=en_US) and slushpool's stratum overview (https://slushpool.com/help/manual/stratum-protocol), there's a fair bit to digest. Definitely not a true spec, but enough to work with.

The 'spec' defines 4 transports: Socket transport, Websocket, HTTP Poll, and HTTP Push (which is a variation of HTTP Poll). I get the feeling that much has changed since stratum was first introduced, so I'm wondering if all 4 protocols are still needed/used - is it necessary to implement them all in a proxy? What about if one was implementing a pool? For example, if miners have moved towards supporting plain TCP Socket transport only, there's no point in implementing the other 3 transports.

 - Let me know if there's a better forum board for this post - I'll move it if needed.


Title: Re: Help with stratum protocol/transport questions
Post by: monerofox2 on January 16, 2018, 11:09:57 PM
Currently having problems with stratum from the opposite side, while building my own mining software.  I've spent the last couple of days, trying to simply submit a result to a stratum pool...

The original spec, pretty clearly dislikes the whole HTTP / long poll approach, and I agree, I barely considered anything other than a plain socket (with cJSON to handle the data), it's way simpler than anything else and does *almost* everything needed... only potential extra feature needed, is SSL...  So I think a proxy just supporting TCP sockets would do for most miners.

I've looked through a couple of the open source Monero miners today, and everything I've checked just uses plain TCP sockets.

I'm using Claymore for Ethereum and that's stratum+tcp also.

Thx Monerofox


Title: Re: Help with stratum protocol/transport questions
Post by: wetblanket on January 17, 2018, 12:43:04 AM
The original spec, pretty clearly dislikes the whole HTTP / long poll approach, and I agree, I barely considered anything other than a plain socket (with cJSON to handle the data), it's way simpler than anything else and does *almost* everything needed... only potential extra feature needed, is SSL...  So I think a proxy just supporting TCP sockets would do for most miners.

I think you ought to be able to do SSL with just the plain TCP socket - it's just a 'modification' to the socket transport layer. I'm pretty sure that miners that support SSL are doing it this way. Remember, HTTPS != SSL; HTTPS == HTTP on top of SSL-enabled sockets.  I suppose the proper term these days is TLS though...

I've looked through a couple of the open source Monero miners today, and everything I've checked just uses plain TCP sockets.

I'm using Claymore for Ethereum and that's stratum+tcp also.

That is interesting to note! Thanks for your reply.

So anecdotally speaking from the evidence presented by 1 response, I can safely say that TCP and SSL+TCP socket streams are all that's needed!  ;)  Would love further feedback as well.