-
Notifications
You must be signed in to change notification settings - Fork 37
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
controlling the relay #2
Comments
The server implemented by stratum-relay is not an HTTP server. It is a raw socket server using JSON as text protocol to communicate both sides. For instance (in Linux) you can use echo + netcat to query: echo '{ "query":"getshares" }' | nc 127.0.0.1 4444 The reply is something like: {"error": false, "shares": {}} So, if you want to do it using PHP (it might be better using JavaScript but it depends on what you want to achieve), you need to open a socket to relayIP:4444 (there are tons of libraries you may use) and send the JSON text { "query":"getshares" } throw the socket (without any HTTP tag). The code related to this can be found here: https://github.com/p4u/stratum-relay/blob/master/control.py#L111 Good luck! And remember to share your code ;) |
cool :-) thanks i working on alcheminer / MAT firmware trying to make it more reliable, and also implement backup pool, right now it is python miner -> stratum proxy -> stratum relay -> pool the mining part works fine, but the proxy panics if no pool is available (and the miner only understands getwork so the proxy is needed. but im hoping with the relay on top that it will make the miner more stable. (with some added code for changing pool when/if pool is not available. |
I see. It is a bit crazy configuration I never seen before (getwork is very deprecated) but it should work as the relay just forwards the TCP packets. |
exactly crazy, but insofar seems to work better than the default, just need to get a backup pool system, and since i dont know python, i guess i have 2 options, 1: write a small script to test if the pool is running, or 2: spend more time than needed to implement missing backup pool in the relay lol |
By the way, remember to call the "cleanshares" method after "getshares" to reset the counters. It is implemented this way to prevent errors on the shares accounting. So only when your code get successfully the shares (error:False) you must call cleanshares. The backup pool is in my TODO list, as you can see the JSON method "setbackup" is defined but not yet implemented. For the moment no time/resources to do it in a short time, sorry :( You can change the main pool using the JSON method "setpool" without reseting the stratum-relay. Thus you can create a script to check the pool status and change it if fails. However it might be than the pool is accepting TCP connections but it does not allow the authorization or it does not send jobs throw the stratum protocol. So, obviously, the best way to do it would be to implement the backup inside the stratum-relay. |
well, i could have the script keep an eye on the output from the relay, and if problem is detected with pool, i can do the json method setpool :-p |
hi, ive tried to communicate with the releay server over port 4444 as configured, but i cannot figure out what exactly the server expects, ive tried with jsonrpcclient but recieve {'error': 1}
example used:
getinfo()); echo "[/div]"; ?>[ and ] used instead of html tag start/end
The text was updated successfully, but these errors were encountered: