js-stratum-proxy
v0.0.17
Published
Proxy stratum mining either programatically or staticlly to your desired stratum mining pool.
Downloads
25
Readme
js-stratum-proxy
Proxy stratum mining either programatically or staticlly to your desired stratum mining pool.
Install
npm i js-stratum-proxy
Example Usage
You may choose which pools to proxy to by overiding handleAuthorization
. The object you return will be used to create
a connection with the pool.
const net = require('net');
const StratumProxy = require('js-stratum-proxy');
class MyStratumProxy extends StratumProxy {
async handleAuthorization(address, minerName) {
const { poolAddress, poolPort } = await getPoolDataForAddressFromSomewhere(address);
// Make sure you return an object with these keys
return { address, minerName, poolAddress, poolPort };
}
}
const app = net.createServer(socket => {
const connection = new MyStratumProxy(socket);
connection.on('connected', () => console.log('connected'));
connection.on('data', data => console.log('data', data));
connection.on('error', error => console.log('error', error));
connection.on('disconnected', () => console.log('disconnected'));
});
app.listen(3333, () => {
console.log(`Proxy server listening at port 3333`);
});