· 7 years ago · Feb 28, 2019, 01:30 PM
1#### Event ```v1/algorithms```
2
3Subscribe:
4
5```
6 socket.on('v1/algorithms', function(data) {
7 // data:
8 {
9 "id": 7,
10 "errors": null,
11 "response": [
12 {
13 "type": "x11",
14 "stratum_host": "dev.propool.io",
15 "share_time": 30,
16 "share_time_divider": 4294967296,
17 "multiplier": 1,
18 "connections": [
19 {
20 "diff": 0.001,
21 "port": 15011
22 },
23 {
24 "diff": 0.1,
25 "port": 15012
26 },
27 {
28 "diff": 1,
29 "port": 15013
30 }
31 ],
32 "coins": [
33 {
34 "id": 1005,
35 "name": "dash_testnet",
36 "symbol": "DASH_testnet",
37 "profit": "0",
38 "icon_url": "http://dev.propool.io/images/coin_dash.svg",
39 "auxes": []
40 }
41 ]
42 },
43 {
44 "type": "scrypt",
45 "stratum_host": "dev.propool.io",
46 "share_time": 20,
47 "share_time_divider": 4294967296,
48 "multiplier": 65536,
49 "connections": [
50 {
51 "diff": 15,
52 "port": 15001
53 },
54 {
55 "diff": 131072,
56 "port": 15002
57 }
58 ],
59 "coins": [
60 {
61 "id": 1002,
62 "name": "litecoin_testnet",
63 "symbol": "LTC_testnet",
64 "profit": "24606623.36321110835608791875",
65 "icon_url": "http://dev.propool.io/images/coin_litecoin.svg",
66 "auxes": [
67 1004
68 ]
69 },
70 {
71 "id": 1004,
72 "name": "dogecoin_testnet",
73 "symbol": "DOGE_testnet",
74 "profit": "430653.08001094732802515931",
75 "icon_url": "http://dev.propool.io/images/coin_dogecoin.svg",
76 "auxes": []
77 }
78 ]
79 }
80 ],
81 "type": "message",
82 "event": "v1/algorithms"
83 });
84```
85
86```
87 socket.on('subscribe', function(data) {
88 // data: {"id": 1, "event":"v1/algorithms", "response":{}}]
89 });
90```
91
92```
93 socket.emit('subscribe', 'v1/algorithms', {id: 1});
94```
95
96> After subscribe will emit ``v1/algorithms``
97
98Unsubscribe:
99
100```
101 socket.on('unsubscribe', function(data) {
102 // data: {"id": 2, "event":"v1/algorithms", "response":{}}]
103 });
104```
105
106```
107 socket.emit('unsubscribe', 'v1/algorithms', {id: 2});
108```
109
110
111#### Event ```v1/balances```
112
113Subscribe:
114
115```
116 socket.on('v1/balances', function(data) {
117 // data:
118 {
119 "id": 4,
120 "errors": null,
121 "response": [
122 {
123 "coin": {
124 "id": 1020,
125 "symbol": "ETH",
126 "name": "ethereum",
127 "precision": 18
128 },
129 "confirmed_balance": "1725477928074038078",
130 "unconfirmed_balance": "0",
131 "withdrawn_frozen_balance": "0",
132 "withdrawn_balance": "0",
133 "convertible_frozen_balance": "0",
134 "converted_balance": "219040167939939966798"
135 },
136 {
137 "coin": {
138 "id": 1012,
139 "symbol": "MONA",
140 "name": "monacoin",
141 "precision": 8
142 },
143 "confirmed_balance": "107501563932",
144 "unconfirmed_balance": "25555555555",
145 "withdrawn_frozen_balance": "0",
146 "withdrawn_balance": "0",
147 "convertible_frozen_balance": "0",
148 "converted_balance": "2788526386261"
149 },
150 {
151 "coin": {
152 "id": 1001,
153 "symbol": "BTC",
154 "name": "Bitcoin",
155 "precision": 8
156 },
157 "confirmed_balance": "2435192486",
158 "unconfirmed_balance": "0",
159 "withdrawn_frozen_balance": "102000000",
160 "withdrawn_balance": "0",
161 "convertible_frozen_balance": "0",
162 "converted_balance": "0"
163 },
164 {
165 "coin": {
166 "id": 1015,
167 "symbol": "ZEN",
168 "name": "zen",
169 "precision": 8
170 },
171 "confirmed_balance": "62125000000",
172 "unconfirmed_balance": "5250000000",
173 "withdrawn_frozen_balance": "0",
174 "withdrawn_balance": "0",
175 "convertible_frozen_balance": "0",
176 "converted_balance": "261996745807"
177 },
178 {
179 "coin": {
180 "id": 1021,
181 "symbol": "BTG",
182 "name": "bitcoin gold",
183 "precision": 8
184 },
185 "confirmed_balance": "0",
186 "unconfirmed_balance": "1061875446",
187 "withdrawn_frozen_balance": "0",
188 "withdrawn_balance": "0",
189 "convertible_frozen_balance": "0",
190 "converted_balance": "75746917562"
191 },
192 {
193 "coin": {
194 "id": 1002,
195 "symbol": "LTC",
196 "name": "litecoin",
197 "precision": 8
198 },
199 "confirmed_balance": "2333246",
200 "unconfirmed_balance": "0",
201 "withdrawn_frozen_balance": "0",
202 "withdrawn_balance": "0",
203 "convertible_frozen_balance": "0",
204 "converted_balance": "197447353"
205 }
206 ],
207 "type": "message",
208 "event": "v1/balances"
209 }
210 });
211```
212
213```
214 socket.on('subscribe', function(data) {
215 // data: {"id": 1, "event":"v1/balances", "response":{}}]
216 });
217```
218
219```
220 socket.emit('subscribe', 'v1/balances', {id: 1});
221```
222
223> After subscribe will emit ``v1/balances``
224
225Unsubscribe:
226
227```
228 socket.on('unsubscribe', function(data) {
229 // data: {"id": 2, "event":"v1/balances", "response":{}}]
230 });
231```
232
233```
234 socket.emit('unsubscribe', 'v1/balances', {id: 2});
235```
236
237#### Event ```v1/mining-statistics```
238
239Subscribe:
240
241```
242 socket.on('v1/mining-statistics', function(data) {
243 // data:
244 {
245 "id": 22,
246 "errors": null,
247 "response": [
248 {
249 "stats": {
250 "current_hashrate": "0",
251 "average_hashrate": "11",
252 "accepted_shares": "27",
253 "rejected_shares": "0",
254 "stale_shares": "0",
255 "session_key": "7957e5902edffe1cd19b6bc633db5950f1b2529b_1021",
256 "user_id": 1,
257 "worker_id": 53292,
258 "worker_name": "sss",
259 "worker_type": "third_party",
260 "uid": "7957e5902edffe1cd19b6bc633db5950f1b2529b",
261 "coin_id": 1021,
262 "devices": [
263 {
264 "id": 30563,
265 "worker_id": 53292,
266 "device_name": null,
267 "device_id": null,
268 "is_exist": true,
269 "created_at": "2019-02-28T09:26:42.359Z",
270 "updated_at": "2019-02-28T09:26:42.359Z"
271 }
272 ],
273 "auxes": [],
274 "connected_at": 1551349055194,
275 "status": "working"
276 },
277 "session_key": "7957e5902edffe1cd19b6bc633db5950f1b2529b_1021"
278 }
279 ],
280 "type": "message",
281 "event": "v1/mining-statistics"
282 }
283 //or on updating
284 {
285 "id": 22,
286 "errors": null,
287 "response": [
288 {
289 "stats": {
290 "current_hashrate": "16.069046684974502",
291 "average_hashrate": "16.069046684974502",
292 "accepted_shares": "28",
293 "rejected_shares": "0",
294 "stale_shares": "0",
295 "session_key": "7957e5902edffe1cd19b6bc633db5950f1b2529b_1021"
296 },
297 "session_key": "7957e5902edffe1cd19b6bc633db5950f1b2529b_1021"
298 }
299 ],
300 "type": "message",
301 "event": "v1/mining-statistics"
302 }
303 //or on disconnecting
304 {
305 "id": 22,
306 "errors": null,
307 "response": [
308 {
309 "stats": null,
310 "session_key": "7957e5902edffe1cd19b6bc633db5950f1b2529b_1021"
311 }
312 ],
313 "type": "message",
314 "event": "v1/mining-statistics"
315 }
316 });
317```
318
319```
320 socket.on('subscribe', function(data) {
321 // data: {"id": 1, "event":"v1/mining-statistics", "response":{}}]
322 });
323```
324
325```
326 socket.emit('subscribe', 'v1/mining-statistics', {id: 1});
327```
328
329> After subscribe will emit ``v1/mining-statistics``
330
331Unsubscribe:
332
333```
334 socket.on('unsubscribe', function(data) {
335 // data: {"id": 2, "event":"v1/mining-statistics", "response":{}}]
336 });
337```
338
339```
340 socket.emit('unsubscribe', 'v1/mining-statistics', {id: 2});
341```
342
343#### Event ```v1/hashrate-workers-statistics```
344
345Subscribe:
346
347```
348 socket.on('v1/hashrate-workers-statistics', function(data) {
349 // data:
350 {
351 "id": 8,
352 "errors": null,
353 "response": {
354 "from": "2019-02-28T10:36:00.000Z",
355 "to": "2019-02-28T11:06:00.000Z",
356 "setup_sizes": [
357 {
358 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
359 "setup_size": 1
360 }
361 ],
362 "stats": [
363 {
364 "algorithm": "equihash-btg",
365 "user_id": 3,
366 "coin_id": 1021,
367 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
368 "worker_id": 39509,
369 "hashrate": "10.9226666666666660",
370 "sum_difficulty": "0.04",
371 "date_interval_group": "2019-02-28T10:52:30.000Z"
372 },
373 {
374 "algorithm": "equihash-btg",
375 "user_id": 3,
376 "coin_id": 1021,
377 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
378 "worker_id": 39509,
379 "hashrate": "4.0960000000000000",
380 "sum_difficulty": "0.015",
381 "date_interval_group": "2019-02-28T10:53:00.000Z"
382 },
383 {
384 "algorithm": "equihash-btg",
385 "user_id": 3,
386 "coin_id": 1021,
387 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
388 "worker_id": 39509,
389 "hashrate": "1.09226666666666670000",
390 "sum_difficulty": "0.004",
391 "date_interval_group": "2019-02-28T11:06:00.000Z"
392 }
393 ],
394 "type": "all",
395 "step": 30
396 },
397 "type": "message",
398 "event": "v1/hashrate-workers-statistics"
399 }
400 });
401```
402
403```
404 socket.on('subscribe', function(data) {
405 // data: {"id": 1, "event":"v1/hashrate-workers-statistics", "response":{}}]
406 });
407```
408
409```
410 socket.emit('subscribe', 'v1/hashrate-workers-statistics', {id: 1, payload: {
411 workers_ids: [
412 39509
413 ]
414 }});
415```
416
417> After subscribe will emit ``v1/hashrate-workers-statistics``
418
419#### Event ```v1/profit-workers-statistics```
420
421Subscribe:
422
423```
424 socket.on('v1/profit-workers-statistics', function(data) {
425 // data:
426 {
427 "id": 8,
428 "errors": null,
429 "response": {
430 "from": "2019-02-28T10:36:00.000Z",
431 "to": "2019-02-28T11:06:00.000Z",
432 "setup_sizes": [
433 {
434 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
435 "setup_size": 1
436 }
437 ],
438 "stats": [
439 {
440 "algorithm": "equihash-btg",
441 "user_id": 3,
442 "coin_id": 1021,
443 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
444 "worker_id": 39509,
445 "hashrate": "10.9226666666666660",
446 "sum_difficulty": "0.04",
447 "date_interval_group": "2019-02-28T10:52:30.000Z"
448 },
449 {
450 "algorithm": "equihash-btg",
451 "user_id": 3,
452 "coin_id": 1021,
453 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
454 "worker_id": 39509,
455 "hashrate": "4.0960000000000000",
456 "sum_difficulty": "0.015",
457 "date_interval_group": "2019-02-28T10:53:00.000Z"
458 },
459 {
460 "algorithm": "equihash-btg",
461 "user_id": 3,
462 "coin_id": 1021,
463 "session_key": "287be3ad5d7a0d7876f8e6c42b9aa3a9bef3263d",
464 "worker_id": 39509,
465 "hashrate": "1.09226666666666670000",
466 "sum_difficulty": "0.004",
467 "date_interval_group": "2019-02-28T11:06:00.000Z"
468 }
469 ],
470 "type": "all",
471 "step": 30
472 },
473 "type": "message",
474 "event": "v1/hashrate-workers-statistics"
475 }
476 });
477```
478
479```
480 socket.on('subscribe', function(data) {
481 // data: {"id": 1, "event":"v1/profit-workers-statistics", "response":{}}]
482 });
483```
484
485```
486 socket.emit('subscribe', 'v1/profit-workers-statistics', {id: 1, payload: {
487 workers_ids: [
488 39509
489 ]
490 }});
491```
492
493#### Event ```v1/desktop-worker-devices```
494
495```
496 socket.emit('subscribe', 'v1/desktop-worker-devices', {
497 "worker_name": "OFFICE",
498 "devices": {
499 "CARHMAIOFCNEFCI": {
500 "device_name": "GeForce GTX 1070 Ti"
501 },
502 "RIVbrEUgybCEUcbUECe": {
503 "device_name": "GeForce GTX 1080"
504 },
505 "rstvrvtseyv-yvse-yvy-vsy": {
506 "device_name": "GeForce GTX 1080 Ti"
507 },
508 "OEVmirevtnzzvionvzogAYING": {
509 "device_name": "Titan Xp"
510 }
511 }
512 });
513```
514
515#### Event ```v1/stop-mining```
516
517Subscribe:
518
519```
520 socket.on('v1/stop-mining', function(data) {
521 {
522 "response": null,
523 "event": "v1/stop-mining",
524 "id": 8
525 }
526 });
527```
528
529```
530 socket.on('subscribe', function(data) {
531 // data: {"id": 1, "event":"v1/stop-mining", "response":{}}]
532 });
533```
534
535```
536 socket.emit('v1/stop-mining', {
537 app_ids: ['2a0941ae-534a-4489-ad22-ff60432e11bd', '3acd954e-caeb-4c5e-a700-bed1076f8be1', 'ec1b4bfe-91a7-48e0-9803-0f609657492f'],
538 id: 1
539 });
540```
541
542#### Event ```v1/desktop-worker-settings```
543//TODO hz
544Subscribe:
545
546```
547 socket.on('v1/desktop-worker-settings', function(data) {
548 // data:
549 Formatted JSON Data
550 {
551 "response": {
552 "need_start_mining": true,
553 "devices": [
554 {
555 "device_id": "BFEBFBFF000306C3",
556 "algorithms": [
557 {
558 "algorithm_name": "X11",
559 "miner_name": "CpuMinerMulti",
560 "enabled": false
561 },
562 {
563 "algorithm_name": "Lyra2v2",
564 "miner_name": "CpuMinerMulti",
565 "enabled": false
566 },
567 {
568 "algorithm_name": "Scrypt",
569 "miner_name": "CpuMinerMulti",
570 "enabled": false
571 }
572 ]
573 },
574 {
575 "device_id": "GPU-c1797818-6488-ac4b-1fc2-802aaff439fb",
576 "algorithms": [
577 {
578 "algorithm_name": "X11",
579 "miner_name": "ccminer",
580 "enabled": false
581 },
582 {
583 "algorithm_name": "Lyra2v2",
584 "miner_name": "ccminer",
585 "enabled": false
586 },
587 {
588 "algorithm_name": "Scrypt",
589 "miner_name": "ccminer",
590 "enabled": true
591 },
592 {
593 "algorithm_name": "Equihash",
594 "miner_name": "ccminer",
595 "enabled": false
596 },
597 {
598 "algorithm_name": "Equihash",
599 "miner_name": "ZMMiner",
600 "enabled": false
601 }
602 ]
603 }
604 ]
605 },
606 "event":" v1/desktop-worker-settings",
607 "id":8
608 }
609 });
610```
611
612#### Event ```v1/desktop-worker-settings-ui```
613//TODO hz
614Subscribe:
615
616```
617 socket.on('v1/desktop-worker-settings-ui', function(data) {
618 // data:
619 Formatted JSON Data
620 {
621 "response": {
622 "app_id": "538ce37f-166e-4984-a8f8-7c45f6b8e726",
623 "devices": [
624 {
625 "device_id": "BFEBFBFF000306C3",
626 "algorithms": [
627 {
628 "algorithm_name": "X11",
629 "miner_name": "CpuMinerMulti",
630 "enabled": false
631 },
632 {
633 "algorithm_name": "Lyra2v2",
634 "miner_name": "CpuMinerMulti",
635 "enabled": false
636 },
637 {
638 "algorithm_name": "Scrypt",
639 "miner_name": "CpuMinerMulti",
640 "enabled": false
641 }
642 ]
643 },
644 {
645 "device_id": "GPU-c1797818-6488-ac4b-1fc2-802aaff439fb",
646 "algorithms": [
647 {
648 "algorithm_name": "X11",
649 "miner_name": "ccminer",
650 "enabled": false
651 },
652 {
653 "algorithm_name": "Lyra2v2",
654 "miner_name": "ccminer",
655 "enabled": false
656 },
657 {
658 "algorithm_name": "Scrypt",
659 "miner_name": "ccminer",
660 "enabled": true
661 },
662 {
663 "algorithm_name": "Equihash",
664 "miner_name": "ccminer",
665 "enabled": false
666 },
667 {
668 "algorithm_name": "Equihash",
669 "miner_name": "ZMMiner",
670 "enabled": false
671 }
672 ]
673 }
674 ]
675 },
676 "event":" v1/desktop-worker-settings-ui",
677 "id":8
678 }
679 });
680```
681
682```
683 socket.on('subscribe', function(data) {
684 // data: {"id": 1, "event":" v1/desktop-worker-settings-ui", "response":{
685 "app_id": "538ce37f-166e-4984-a8f8-7c45f6b8e726",
686 "devices": [
687 {
688 "device_id": "BFEBFBFF000306C3",
689 "algorithms": [
690 {
691 "algorithm_name": "X11",
692 "miner_name": "CpuMinerMulti",
693 "enabled": false
694 },
695 {
696 "algorithm_name": "Lyra2v2",
697 "miner_name": "CpuMinerMulti",
698 "enabled": false
699 },
700 {
701 "algorithm_name": "Scrypt",
702 "miner_name": "CpuMinerMulti",
703 "enabled": false
704 }
705 ]
706 },
707 {
708 "device_id": "GPU-c1797818-6488-ac4b-1fc2-802aaff439fb",
709 "algorithms": [
710 {
711 "algorithm_name": "X11",
712 "miner_name": "ccminer",
713 "enabled": false
714 },
715 {
716 "algorithm_name": "Lyra2v2",
717 "miner_name": "ccminer",
718 "enabled": false
719 },
720 {
721 "algorithm_name": "Scrypt",
722 "miner_name": "ccminer",
723 "enabled": true
724 },
725 {
726 "algorithm_name": "Equihash",
727 "miner_name": "ccminer",
728 "enabled": false
729 },
730 {
731 "algorithm_name": "Equihash",
732 "miner_name": "ZMMiner",
733 "enabled": false
734 }
735 ]
736 }
737 ]
738 }
739 }]
740 });
741```
742
743```
744 socket.emit('v1/desktop-worker-settings-ui', {
745 "app_id": "538ce37f-166e-4984-a8f8-7c45f6b8e726",
746 "need_start_mining": true,
747 "devices": [
748 {
749 "device_id": "BFEBFBFF000306C3",
750 "algorithms": [
751 {
752 "algorithm_name": "X11",
753 "miner_name": "CpuMinerMulti",
754 "enabled": false
755 },
756 {
757 "algorithm_name": "Lyra2v2",
758 "miner_name": "CpuMinerMulti",
759 "enabled": false
760 },
761 {
762 "algorithm_name": "Scrypt",
763 "miner_name": "CpuMinerMulti",
764 "enabled": false
765 }
766 ]
767 },
768 {
769 "device_id": "GPU-c1797818-6488-ac4b-1fc2-802aaff439fb",
770 "algorithms": [
771 {
772 "algorithm_name": "X11",
773 "miner_name": "ccminer",
774 "enabled": false
775 },
776 {
777 "algorithm_name": "Lyra2v2",
778 "miner_name": "ccminer",
779 "enabled": false
780 },
781 {
782 "algorithm_name": "Scrypt",
783 "miner_name": "ccminer",
784 "enabled": true
785 },
786 {
787 "algorithm_name": "Equihash",
788 "miner_name": "ccminer",
789 "enabled": false
790 },
791 {
792 "algorithm_name": "Equihash",
793 "miner_name": "ZMMiner",
794 "enabled": false
795 }
796 ]
797 }
798 ]
799 });
800```
801
802
803#### Event ```v1/desktop-worker-devices-temperatures```
804
805Subscribe:
806
807```
808 socket.on('v1/desktop-worker-devices-temperatures', function(data) {
809 // data:
810 Formatted JSON Data
811 {
812 "id": 7,
813 "errors": null,
814 "response": [
815 {
816 "devices_temperatures": [
817 {
818 "device_id": "GPU-ef79d329-2a0c-733f-608c-2f80f9ca2b26",
819 "temperature": 51
820 }
821 ],
822 "app_id": "0833ed1e-d80e-4291-80f6-82c0318818a9"
823 }
824 ],
825 "type": "message",
826 "event": "v1/desktop-worker-devices-temperatures"
827 }
828 });
829```
830
831```
832 socket.on('subscribe', function(data) {
833 // data: {"id": 1, "event":"v1/desktop-worker-devices-temperatures", "response": {}
834 });
835```
836
837```
838 socket.emit('v1/desktop-worker-devices-temperatures', {
839 "type": "subscribe",
840 "event": "v1/desktop-worker-devices-temperatures",
841 "id": 7,
842 "payload": {
843 "app_ids": [
844 "0833ed1e-d80e-4291-80f6-82c0318818a9"
845 ]
846 }
847 });
848```
849
850#### Event ```v1/withdrawal-history```
851
852Subscribe:
853
854```
855 socket.on('v1/withdrawal-history', function(data) {
856 // data:
857 Formatted JSON Data
858 {
859 "response": [
860 {
861 "address": "mkyL4f3HC6XHoWPHYvdc6nCBSrL99qVJW8",
862 "status": "unconfirmed",
863 "amount": "100000",
864 "txid": "8c331a11e03542a8a26f205efb2fd5a91457a649ca76dd8f5c219753fa49cd20",
865 "withdrawal_received": "2018-07-29T04:35:44.502Z"
866 }
867 ],
868 "event": "v1/withdrawal-history",
869 "id": 3
870 }
871 });
872```
873
874#### Event ```v1/user-info```
875
876Subscribe:
877
878```
879 socket.on('v1/user-info', function(data) {
880 // data:
881 Formatted JSON Data
882 {
883 "id": 5,
884 "errors": null,
885 "response": {
886 "user": {
887 "id": 3,
888 "email": "www@mail.com",
889 "email_normalize": "www@mail.com",
890 "is_email_confirmed": false,
891 "mining_password_token": "7fd1ed4ae0b3381c13be4c0e5457e8f7256d16b93a5e0f0d2761823c16e7b61ae4b1252517128f554dabfdb8c0e4fd19428926342a7624c8e9890aa92cfe45bd",
892 "status": "active",
893 "tfa_enabled": false,
894 "change_password_date": "2019-02-27T13:22:24.414Z",
895 "is_auto_conversion": false,
896 "api_key": "3sad23kg423g4jhv34jhtvjh34",
897 "last_mining_date": "2019-02-22T10:57:17.081Z",
898 "reward_bonus_activation_date": "2019-01-10T12:18:56.594Z",
899 "created_at": "2018-09-27T15:06:53.455Z",
900 "updated_at": "2019-02-27T13:38:52.223Z"
901 },
902 "access_token": null,
903 "refresh_token": null,
904 "tfa_user_hash": null
905 },
906 "type": "message",
907 "event": "v1/user-info"
908 }
909 });
910```
911
912```
913 socket.emit('subscribe', 'v1/user-info', {id: 1});
914```
915
916
917#### Event ```v1/miner-settings```
918
919Subscribe:
920
921```
922 socket.on('v1/miner-settings', function(data) {
923 // data:
924 Formatted JSON Data
925 {
926 "response": {
927 "type": "algorithms || coins",
928 "devices": [
929 {
930 "device_id": "GPU-c1797818-6488-ac4b-1fc2-802aaff439fb",
931 "enabled": true,
932 "algorithms": [
933 {
934 "algorithm_name": "x11",
935 "enabled": true
936 },
937 {
938 "algorithm_name": "scrypt",
939 "enabled": false
940 }
941 ],
942 "coins": [
943 {
944 "id": 1,
945 "enabled": true
946 },
947 {
948 "id": 10,
949 "enabled": false
950 }
951 ]
952 }
953 ]
954 },
955 "event": "v1/miner-settings",
956 "id": 2
957 }
958 });
959```
960
961```
962 socket.emit('subscribe', 'v1/miner-settings', {id: 1});
963```
964
965
966
967#### Event ```v1/miner-settings-web-ui```
968
969Subscribe:
970
971```
972 socket.on('v1/miner-settings-web-ui', function(data) {
973 // data:
974 Formatted JSON Data
975 {
976 "response": {
977 "type": "all", // all || update,
978 "workers_settings": [
979 {
980 "worker_id": 14,
981 "settings": {
982 "type":"algorithms",
983 "devices":[
984 {
985 "device_id":"device_id_1",
986 "enabled":false,
987 "algorithms":[
988 {
989 "algorithm_name":"x11",
990 "enabled":true
991 },
992 {
993 "algorithm_name":"scrypt",
994 "enabled":false
995 },
996 {
997 "algorithm_name":"lyra2rev2",
998 "enabled":true
999 }
1000 ],
1001 "coins":[
1002 {
1003 "id":1005,
1004 "enabled":true
1005 },
1006 {
1007 "id":1002,
1008 "enabled":true
1009 },
1010 {
1011 "id":1004,
1012 "enabled":true
1013 },
1014 {
1015 "id":1012,
1016 "enabled":true
1017 }
1018 ]
1019 }
1020 ]
1021 }
1022 }
1023 ]
1024 },
1025 "event": "v1/miner-settings",
1026 "id": 2
1027 }
1028 });
1029```
1030
1031Emit
1032```
1033 socket.emit('v1/miner-settings-web-ui', {
1034 id: 1
1035 payload: {
1036 "workers_settings":[
1037 {
1038 "worker_id": 14,
1039 "settings": {
1040 "type":"algorithms",
1041 "devices": [
1042 {
1043 "device_id":"device_id_1",
1044 "enabled":false,
1045 "algorithms":[
1046 {
1047 "algorithm_name":"x11",
1048 "enabled":true
1049 },
1050 {
1051 "algorithm_name":"scrypt",
1052 "enabled":false
1053 },
1054 {
1055 "algorithm_name":"lyra2rev2",
1056 "enabled":true
1057 }
1058 ],
1059 "coins":[
1060 {
1061 "id":1005,
1062 "enabled":true
1063 },
1064 {
1065 "id":1002,
1066 "enabled":true
1067 },
1068 {
1069 "id":1004,
1070 "enabled":true
1071 },
1072 {
1073 "id":1012,
1074 "enabled":true
1075 }
1076 ]
1077 }
1078 ]
1079 }
1080 }
1081 ]
1082
1083 }
1084 });
1085```
1086
1087#### Event ```v1/exchange-rates```
1088
1089Subscribe:
1090
1091```
1092 socket.on('v1/exchange-rates', function(data) {
1093 // data:
1094 {
1095 "response": {
1096 "1": {
1097 "btc": "1.0",
1098 "usd": "7369.49953357"
1099 },
1100 "2": {
1101 "btc": "0.00922737",
1102 "usd": "67.8950073135"
1103 },
1104 "3": {
1105 "btc": "0.00000376",
1106 "usd": "0.0276681854"
1107 },
1108 "4": {
1109 "btc": "0.00000071",
1110 "usd": "0.0052226003"
1111 },
1112 "5": {
1113 "btc": "0.02980911",
1114 "usd": "219.33561178"
1115 },
1116 "11": {
1117 "btc": "0.02140884",
1118 "usd": "157.526400631"
1119 },
1120 "12": {
1121 "btc": "0.00018453",
1122 "usd": "1.3577472175"
1123 },
1124 "13": {
1125 "btc": "0.00011117",
1126 "usd": "0.818012666"
1127 },
1128 "14": {
1129 "btc": "0.00000247",
1130 "usd": "0.0181649815"
1131 },
1132 "15": {
1133 "btc": "0.00270303",
1134 "usd": "19.888934949"
1135 },
1136 "1002": {
1137 "btc": "0.00922737",
1138 "usd": "67.8950073135"
1139 },
1140 "1004": {
1141 "btc": "0.00000071",
1142 "usd": "0.0052226003"
1143 },
1144 "1005": {
1145 "btc": "0.02980911",
1146 "usd": "219.33561178"
1147 },
1148 "1011": {
1149 "btc": "0.02140884",
1150 "usd": "157.526400631"
1151 },
1152 "1012": {
1153 "btc": "0.00018453",
1154 "usd": "1.3577472175"
1155 },
1156 "1013": {
1157 "btc": "0.00011117",
1158 "usd": "0.818012666"
1159 },
1160 "1015": {
1161 "btc": "0.00270303",
1162 "usd": "19.888934949"
1163 }
1164 },
1165 "event": "v1/exchange-rates",
1166 "id": 2
1167 }
1168 });
1169```
1170
1171```
1172 socket.on('subscribe', function(data) {
1173 // data: {"id": 1, "event":"v1/exchange-rates", "response":{}}]
1174 });
1175```
1176
1177```
1178 socket.emit('subscribe', 'v1/exchange-rates', {id: 1});
1179```
1180
1181> After subscribe will emit ``v1/exchange-rates``
1182
1183Unsubscribe:
1184
1185```
1186 socket.on('unsubscribe', function(data) {
1187 // data: {"id": 2, "event":"v1/exchange-rates", "response":{}}]
1188 });
1189```
1190
1191```
1192 socket.emit('unsubscribe', 'v1/exchange-rates', {id: 2});
1193```
1194
1195
1196### Error Response
1197
1198Returns JSON data about errors.
1199
1200```
1201{
1202 "code": 422,
1203 "errors": [
1204 {
1205 "message": "Account with that email address already exists.",
1206 "param": "email"
1207 },
1208 ...
1209 ]
1210}
1211```
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248# NOMP 
1249#### Node Open Mining Portal
1250
1251This portal is an extremely efficient, highly scalable, all-in-one, easy to setup cryptocurrency mining pool written
1252entirely in Node.js. It contains a stratum poolserver; reward/payment/share processor; and a (*not yet completed*)
1253responsive user-friendly front-end website featuring mining instructions, in-depth live statistics, and an admin center.
1254
1255#### Production Usage Notice
1256This is beta software. All of the following are things that can change and break an existing NOMP setup: functionality of any feature, structure of configuration files and structure of redis data. If you use this software in production then *DO NOT* pull new code straight into production usage because it can and often will break your setup and require you to tweak things like config files or redis data.
1257
1258#### Paid Solution
1259Usage of this software requires abilities with sysadmin, database admin, coin daemons, and sometimes a bit of programming. Running a production pool can literally be more work than a full-time job.
1260
1261
1262**Coin switching & auto-exchanging for payouts in BTC/LTC** to miners is a feature that very likely will not be included in this project.
1263
1264
1265#### Table of Contents
1266* [Features](#features)
1267 * [Attack Mitigation](#attack-mitigation)
1268 * [Security](#security)
1269 * [Planned Features](#planned-features)
1270* [Community Support](#community--support)
1271* [Usage](#usage)
1272 * [Requirements](#requirements)
1273 * [Setting Up Coin Daemon](#0-setting-up-coin-daemon)
1274 * [Downloading & Installing](#1-downloading--installing)
1275 * [Configuration](#2-configuration)
1276 * [Portal Config](#portal-config)
1277 * [Coin Config](#coin-config)
1278 * [Pool Config](#pool-config)
1279 * [Setting Up Blocknotify](#optional-recommended-setting-up-blocknotify)
1280 * [Starting the Portal](#3-start-the-portal)
1281 * [Upgrading NOMP](#upgrading-nomp)
1282* [Donations](#donations)
1283* [Credits](#credits)
1284* [License](#license)
1285
1286
1287
1288
1289### Features
1290
1291* For the pool server it uses the highly efficient [node-stratum-pool](//github.com/zone117x/node-stratum-pool) module which
1292supports vardiff, POW & POS, transaction messages, anti-DDoS, IP banning, [several hashing algorithms](//github.com/zone117x/node-stratum-pool#hashing-algorithms-supported).
1293
1294* The portal has an [MPOS](//github.com/MPOS/php-mpos) compatibility mode so that the it can
1295function as a drop-in-replacement for [python-stratum-mining](//github.com/Crypto-Expert/stratum-mining). This
1296mode can be enabled in the configuration and will insert shares into a MySQL database in the format which MPOS expects.
1297For a direct tutorial see the wiki page [Setting up NOMP for MPOS usage](//github.com/zone117x/node-open-mining-portal/wiki/Setting-up-NOMP-for-MPOS-usage).
1298
1299* Multi-pool ability - this software was built from the ground up to run with multiple coins simultaneously (which can
1300have different properties and hashing algorithms). It can be used to create a pool for a single coin or for multiple
1301coins at once. The pools use clustering to load balance across multiple CPU cores.
1302
1303* For reward/payment processing, shares are inserted into Redis (a fast NoSQL key/value store). The PROP (proportional)
1304reward system is used with [Redis Transactions](http://redis.io/topics/transactions) for secure and super speedy payouts.
1305There is zero risk to the pool operator. Shares from rounds resulting in orphaned blocks will be merged into share in the
1306current round so that each and every share will be rewarded
1307
1308* This portal does not have user accounts/logins/registrations. Instead, miners simply use their coin address for stratum
1309authentication. A minimalistic HTML5 front-end connects to the portals statistics API to display stats from from each
1310pool such as connected miners, network/pool difficulty/hash rate, etc.
1311
1312* Coin-switching ports using coin-networks and crypto-exchange APIs to detect profitability. Miner's connect to these ports
1313with their public key which NOMP uses to derive an address for any coin needed to be paid out.
1314
1315
1316#### Attack Mitigation
1317* Detects and thwarts socket flooding (garbage data sent over socket in order to consume system resources).
1318* Detects and thwarts zombie miners (botnet infected computers connecting to your server to use up sockets but not sending any shares).
1319* Detects and thwarts invalid share attacks:
1320 * NOMP is not vulnerable to the low difficulty share exploits happening to other pool servers. Other pool server
1321 software has hardcoded guesstimated max difficulties for new hashing algorithms while NOMP dynamically generates the
1322 max difficulty for each algorithm based on values founds in coin source code.
1323 * IP banning feature which on a configurable threshold will ban an IP for a configurable amount of time if the miner
1324 submits over a configurable threshold of invalid shares.
1325* NOMP is written in Node.js which uses a single thread (async) to handle connections rather than the overhead of one
1326thread per connection, and clustering is also implemented so all CPU cores are taken advantage of.
1327
1328
1329#### Security
1330NOMP has some implicit security advantages for pool operators and miners:
1331* Without a registration/login system, non-security-oriented miners reusing passwords across pools is no longer a concern.
1332* Automated payouts by default and pool profits are sent to another address so pool wallets aren't plump with coins -
1333giving hackers little reward and keeping your pool from being a target.
1334* Miners can notice lack of automated payments as a possible early warning sign that an operator is about to run off with their coins.
1335
1336
1337#### Planned Features
1338
1339* NOMP API - Used by the website to display stats and information about the pool(s) on the portal's front-end website,
1340and by the NOMP Desktop app to retrieve a list of available coins (and version-bytes for local wallet/address generation).
1341
1342* To reduce variance for pools just starting out which have little to no hashing power a feature is planned which will
1343allow your own pool to connect upstream to a larger pool server. It will request work from the larger pool then
1344redistribute the work to our own connected miners.
1345
1346
1347### Community / Support
1348IRC
1349* Support / general discussion join #nomp: https://webchat.freenode.net/?channels=#nomp
1350* Development discussion join #nomp-dev: https://webchat.freenode.net/?channels=#nomp-dev
1351
1352Join our subreddit [/r/nomp](http://reddit.com/r/nomp)!
1353
1354*Having problems getting the portal running due to some module dependency error?* It's probably because you
1355didn't follow the instructions in this README. Please __read the usage instructions__ including [requirements](#requirements) and [downloading/installing](#1-downloading--installing). If you've followed the instructions completely and are still having problems then open an issue here on github or join our #nomp IRC channel and explain your problem :).
1356
1357If your pool uses NOMP let us know and we will list your website here.
1358
1359##### Some pools using NOMP or node-stratum-module:
1360* http://clevermining.com
1361* http://suchpool.pw
1362* http://hashfaster.com
1363* http://miningpoolhub.com
1364* http://kryptochaos.com
1365* http://miningpools.tk
1366* http://umine.co.uk
1367
1368Usage
1369=====
1370
1371
1372#### Requirements
1373* Coin daemon(s) (find the coin's repo and build latest version from source)
1374* [Node.js](http://nodejs.org/) v0.10+ ([follow these installation instructions](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager))
1375* [Redis](http://redis.io/) key-value store v2.6+ ([follow these instructions](http://redis.io/topics/quickstart))
1376
1377##### Seriously
1378Those are legitimate requirements. If you use old versions of Node.js or Redis that may come with your system package manager then you will have problems. Follow the linked instructions to get the last stable versions.
1379
1380
1381[**Redis security warning**](http://redis.io/topics/security): be sure firewall access to redis - an easy way is to
1382include `bind 127.0.0.1` in your `redis.conf` file. Also it's a good idea to learn about and understand software that
1383you are using - a good place to start with redis is [data persistence](http://redis.io/topics/persistence).
1384
1385
1386#### 0) Setting up coin daemon
1387Follow the build/install instructions for your coin daemon. Your coin.conf file should end up looking something like this:
1388```
1389daemon=1
1390rpcuser=litecoinrpc
1391rpcpassword=securepassword
1392rpcport=19332
1393```
1394For redundancy, its recommended to have at least two daemon instances running in case one drops out-of-sync or offline,
1395all instances will be polled for block/transaction updates and be used for submitting blocks. Creating a backup daemon
1396involves spawning a daemon using the `-datadir=/backup` command-line argument which creates a new daemon instance with
1397it's own config directory and coin.conf file. Learn about the daemon, how to use it and how it works if you want to be
1398a good pool operator. For starters be sure to read:
1399 * https://en.bitcoin.it/wiki/Running_bitcoind
1400 * https://en.bitcoin.it/wiki/Data_directory
1401 * https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list
1402 * https://en.bitcoin.it/wiki/Difficulty
1403
1404#### 1) Downloading & Installing
1405
1406Clone the repository and run `npm update` for all the dependencies to be installed:
1407
1408```bash
1409git clone https://github.com/zone117x/node-open-mining-portal.git nomp
1410cd nomp
1411npm update
1412```
1413
1414#### 2) Configuration
1415
1416##### Portal config
1417Inside the `config_example.json` file, ensure the default configuration will work for your environment, then copy the file to `config.json`.
1418
1419Explanation for each field:
1420````javascript
1421{
1422 /* Specifies the level of log output verbosity. Anything more severe than the level specified
1423 will also be logged. */
1424 "logLevel": "debug", //or "warning", "error"
1425
1426 /* By default NOMP logs to console and gives pretty colors. If you direct that output to a
1427 log file then disable this feature to avoid nasty characters in your log file. */
1428 "logColors": true,
1429
1430
1431 /* The NOMP CLI (command-line interface) will listen for commands on this port. For example,
1432 blocknotify messages are sent to NOMP through this. */
1433 "cliPort": 17117,
1434
1435 /* By default 'forks' is set to "auto" which will spawn one process/fork/worker for each CPU
1436 core in your system. Each of these workers will run a separate instance of your pool(s),
1437 and the kernel will load balance miners using these forks. Optionally, the 'forks' field
1438 can be a number for how many forks will be spawned. */
1439 "clustering": {
1440 "enabled": true,
1441 "forks": "auto"
1442 },
1443
1444 /* Pool config file will inherit these default values if they are not set. */
1445 "defaultPoolConfigs": {
1446
1447 /* Poll RPC daemons for new blocks every this many milliseconds. */
1448 "blockRefreshInterval": 1000,
1449
1450 /* If no new blocks are available for this many seconds update and rebroadcast job. */
1451 "jobRebroadcastTimeout": 55,
1452
1453 /* Disconnect workers that haven't submitted shares for this many seconds. */
1454 "connectionTimeout": 600,
1455
1456 /* (For MPOS mode) Store the block hashes for shares that aren't block candidates. */
1457 "emitInvalidBlockHashes": false,
1458
1459 /* This option will only authenticate miners using an address or mining key. */
1460 "validateWorkerUsername": true,
1461
1462 /* Enable for client IP addresses to be detected when using a load balancer with TCP
1463 proxy protocol enabled, such as HAProxy with 'send-proxy' param:
1464 http://haproxy.1wt.eu/download/1.5/doc/configuration.txt */
1465 "tcpProxyProtocol": false,
1466
1467 /* If under low-diff share attack we can ban their IP to reduce system/network load. If
1468 running behind HAProxy be sure to enable 'tcpProxyProtocol', otherwise you'll end up
1469 banning your own IP address (and therefore all workers). */
1470 "banning": {
1471 "enabled": true,
1472 "time": 600, //How many seconds to ban worker for
1473 "invalidPercent": 50, //What percent of invalid shares triggers ban
1474 "checkThreshold": 500, //Perform check when this many shares have been submitted
1475 "purgeInterval": 300 //Every this many seconds clear out the list of old bans
1476 },
1477
1478 /* Used for storing share and block submission data and payment processing. */
1479 "redis": {
1480 "host": "127.0.0.1",
1481 "port": 6379
1482 }
1483 },
1484
1485 /* This is the front-end. Its not finished. When it is finished, this comment will say so. */
1486 "website": {
1487 "enabled": true,
1488 /* If you are using a reverse-proxy like nginx to display the website then set this to
1489 127.0.0.1 to not expose the port. */
1490 "host": "0.0.0.0",
1491 "port": 80,
1492 /* Used for displaying stratum connection data on the Getting Started page. */
1493 "stratumHost": "cryppit.com",
1494 "stats": {
1495 /* Gather stats to broadcast to page viewers and store in redis for historical stats
1496 every this many seconds. */
1497 "updateInterval": 15,
1498 /* How many seconds to hold onto historical stats. Currently set to 24 hours. */
1499 "historicalRetention": 43200,
1500 /* How many seconds worth of shares should be gathered to generate hashrate. */
1501 "hashrateWindow": 300
1502 },
1503 /* Not done yet. */
1504 "adminCenter": {
1505 "enabled": true,
1506 "password": "password"
1507 }
1508 },
1509
1510 /* Redis instance of where to store global portal data such as historical stats, proxy states,
1511 ect.. */
1512 "redis": {
1513 "host": "127.0.0.1",
1514 "port": 6379
1515 },
1516
1517
1518 /* With this switching configuration, you can setup ports that accept miners for work based on
1519 a specific algorithm instead of a specific coin. Miners that connect to these ports are
1520 automatically switched a coin determined by the server. The default coin is the first
1521 configured pool for each algorithm and coin switching can be triggered using the
1522 cli.js script in the scripts folder.
1523
1524 Miners connecting to these switching ports must use their public key in the format of
1525 RIPEMD160(SHA256(public-key)). An address for each type of coin is derived from the miner's
1526 public key, and payments are sent to that address. */
1527 "switching": {
1528 "switch1": {
1529 "enabled": false,
1530 "algorithm": "sha256",
1531 "ports": {
1532 "3333": {
1533 "diff": 10,
1534 "varDiff": {
1535 "minDiff": 16,
1536 "maxDiff": 512,
1537 "targetTime": 15,
1538 "retargetTime": 90,
1539 "variancePercent": 30
1540 }
1541 }
1542 }
1543 },
1544 "switch2": {
1545 "enabled": false,
1546 "algorithm": "scrypt",
1547 "ports": {
1548 "4444": {
1549 "diff": 10,
1550 "varDiff": {
1551 "minDiff": 16,
1552 "maxDiff": 512,
1553 "targetTime": 15,
1554 "retargetTime": 90,
1555 "variancePercent": 30
1556 }
1557 }
1558 }
1559 },
1560 "switch3": {
1561 "enabled": false,
1562 "algorithm": "x11",
1563 "ports": {
1564 "5555": {
1565 "diff": 0.001
1566 }
1567 }
1568 }
1569 },
1570
1571 "profitSwitch": {
1572 "enabled": false,
1573 "updateInterval": 600,
1574 "depth": 0.90,
1575 "usePoloniex": true,
1576 "useCryptsy": true,
1577 "useMintpal": true
1578 }
1579}
1580````
1581
1582
1583##### Coin config
1584Inside the `coins` directory, ensure a json file exists for your coin. If it does not you will have to create it.
1585Here is an example of the required fields:
1586````javascript
1587{
1588 "name": "Litecoin",
1589 "symbol": "ltc",
1590 "algorithm": "scrypt",
1591
1592 /* Magic value only required for setting up p2p block notifications. It is found in the daemon
1593 source code as the pchMessageStart variable.
1594 For example, litecoin mainnet magic: http://git.io/Bi8YFw
1595 And for litecoin testnet magic: http://git.io/NXBYJA */
1596 "peerMagic": "fbc0b6db", //optional
1597 "peerMagicTestnet": "fcc1b7dc" //optional
1598
1599 //"txMessages": false, //options - defaults to false
1600
1601 //"mposDiffMultiplier": 256, //options - only for x11 coins in mpos mode
1602}
1603````
1604
1605For additional documentation how to configure coins and their different algorithms
1606see [these instructions](//github.com/zone117x/node-stratum-pool#module-usage).
1607
1608
1609##### Pool config
1610Take a look at the example json file inside the `pool_configs` directory. Rename it to `yourcoin.json` and change the
1611example fields to fit your setup.
1612
1613Description of options:
1614
1615````javascript
1616{
1617 "enabled": true, //Set this to false and a pool will not be created from this config file
1618 "coin": "litecoin.json", //Reference to coin config file in 'coins' directory
1619
1620 "address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc", //Address to where block rewards are given
1621
1622 /* Block rewards go to the configured pool wallet address to later be paid out to miners,
1623 except for a percentage that can go to, for examples, pool operator(s) as pool fees or
1624 or to donations address. Addresses or hashed public keys can be used. Here is an example
1625 of rewards going to the main pool op, a pool co-owner, and NOMP donation. */
1626 "rewardRecipients": {
1627 "n37vuNFkXfk15uFnGoVyHZ6PYQxppD3QqK": 1.5, //1.5% goes to pool op
1628 "mirj3LtZxbSTharhtXvotqtJXUY7ki5qfx": 0.5, //0.5% goes to a pool co-owner
1629
1630 /* 0.1% donation to NOMP. This pubkey can accept any type of coin, please leave this in
1631 your config to help support NOMP development. */
1632 "22851477d63a085dbc2398c8430af1c09e7343f6": 0.1
1633 },
1634
1635 "paymentProcessing": {
1636 "enabled": true,
1637
1638 /* Every this many seconds get submitted blocks from redis, use daemon RPC to check
1639 their confirmation status, if confirmed then get shares from redis that contributed
1640 to block and send out payments. */
1641 "paymentInterval": 30,
1642
1643 /* Minimum number of coins that a miner must earn before sending payment. Typically,
1644 a higher minimum means less transactions fees (you profit more) but miners see
1645 payments less frequently (they dislike). Opposite for a lower minimum payment. */
1646 "minimumPayment": 0.01,
1647
1648 /* This daemon is used to send out payments. It MUST be for the daemon that owns the
1649 configured 'address' that receives the block rewards, otherwise the daemon will not
1650 be able to confirm blocks or send out payments. */
1651 "daemon": {
1652 "host": "127.0.0.1",
1653 "port": 19332,
1654 "user": "testuser",
1655 "password": "testpass"
1656 }
1657 },
1658
1659 /* Each pool can have as many ports for your miners to connect to as you wish. Each port can
1660 be configured to use its own pool difficulty and variable difficulty settings. varDiff is
1661 optional and will only be used for the ports you configure it for. */
1662 "ports": {
1663 "3032": { //A port for your miners to connect to
1664 "diff": 32, //the pool difficulty for this port
1665
1666 /* Variable difficulty is a feature that will automatically adjust difficulty for
1667 individual miners based on their hashrate in order to lower networking overhead */
1668 "varDiff": {
1669 "minDiff": 8, //Minimum difficulty
1670 "maxDiff": 512, //Network difficulty will be used if it is lower than this
1671 "targetTime": 15, //Try to get 1 share per this many seconds
1672 "retargetTime": 90, //Check to see if we should retarget every this many seconds
1673 "variancePercent": 30 //Allow time to very this % from target without retargeting
1674 }
1675 },
1676 "3256": { //Another port for your miners to connect to, this port does not use varDiff
1677 "diff": 256 //The pool difficulty
1678 }
1679 },
1680
1681 /* More than one daemon instances can be setup in case one drops out-of-sync or dies. */
1682 "daemons": [
1683 { //Main daemon instance
1684 "host": "127.0.0.1",
1685 "port": 19332,
1686 "user": "testuser",
1687 "password": "testpass"
1688 }
1689 ],
1690
1691 /* This allows the pool to connect to the daemon as a node peer to receive block updates.
1692 It may be the most efficient way to get block updates (faster than polling, less
1693 intensive than blocknotify script). It requires the additional field "peerMagic" in
1694 the coin config. */
1695 "p2p": {
1696 "enabled": false,
1697
1698 /* Host for daemon */
1699 "host": "127.0.0.1",
1700
1701 /* Port configured for daemon (this is the actual peer port not RPC port) */
1702 "port": 19333,
1703
1704 /* If your coin daemon is new enough (i.e. not a shitcoin) then it will support a p2p
1705 feature that prevents the daemon from spamming our peer node with unnecessary
1706 transaction data. Assume its supported but if you have problems try disabling it. */
1707 "disableTransactions": true
1708 },
1709
1710 /* Enabled this mode and shares will be inserted into in a MySQL database. You may also want
1711 to use the "emitInvalidBlockHashes" option below if you require it. The config options
1712 "redis" and "paymentProcessing" will be ignored/unused if this is enabled. */
1713 "mposMode": {
1714 "enabled": false,
1715 "host": "127.0.0.1", //MySQL db host
1716 "port": 3306, //MySQL db port
1717 "user": "me", //MySQL db user
1718 "password": "mypass", //MySQL db password
1719 "database": "ltc", //MySQL db database name
1720
1721 /* Checks for valid password in database when miners connect. */
1722 "checkPassword": true,
1723
1724 /* Unregistered workers can automatically be registered (added to database) on stratum
1725 worker authentication if this is true. */
1726 "autoCreateWorker": false
1727 }
1728}
1729
1730````
1731
1732You can create as many of these pool config files as you want (such as one pool per coin you which to operate).
1733If you are creating multiple pools, ensure that they have unique stratum ports.
1734
1735For more information on these configuration options see the [pool module documentation](https://github.com/zone117x/node-stratum-pool#module-usage)
1736
1737
1738
1739##### [Optional, recommended] Setting up blocknotify
17401. In `config.json` set the port and password for `blockNotifyListener`
17412. In your daemon conf file set the `blocknotify` command to use:
1742```
1743node [path to cli.js] [coin name in config] [block hash symbol]
1744```
1745Example: inside `dogecoin.conf` add the line
1746```
1747blocknotify=node /home/nomp/scripts/cli.js blocknotify dogecoin %s
1748```
1749
1750Alternatively, you can use a more efficient block notify script written in pure C. Build and usage instructions
1751are commented in [scripts/blocknotify.c](scripts/blocknotify.c).
1752
1753
1754#### 3) Start the portal
1755
1756```bash
1757node init.js
1758```
1759
1760###### Optional enhancements for your awesome new mining pool server setup:
1761* Use something like [forever](https://github.com/nodejitsu/forever) to keep the node script running
1762in case the master process crashes.
1763* Use something like [redis-commander](https://github.com/joeferner/redis-commander) to have a nice GUI
1764for exploring your redis database.
1765* Use something like [logrotator](http://www.thegeekstuff.com/2010/07/logrotate-examples/) to rotate log
1766output from NOMP.
1767* Use [New Relic](http://newrelic.com/) to monitor your NOMP instance and server performance.
1768
1769
1770#### Upgrading NOMP
1771When updating NOMP to the latest code its important to not only `git pull` the latest from this repo, but to also update
1772the `node-stratum-pool` and `node-multi-hashing` modules, and any config files that may have been changed.
1773* Inside your NOMP directory (where the init.js script is) do `git pull` to get the latest NOMP code.
1774* Remove the dependenices by deleting the `node_modules` directory with `rm -r node_modules`.
1775* Run `npm update` to force updating/reinstalling of the dependencies.
1776* Compare your `config.json` and `pool_configs/coin.json` configurations to the latest example ones in this repo or the ones in the setup instructions where each config field is explained. You may need to modify or add any new changes.
1777
1778Donations
1779---------
1780To support development of this project feel free to donate :)
1781
1782* BTC: `1KRotMnQpxu3sePQnsVLRy3EraRFYfJQFR`
1783* LTC: `LKfavSDJmwiFdcgaP1bbu46hhyiWw5oFhE`
1784* VTC: `VgW4uFTZcimMSvcnE4cwS3bjJ6P8bcTykN`
1785* MAX: `mWexUXRCX5PWBmfh34p11wzS5WX2VWvTRT`
1786* QRK: `QehPDAhzVQWPwDPQvmn7iT3PoFUGT7o8bC`
1787* DASH: `XcQmhp8ANR7okWAuArcNFZ2bHSB81jpapQ`
1788* DOGE: `DBGGVtwAAit1NPZpRm5Nz9VUFErcvVvHYW`
1789* Cryptsy Trade Key: `254ca13444be14937b36c44ba29160bd8f02ff76`
1790
1791Credits
1792-------
1793* [Jerry Brady / mintyfresh68](https://github.com/bluecircle) - got coin-switching fully working and developed proxy-per-algo feature
1794* [Tony Dobbs](http://anthonydobbs.com) - designs for front-end and created the NOMP logo
1795* [LucasJones](//github.com/LucasJones) - got p2p block notify working and implemented additional hashing algos
1796* [vekexasia](//github.com/vekexasia) - co-developer & great tester
1797* [TheSeven](//github.com/TheSeven) - answering an absurd amount of my questions and being a very helpful gentleman
1798* [UdjinM6](//github.com/UdjinM6) - helped implement fee withdrawal in payment processing
1799* [Alex Petrov / sysmanalex](https://github.com/sysmanalex) - contributed the pure C block notify script
1800* [svirusxxx](//github.com/svirusxxx) - sponsored development of MPOS mode
1801* [icecube45](//github.com/icecube45) - helping out with the repo wiki
1802* [Fcases](//github.com/Fcases) - ordered me a pizza <3
1803* Those that contributed to [node-stratum-pool](//github.com/zone117x/node-stratum-pool#credits)
1804
1805
1806License
1807-------
1808Released under the GNU General Public License v2
1809
1810http://www.gnu.org/licenses/gpl-2.0.html