Open aleqx opened 7 years ago
Looking closer at the code, it seems all this proxy does is relaying all messages back and forth between the pool and miners, and altering the id
field to make it unique per miner. It fails to set the id
back to the same value issued by the miner (breaking the JSON-RPC protocol). Many (all?) pools also reject multiple authorize requests on the same connections, causing miners to fail.
What's needed is a proper proxy that acts as a single miner to the pool, subscribing itself to the pool and dealing with the subscribe
, authorize
, set_target
methods from the pool, then wait for miners to connect. Upon the latter, it should subscribe
, authorize
, set_target
the miners directly (without relaying anything to the pool). It should also record/queue any job broadcasts from the pool for when miners connect. The only messages relayed between miners and pool should then be the job broadcasts from the pool and job submits from miners, making sure that the id
field value of each miner's request is preserved when replying back to the miner.
A state machine is needed to implement the above. It's not a simple hack. You made a good start though.
It doesn't seem to work with multiple miners on different machines. I tried the nheqminer with CPU mining and the flypool pool.
In a normal miner->pool communication, the
id
field in the packets is incremented with every exchange of packets (excluding pool broadcasts). Your code alters theid
field to be equal to the miner'sid
, essentially keeping it fixed for each miner. You also pass the same job to all miners. There are a number of problems that are happening:id
is not equal to 1 (here theid
is equal to 5 because it was the 5th connecting client, which the proxy incremented to 5 and then keeps it at 5):launch proxy
,launch miner 1
,launch miner 2
then miner 2 fails and exits saying it's not authorized (looking at the messages, the pool responds with the same Extranonce1 and Extranonce2_size to the mining.subscribe request of miner 2 ...It seems that your proxy hasn't really been tested with multiple miners, or with different mining software (see my other raised issue about EWBF). It would be nice if you looked into it.