I'm trying for several days to connect to a stratum server in nodejs. But I don't get my code working. I've tried several npm packages but most of them are outdated. Then I found node-stratum.
This package works fine locally so I expected that it works also with a remote server.
After I changed to host and port to pool.minexmr.com
with port number 4444
I got this error message
Oops error: Error: Stratum request without method or result field
at serverForEachCommand (C:\Users\JP\Documents\xmr-web\node_modules\stratum\lib\server.js:350:19)
at arrayEach (C:\Users\JP\Documents\xmr-web\node_modules\stratum\node_modules\lodash\index.js:1289:13)
at Function.<anonymous> (C:\Users\JP\Documents\xmr-web\node_modules\stratum\node_modules\lodash\index.js:3345:13)
at Object.processCommands (C:\Users\JP\Documents\xmr-web\node_modules\stratum\lib\server.js:298:9)
at Object.handleData (C:\Users\JP\Documents\xmr-web\node_modules\stratum\lib\client.js:138:38)
at Socket.twoArgs (C:\Users\JP\Documents\xmr-web\node_modules\better-curry\index.js:74:18)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
I used to code in the example/client My full code is here codepile
I also tried to change the host to miningpoolhub but there I got no error and it stops by the console.log('Sent!')
so I figured out that I better stick with pool.minexmr.com
In the codepile I also added the other logs from the terminal
Okay, finally I got the answer. Monero stratum has a different payload than Bitcoin With Wireshark I filtered the payload out en changed the client code van node-stratum. I changed the node-stratum core code a bit too.