node-stratum
node-stratum copied to clipboard
Connecting to a remote stratum server
I've used the client.js inside the example directory and tried to connect to a remote stratum server: https://gist.github.com/aashidham/dd33b949d8ad4eb9ba57301b7888065e
But it fails with 'connection closed'. Any idea why?
that code is for demonstration only, it sends fake data when connecting, that's why it's disconnecting you right way
It disconnects even before authorizatjon, even before it sends fake data.
On Oct 26, 2016, at 9:32 AM, Paulo Cesar [email protected] wrote:
that code is for demonstration only, it sends fake data when connecting, that's why it's disconnecting you right way
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
before executing the client, set the environment variable set DEBUG=stratum,jsonrpc
in your command line (export
if you in linux), you'll see what's happening underneath
I am having exactly the same issue right now. For multiple remote popular pools which supports stratum protocol, i am getting "Connection closed" right after trying to connect to the pool.
I am having the same issue as well.
@mersed @aashidham did you get some other way to connect?
Added https://github.com/envman/node-stratum/commit/84605482d433072aa989082be8cb6160e0c6310d to send the error out.
then the following error code shows the socket error:
client.on('error', function(socket, e) {
socket.destroy();
console.log('Connection closed', e);
process.exit(1);
});
mine was ENOTFOUND, removed the stratum+tcp:// from the start of the address and it worked.
@envman thanks for that, can you make the PR? I'll merge it (as it's not a breaking change)
@pocesar opened: https://github.com/pocesar/node-stratum/pull/16
Not sure if it's worth adding some checks to make sure the URL is correct, could auto remove stratum+tcp:// maybe?
maybe that could be added to the README, because, indeed, stratum+tcp is not a valid protocol per se
@pocesar Thanks :-)
added to readme, just check you're happy with the way I wrote it ;)
@marslan390 Are you able to use the client in order to connect with the remote server? Indeed, removing "stratum+tcp" will allow you to connect to the server, but I am still encountering few issues.
After the connection, I am sending the subscribe and I am getting appropriate response to that call. After that, sending authorize, but response is not what I am expecting to be:
With socket.stratumAuthorize(stratumUsername, stratumPassword) we are sending:
{"params": ["slush.miner1", "password"], "id": 2, "method": "mining.authorize"}\n
And we are expecting:
{"error": null, "id": 2, "result": true}\n
but that actually is not what happens. In this case on "socket.stratumAuthorize()" im getting the same response from the server as on socket.stratumSubscribe() .
Tested against https://www.litecoinpool.org and few other servers/pools.
Also please make a note that using raw socket connection (nodejs net module) within the node and writting to the socket directly using the same parameters will result with proper messages.
@mersed did you got it working?