Im trying to build a simple tcp proxy to throw stratum connections from my server to a pool. but for some reasons i get some errors back from the pool. maybe i cant use tcp for stratum connections?
looks i get work to do from the pool but submitting the share is corrupted?!
this is the code: (Node.js)
var net = require('net');
var LOCAL_PORT = 8000;
var REMOTE_PORT = 7777;
var REMOTE_ADDR = "eu.multipool.us";
var server = net.createServer(function (socket) {
socket.setNoDelay(true);
socket.setKeepAlive(true, 120);
socket.on('data', function (msg) {
console.log(' ** START **');
console.log('<< From client to proxy ', msg.toString());
var serviceSocket = new net.Socket();
serviceSocket.connect(parseInt(REMOTE_PORT), REMOTE_ADDR, function () {
console.log('>> From proxy to remote', msg.toString());
serviceSocket.write(msg);
});
serviceSocket.on("data", function (data) {
console.log('<< From remote to proxy', data.toString());
socket.write(data);
console.log('>> From proxy to client', data.toString());
});
});
});
server.listen(LOCAL_PORT);
console.log("TCP server accepting connection on port: " + LOCAL_PORT);
and here is my output:
<< From remote to proxy {"error": null, "id": 0, "result": [["mining.notify", "ae6812eb4cd7735a302a8a9dd95cf71f"], "f800aa12", 4]}
{"params": [512], "id": null, "method": "mining.set_difficulty"}
{"params": ["4f2", "80f43f1d69e266a050ba55b7c3b8d3c0d732f88c2125713e96867569e10fabc2", "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703960c03062f503253482f04c6ae4d5308", "0d2f7374726174756d506f6f6c2f000000000100c817a8040000001976a914abd45a41adee335184e847bd7515622609bcfaab88ac00000000", [], "00000002", "1c0105cc", "534daec5", true], "id": null, "method": "mining.notify"}
>> From proxy to client {"error": null, "id": 0, "result": [["mining.notify", "ae6812eb4cd7735a302a8a9dd95cf71f"], "f800aa12", 4]}
{"params": [512], "id": null, "method": "mining.set_difficulty"}
{"params": ["4f2", "80f43f1d69e266a050ba55b7c3b8d3c0d732f88c2125713e96867569e10fabc2", "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703960c03062f503253482f04c6ae4d5308", "0d2f7374726174756d506f6f6c2f000000000100c817a8040000001976a914abd45a41adee335184e847bd7515622609bcfaab88ac00000000", [], "00000002", "1c0105cc", "534daec5", true], "id": null, "method": "mining.notify"}
** START **
<< From client to proxy {"params": ["soulreafer.1", "4f3", "02000000", "534daf03", "82716c66"], "id": 3, "method": "mining.submit"}
>> From proxy to remote {"params": ["soulreafer.1", "4f3", "02000000", "534daf03", "82716c66"], "id": 3, "method": "mining.submit"}
<< From remote to proxy {"error": [-2, "Connection is not subscribed for mining", null], "id": 3, "result": null}
>> From proxy to client {"error": [-2, "Connection is not subscribed for mining", null], "id": 3, "result": null}
** START **
hopefully someone can help