This repository has been archived by the owner on May 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
start.js
57 lines (49 loc) · 1.56 KB
/
start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const StratumPool = require('./lib/class.StratumPool');
const pool = new StratumPool({
config: {
address: 'TBVKqLhVBt4aCwM5aPvUin5YU4ATHWUNpC',
daemon: {
host: '127.0.0.1',
rpcPort: 18888,
user: 'rpcuser',
password: 'x'
},
port: {
number: 3000,
diff: 2048
},
coinbaseSignature: '/MintPond MTP Ref/'
},
authorizeFn: authorizeFn
});
pool.on(StratumPool.EVENT_CLIENT_CONNECTED, function (e) {
console.log('Client connected: ' + e.client.remoteAddress);
});
pool.on(StratumPool.EVENT_CLIENT_DISCONNECTED, function (e) {
console.log('Client disconected: ' + e.client.remoteAddress + ', reason: ' + e.reason);
});
pool.on(StratumPool.EVENT_SHARE_SUBMITTED, function (e) {
const shareData = e.shareData;
console.log('Share received: ' + JSON.stringify({
worker: shareData.worker.name,
isValidShare: e.isValidShare,
isValidBlock: e.isValidBlock,
error: shareData.error ? [shareData.errorCode, shareData.error] : null,
jobId: shareData.job ? shareData.job.id : null/* stale share */,
nTime: shareData.time,
nonce: shareData.nonce,
extraNonce1: shareData.extraNonce1,
extraNonce2: shareData.extraNonce2,
mtpHashValue: shareData.mtpHashValue,
}, null, 4));
});
pool.on(StratumPool.EVENT_NEW_BLOCK, function () {
console.log('NEW BLOCK');
});
pool.start();
function authorizeFn(worker, callback) {
callback({
isAuthorized: true,
error: null
});
}