Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to a remote stratum server #11

Open
aashidham opened this issue Oct 26, 2016 · 14 comments
Open

Connecting to a remote stratum server #11

aashidham opened this issue Oct 26, 2016 · 14 comments

Comments

@aashidham
Copy link

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?

@pocesar
Copy link
Owner

pocesar commented Oct 26, 2016

that code is for demonstration only, it sends fake data when connecting, that's why it's disconnecting you right way

@aashidham
Copy link
Author

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.

@pocesar
Copy link
Owner

pocesar commented Oct 26, 2016

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

@mersed
Copy link

mersed commented Oct 10, 2017

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.

@masajid390
Copy link

I am having the same issue as well.

@masajid390
Copy link

@mersed @aashidham did you get some other way to connect?

@envman
Copy link
Contributor

envman commented Oct 25, 2017

Added envman@8460548 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.

@pocesar
Copy link
Owner

pocesar commented Oct 25, 2017

@envman thanks for that, can you make the PR? I'll merge it (as it's not a breaking change)

@envman
Copy link
Contributor

envman commented Oct 25, 2017

@pocesar opened: #16

Not sure if it's worth adding some checks to make sure the URL is correct, could auto remove stratum+tcp:// maybe?

@pocesar
Copy link
Owner

pocesar commented Oct 25, 2017

maybe that could be added to the README, because, indeed, stratum+tcp is not a valid protocol per se

@masajid390
Copy link

@pocesar Thanks :-)

@envman
Copy link
Contributor

envman commented Oct 26, 2017

added to readme, just check you're happy with the way I wrote it ;)

@mersed
Copy link

mersed commented Oct 30, 2017

@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.

@joepvandepol
Copy link

@mersed did you got it working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants