-
Notifications
You must be signed in to change notification settings - Fork 10
/
MM.Ubuntu.ps1
1527 lines (1367 loc) · 70.2 KB
/
MM.Ubuntu.ps1
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
param(
[Parameter(Mandatory=$false)]
[String]$Wallet = "Yes", ##Miner Can Load Pools
[Parameter(Mandatory=$false)]
[String]$Wallet1 = '', ##Group 1 Wallet
[Parameter(Mandatory=$false)]
[String]$Wallet2 = '', ##Group 2 Wallet
[Parameter(Mandatory=$false)]
[String]$Wallet3 = '', ##Group 3 Wallet
[Parameter(Mandatory=$false)]
[String]$CPUWallet = '', ##CPU Wallet
[Parameter(Mandatory=$false)]
[String]$ZergpoolWallet1 = '', ##Group 1 Zergpool Wallet
[Parameter(Mandatory=$false)]
[String]$ZergpoolWallet2 = '', ##Group 2 Zergpool Wallet
[Parameter(Mandatory=$false)]
[String]$ZergpoolWallet3 = '', ##Group 3 Zergpool Wallet
[Parameter(Mandatory=$false)]
[String]$blockmastersWallet1 = '', ##Group 1 BlockMasters Wallet
[Parameter(Mandatory=$false)]
[String]$blockmastersWallet2 = '', ##Group 2 BlockMasters Wallet
[Parameter(Mandatory=$false)]
[String]$blockmastersWallet3 = '', ##Group 3 BlockMasters Wallet
[Parameter(Mandatory=$false)]
[String]$Nicehash_Wallet1 = '', ##Group 1 Nicehash Wallet
[Parameter(Mandatory=$false)]
[String]$Nicehash_Wallet2 = '', ##Group 2 Nicehash Wallet
[Parameter(Mandatory=$false)]
[String]$Nicehash_Wallet3 = '', ##Group 3 Nicehash Wallet
[Parameter(Mandatory=$false)]
[String]$UserName = "MaynardVII", ##MPH Username
[Parameter(Mandatory=$false)]
[String]$WorkerName = "Rig1", ##MPH Workername
[Parameter(Mandatory=$false)]
[String]$RigName1 = "MMHash", ##ID=Rigname (Yiimp Pool) Group 1
[Parameter(Mandatory=$false)]
[String]$RigName2 = "MMHash", ##ID=Rigname (Yiimp Pool) Group 2
[Parameter(Mandatory=$false)]
[String]$RigName3 = "MMHash", ##ID=Rigname (Yiimp Pool) Group 3
[Parameter(Mandatory=$false)]
[Int]$API_ID = 0, ##Future Implentation
[Parameter(Mandatory=$false)]
[String]$API_Key = "", ##Future Implementation
[Parameter(Mandatory=$false)]
[Int]$Timeout = 0, ##Hours Before Mine Clears All Hashrates/Profit 0 files
[Parameter(Mandatory=$false)]
[Int]$Interval = 180, #seconds before reading hash rate from miners
[Parameter(Mandatory=$false)]
[Int]$StatsInterval = 1, #seconds of current active to gather hashrate if not gathered yet
[Parameter(Mandatory=$false)]
[String]$Location = "US", #europe/us/asia
[Parameter(Mandatory=$false)]
[String]$MPHLocation = "US", #europe/us/asia
[Parameter(Mandatory=$false)]
[Array]$Type = ("NVIDIA1"), #AMD/NVIDIA/CPU
[Parameter(Mandatory=$false)]
[String]$CCDevices1, ##Group 1 ccminer gpus
[Parameter(Mandatory=$false)]
[String]$CCDevices2, ##Group 2 ccminer gpus
[Parameter(Mandatory=$false)]
[String]$CCDevices3, ##Group 3 ccminer gpus
[Parameter(Mandatory=$false)]
[String]$EWBFDevices1, ##Group 1 ewbf
[Parameter(Mandatory=$false)]
[String]$EWBFDevices2, ##Group 2 ewbf
[Parameter(Mandatory=$false)]
[String]$EWBFDevices3, ##Group 3 ewbf
[Parameter(Mandatory=$false)]
[String]$GPUDevices1, ##Group 1 all miners
[Parameter(Mandatory=$false)]
[String]$GPUDevices2, ##Group 2 all miners
[Parameter(Mandatory=$false)]
[String]$GPUDevices3, ##Group 3 all miners
[Parameter(Mandatory=$false)]
[String]$DSTMDevices1,
[Parameter(Mandatory=$false)]
[String]$DSTMDevices2,
[Parameter(Mandatory=$false)]
[String]$DSTMDevices3,
[Parameter(Mandatory=$false)]
[String]$ClayDevices1,
[Parameter(Mandatory=$false)]
[String]$ClayDevices2,
[Parameter(Mandatory=$false)]
[String]$ClayDevices3,
[Parameter(Mandatory=$false)]
[String]$RexDevices1,
[Parameter(Mandatory=$false)]
[String]$RexDevices2,
[Parameter(Mandatory=$false)]
[String]$RexDevices3,
[Parameter(Mandatory=$false)]
[String]$SGDevices1,
[Parameter(Mandatory=$false)]
[String]$SGDevices2,
[Parameter(Mandatory=$false)]
[String]$SGDevices3,
[Parameter(Mandatory=$false)]
[Array]$PoolName = ("zergpool_algo","zergpool_coin"),
[Parameter(Mandatory=$false)]
[Array]$Currency = ("USD"), #i.e. GBP,EUR,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[Array]$Passwordcurrency = ("BTC"), #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[Array]$Passwordcurrency1 = ("BTC"), #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[Array]$Passwordcurrency2 = ("BTC"), #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[Array]$Passwordcurrency3 = ("BTC"), #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[Array]$CPUcurrency = ("BTC"), #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[String]$Zergpoolpassword1 = ("BTC"), #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[String]$Zergpoolpassword2 = '', #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[String]$Zergpoolpassword3 = '', #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[String]$blockmasterspassword1 = ("BTC"), #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[String]$blockmasterspassword2 = '', #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[String]$blockmasterspassword3 = '', #i.e. BTC,LTC,ZEC,ETH ect.
[Parameter(Mandatory=$false)]
[Int]$Donate = .5, #Percent per Day
[Parameter(Mandatory=$false)]
[String]$Proxy = "", #i.e http://192.0.0.1:8080
[Parameter(Mandatory=$false)]
[Int]$Delay = 1, #seconds before opening each miner
[Parameter(Mandatory=$false)]
[String]$CoinExchange = "LTC",
[Parameter(Mandatory=$false)]
[array]$Coin= $null,
[Parameter(Mandatory=$false)]
[array]$GPU_Group1= $null,
[Parameter(Mandatory=$false)]
[array]$GPU_Group2= $null,
[Parameter(Mandatory=$false)]
[array]$GPU_Group3= $null,
[Parameter(Mandatory=$false)]
[string]$Auto_Coin = "Yes",
[Parameter(Mandatory=$false)]
[string]$Auto_Algo = "Yes",
[Parameter(Mandatory=$false)]
[Int]$Nicehash_Fee,
[Parameter(Mandatory=$false)]
[Int]$Benchmark = 120,
[Parameter(Mandatory=$false)]
[Int]$GPU_Count = 13,
[Parameter(Mandatory=$false)]
[array]$No_Algo = $null,
[Parameter(Mandatory=$false)]
[String]$Favor_Coins = "Yes",
[Parameter(Mandatory=$false)]
[double]$Threshold = .01,
[Parameter(Mandatory=$false)]
[string]$Platform = "linux",
[Parameter(Mandatory=$false)]
[int]$CPUThreads = $null,
[Parameter(Mandatory=$false)]
[string]$StatLevel = "Live",
[Parameter(Mandatory=$false)]
[string]$CPUOnly = "No",
)
#SetLocation & Load Script Files
Set-Location (Split-Path $script:MyInvocation.MyCommand.Path)
Get-ChildItem . -Recurse | Out-Null
. .\Build\Unix\IncludeCoin.ps1
. .\Build\Unix\Hive\HiveCmd.ps1
##Close Open Miner & Screens
$ActiveMinerPrograms = @()
$ProfitTable = @()
$OpenScreens = @()
$OpenScreens += "NVIDIA1"
$OpenScreens += "NVIDIA2"
$OpenScreens += "NVIDIA3"
$OpenScreens += "AMD1"
$OpenScreens += "AMD2"
$OpenScreens += "AMD3"
$OpenScreens += "CPU"
$OpenScreens += "ASIC"
$OpenScreens += "LogData"
$OpenScreens += "PIDInfo"
$OpenScreens | foreach {
Start-Process ".\Build\Unix\Hive\killall.sh" -ArgumentList "$($_)" -Wait
}
#Start the log
$Log = 1
if(-not (Test-Path "Logs")){
New-Item "Logs" -ItemType "directory" | Out-Null
Start-Sleep -S 1}
Start-Transcript ".\Logs\MM.Hash$($Log).log" -Force
$LogTimer = New-Object -TypeName System.Diagnostics.Stopwatch
$LogTimer.Start()
##Update
$PreviousVersions = @()
$PreviousVersions += "MM.Hash.1.3.1"
$PreviousVersions += "MM.Hash.1.3.2"
$PreviousVersions += "MM.Hash.1.3.3"
$PreviousVersions += "MM.Hash.1.3.4"
$PreviousVersions += "MM.Hash.1.3.5"
$PreviousVersions += "MM.Hash.1.3.6"
$PreviousVersions += "MM.Hash.1.3.7"
$PreviousVersions += "MM.Hash.1.3.8"
$PreviousVersions += "MM.Hash.1.3.8a"
$PreviousVersions += "MM.Hash.1.3.9"
$PreviousVersions += "MM.Hash.1.4.0b"
$PreviousVersions += "MM.Hash.1.0.4b"
$PreviousVersions += "MM.Hash.1.4.2b"
$PreviousVersions | foreach {
$PreviousPath = Join-Path "/hive/custom" "$_"
if(Test-Path $PreviousPath)
{
Write-Host "Previous Version is $($PreviousPath)"
Write-Host "Deleting Old Version"
Start-Sleep -S 5
$OldBackup = Join-Path $PreviousPath "Backup"
$OldMiners = Join-Path $PreviousPath "Miners"
$OldTime = Join-Path $PreviousPath "Build\Data"
if(Test-Path $OldBackup)
{
if(-not (Test-Path "Backup")){New-Item "Backup" -ItemType "directory" | Out-Null }
if(-not (Test-Path "Stats")){New-Item "Stats" -ItemType "directory" | Out-Null }
if(-not (Test-Path "Miners")){New-Item "Miners" -ItemType "directory" | Out-Null }
if(-not (Test-Path "Miners\unix")){New-Item "Miners\unix" -ItemType "directory" | Out-Null }
if(-not (Test-Path "Config")){New-Item "Config" -ItemType "directory" | Out-Null }
if($Type -notlike "*AMD*"){Get-ChildItem -Path "$($OldMiners)\*" -Include *.ps1 -Recurse | Copy-Item -Destination ".\Miners\unix" -force}
Get-ChildItem -Path "$($OldBackup)\*" -Include *.txt -Recurse | Copy-Item -Destination ".\Stats" -force
Get-ChildItem -Path "$($OldBackup)\*" -Include *.txt -Recurse | Copy-Item -Destination ".\Backup" -force
Get-ChildItem -Path "$($OldTime)\*" -Include *.txt -Recurse | Copy-Item -Destination ".\Build\Data" -force
}
Remove-Item $PreviousPath -recurse -force
}
}
##Set Objects
$CmdDir = (Join-Path (Split-Path $script:MyInvocation.MyCommand.Path) "Build")
$Dir = (Split-Path $script:MyInvocation.MyCommand.Path)
"$($CmdDir)" | Out-File ".\Build\dir.sh"
$BenchmarkMode = "No"
$Instance = 1
$InfoCheck1 = Get-Content ".\Build\Data\conversion.ifx" | Out-String
$VerifyCheck1 = Get-Content ".\Build\Data\verification.ifx" | Out-String
$InfoCheck2 = Get-Content ".\Build\Data\conversion2.ifx" | Out-String
$VerifyCheck2 = Get-Content ".\Build\Data\verification2.ifx" | Out-String
$InfoPass1 = $InfoCheck1
$InfoPass2 = $InfoCheck2
$VerifyPass1 = $VerifyCheck1
$VerifyPass2 = $VerifyCheck2
$DecayStart = Get-Date
$DecayPeriod = 60 #seconds
$DecayBase = 1-0.1 #decimal percentage
$WalletDonate = "1DRxiWx6yuZfN9hrEJa3BDXWVJ9yyJU36i"
$NicehashDonate = "3JfBiUZZV17DTjAFCnZb97UpBgtLPLLDop"
$UserDonate = "MaynardVII"
$WorkerDonate = "Rig1"
$WalletSwitch = $Wallet
$WalletSwitch1 = $Wallet1
$WalletSwitch2 = $Wallet2
$WalletSwitch3 = $Wallet3
$CPUWalletSwitch = $CPUWallet
$ZergpoolWallet1Switch = $ZergpoolWallet1
$ZergpoolWallet2Switch = $ZergpoolWallet2
$ZergpoolWallet3Switch = $ZergpoolWallet3
$PasswordSwitch = $Passwordcurrency
$PasswordSwitch1 = $Passwordcurrency1
$PasswordSwitch2 = $Passwordcurrency2
$PasswordSwitch3 = $Passwordcurrency3
$CPUcurrencySwitch = $CPUcurrency
$Zergpoolpassword1Switch = $Zergpoolpassword1
$Zergpoolpassword2Switch = $Zergpoolpassword2
$Zergpoolpassword3Switch = $Zergpoolpassword3
$Nicehash_Wallet1Switch = $Nicehash_Wallet1
$Nicehash_Wallet2Switch = $Nicehash_Wallet2
$Nicehash_Wallet3Switch = $Nicehash_Wallet3
$UserSwitch = $UserName
$WorkerSwitch = $WorkerName
$RigSwitch = $RigName
$IntervalSwitch = $Interval
$TimeoutTimer = New-Object -TypeName System.Diagnostics.Stopwatch
$TimeoutTimer.Start()
##Load Previous Times & PID Data
Get-DateFiles -CmdDir $CmdDir
##Remove Exclusion
try{if((Get-MpPreference).ExclusionPath -notcontains (Convert-Path .)){Start-Process powershell -Verb runAs -ArgumentList "Add-MpPreference -ExclusionPath '$(Convert-Path .)'"}}catch{}
##Proxy
if($Proxy -eq ""){$PSDefaultParameterValues.Remove("*:Proxy")}
else{$PSDefaultParameterValues["*:Proxy"] = $Proxy}
##GPU Count & Miner Type
$Type | Foreach {
if($_ -eq "NVIDIA1"){
"NVIDIA1" | Out-File ".\Build\minertype.sh" -Force
Write-Host "Group 1 is NVIDIA- Commands and Stats will work for NVIDIA1" -foreground yellow
Start-Sleep -S 3
}
if($_ -eq "AMD1"){
"AMD1" | Out-File ".\Build\minertype.sh" -Force
Write-Host "Group 1 is AMD- Commands and Stats will work for AMD1" -foreground yellow
Start-Sleep -S 3
}
if($_ -eq "CPU"){
if($CPUOnly -eq "Yes"){
"CPU" | Out-File ".\Build\minertype.sh" -Force
Write-Host "Group 1 is CPU- Commands and Stats will work for CPU" -foreground yellow
Start-Sleep -S 3
}
}
}
$GPU_Count = Get-GPUCount -DeviceType $Type -CmdDir $CmdDir
Start-Sleep -S 2
if($CPUOnly -eq "Yes"){$GPU_Count = $CPUThreads}
$Count = @()
for($i=0; $i -lt $GPU_Count; $i++){[string]$Count += "$i,"}
Write-Host "Device Count = $GPU_Count" -foregroundcolor green
$LogGPUS = $Count.Substring(0,$Count.Length-1)
##Reset-Old Stats
if(Test-Path "Stats"){Get-ChildItemContent "Stats" | ForEach {$Stat = Set-Stat $_.Name $_.Content.Week}}
##Logo
Write-Host "
MMMMMMMM MMMMMMMMMMMMMMMM MMMMMMMM HHHHHHHHH HHHHHHHHH AAA SSSSSSSSSSSSSSS HHHHHHHHH HHHHHHHHH
M:::::::M M:::::::MM:::::::M M:::::::M H:::::::H H:::::::H A:::A SS:::::::::::::::SH:::::::H H:::::::H
M::::::::M M::::::::MM::::::::M M::::::::M H:::::::H H:::::::H A:::::A S:::::SSSSSS::::::SH:::::::H H:::::::H
M:::::::::M M:::::::::MM:::::::::M M:::::::::M HH::::::H H::::::HH A:::::::A S:::::S SSSSSSSHH::::::H H::::::HH
M::::::::::M M::::::::::MM::::::::::M M::::::::::M H:::::H H:::::H A:::::::::A S:::::S H:::::H H:::::H
M:::::::::::M M:::::::::::MM:::::::::::M M:::::::::::M H:::::H H:::::H A:::::A:::::A S:::::S H:::::H H:::::H
M:::::::M::::M M::::M:::::::MM:::::::M::::M M::::M:::::::M H::::::HHHHH::::::H A:::::A A:::::A S::::SSSS H::::::HHHHH::::::H
M::::::M M::::M M::::M M::::::MM::::::M M::::M M::::M M::::::M H:::::::::::::::::H A:::::A A:::::A SS::::::SSSSS H:::::::::::::::::H
M::::::M M::::M::::M M::::::MM::::::M M::::M::::M M::::::M H:::::::::::::::::H A:::::A A:::::A SSS::::::::SS H:::::::::::::::::H
M::::::M M:::::::M M::::::MM::::::M M:::::::M M::::::M H::::::HHHHH::::::H A:::::AAAAAAAAA:::::A SSSSSS::::S H::::::HHHHH::::::H
M::::::M M:::::M M::::::MM::::::M M:::::M M::::::M H:::::H H:::::H A:::::::::::::::::::::A S:::::S H:::::H H:::::H
M::::::M MMMMM M::::::MM::::::M MMMMM M::::::M H:::::H H:::::H A:::::AAAAAAAAAAAAA:::::A S:::::S H:::::H H:::::H
M::::::M M::::::MM::::::M M::::::M HH::::::H H::::::HH A:::::A A:::::A SSSSSSS S:::::SHH::::::H H::::::HH
M::::::M M::::::MM::::::M M::::::M ...... H:::::::H H:::::::H A:::::A A:::::A S::::::SSSSSS:::::SH:::::::H H:::::::H
M::::::M M::::::MM::::::M M::::::M .::::. H:::::::H H:::::::H A:::::A A:::::AS:::::::::::::::SS H:::::::H H:::::::H
MMMMMMMM MMMMMMMMMMMMMMMM MMMMMMMM ...... HHHHHHHHH HHHHHHHHHAAAAAAA AAAAAAASSSSSSSSSSSSSSS HHHHHHHHH HHHHHHHHH
By: MaynardMiner v1.4.3b Hive GitHub: http://Github.com/MaynardMiner/MM.Hash
SUDO APT-GET LAMBO
____ _ __ _ ____
|####`--|#|---|##|---|#|--'##|#|
_ |___,--|#|---|##|---|#|--.__|_|
_|#)____________________________________,--'EEEEEEEEEEEEEE'_=-.
((_____((_________________________,--------[JW](___(____(____(_==) _________
.--|##,----o o o o o o o__|/`---,-,-'=========`=+==.
|##|_Y__,__.-._,__, __,-.___/ J \ .----.#############|##|
|##| `-.|#|##|#|`===l##\ _\############|##|
=======-===l |_|__|_| \##`-'__,=======.###|##|
\__.' '======'
SNIPER-MODE ACTIVATED
BTC DONATION ADRRESS TO SUPPORT DEVELOPMENT: 1DRxiWx6yuZfN9hrEJa3BDXWVJ9yyJU36i
1.35% Dev Fee Was Written In This Code
Sniper Mode Can Take Awhile To Load At First Time Start-Up. Please Be Patient!
" -foregroundColor "darkred"
Set-Location $CmdDir
$PID | Set-Content ".\PID\miner_PID.txt" -Force
Start-Process "screen" -ArgumentList "-S PIDInfo -d -m"
Start-Sleep -S 1
Start-Process ".\Unix\Hive\PIDInfo.sh" -ArgumentList "PIDInfo miner"
Set-Location $Dir
while($true)
{
$Algorithm = $null
$Algorithm = @()
$Algorithm = Get-AlgorithmList -DeviceType $Type -No_Algo $No_Algo -CmdDir $Dir
$minerupdate = Get-Content ".\Config\Update\updatelinux.txt" | ConvertFrom-Json
$update = $minerupdate.$Platform
$CoinAlgo = $null
##Remove Coins
##Check Time Parameters
$MinerWatch = New-Object -TypeName System.Diagnostics.Stopwatch
$TimeoutTime = [int]$Timeout*3600
$DecayExponent = [int](((Get-Date)-$DecayStart).TotalSeconds/$DecayPeriod)
$TimeDeviation = [int]($Donate + 1.35)
$InfoCheck = Get-Content ".\Build\Data\Info.txt" | Out-String
$DonateCheck = Get-Content ".\Build\Data\System.txt" | Out-String
$LastRan = Get-Content ".\Build\Data\TimeTable.txt" | Out-String
if($TimeDeviation -ne 0)
{
$DonationTotal = (864*[int]$TimeDeviation)
$DonationIntervals = ([int]$DonationTotal/288)
$FinalDonation = (86400/[int]$DonationIntervals)
if($LastRan -eq "")
{
Get-Date | Out-File ".\Build\Data\TimeTable.txt"
Continue
}
if($LastRan -ne "")
{
$RanDonate = [DateTime]$LastRan
$LastRanDonated = [math]::Round(((Get-Date)-$RanDonate).TotalSeconds)
if($LastRanDonated -ge 86400)
{
Clear-Content ".\Build\Data\TimeTable.txt" -Force
Get-Date | Out-File ".\Build\Data\TimeTable.txt"
Continue
}
}
if($LastRan -ne "")
{
$LastRanDonate = [DateTime]$LastRan
$LastTimeActive = [math]::Round(((Get-Date)-$LastRanDonate).TotalSeconds)
if($LastTimeActive -ge 1)
{
if($DonateCheck -eq "")
{
Get-Date | Out-File ".\Build\Data\System.txt"
Continue
}
$Donated = [DateTime]$DonateCheck
$CurrentlyDonated = [math]::Round(((Get-Date)-$Donated).TotalSeconds)
if($CurrentlyDonated -ge [int]$FinalDonation)
{
$Wallet = $InfoPass1
$Wallet1 = $InfoPass1
$Wallet2 = $InfoPass1
$Wallet3 = $InfoPass1
$CPUWallet = $InfoPass1
$ZergpoolWallet1 = $InfoPass1
$ZergpoolWallet2 = $InfoPass1
$ZergpoolWallet3 = $InfoPass1
$blockmastersWallet1 = $InfoPass1
$blockmastersWallet2 = $InfoPass1
$blockmastersWallet3 = $InfoPass1
$Nicehash_Wallet1 = $VerifyPass1
$Nicehash_Wallet2 = $VerifyPass1
$Nicehash_Wallet3 = $VerifyPass1
$UserName = $InfoPass2
$WorkerName = $VerifyPass2
$RigName = "DONATING!!!"
$Interval = 288
$Passwordcurrency = ("BTC")
$Passwordcurrency1 = ("BTC")
$Passwordcurrency2 = ("BTC")
$Passwordcurrency3 = ("BTC")
$CPUcurrency = ("BTC")
$Zergpoolpassword1 = ("BTC")
$Zergpoolpassword2 = ("BTC")
$Zergpoolpassword3 = ("BTC")
$blockmasterspassword1 = ("BTC")
$blockmasterspassword2 = ("BTC")
$blockmasterspassword3 = ("BTC")
if(($InfoCheck) -eq "")
{
Get-Date | Out-File ".\Build\Data\Info.txt"
}
Clear-Content ".\Build\Data\System.txt" -Force
Get-Date | Out-File ".\Build\Data\System.txt"
Start-Sleep -s 1
Write-Host "Entering Donation Mode" -foregroundColor "darkred"
Continue
}
}
if($InfoCheck -ne "")
{
$TimerCheck = [DateTime]$InfoCheck
$LastTimerCheck = [math]::Round(((Get-Date)-$LastRanDonate).TotalSeconds)
if(((Get-Date)-$TimerCheck).TotalSeconds -ge $Interval)
{
$Wallet = $WalletSwitch
$Wallet1 = $WalletSwitch1
$Wallet2 = $WalletSwitch2
$Wallet3 = $WalletSwitch3
$ZergpoolWallet1 = $ZergpoolWallet1Switch
$ZergpoolWallet2 = $ZergpoolWallet2Switch
$ZergpoolWallet3 = $ZergpoolWallet3Switch
$Nicehash_Wallet1 = $Nicehash_Wallet1Switch
$Nicehash_Wallet2 = $Nicehash_Wallet2Switch
$Nicehash_Wallet3 = $Nicehash_Wallet3Switch
$CPUWallet = $CPUWalletSwitch
$UserName = $UserSwitch
$WorkerName = $WorkerSwitch
$RigName = $RigSwitch
$Interval = $IntervalSwitch
$Passwordcurrency = $PasswordSwitch
$Passwordcurrency1 = $PasswordSwitch1
$Passwordcurrency2 = $PasswordSwitch2
$Passwordcurrency3 = $PasswordSwitch3
$Zergpoolpassword1 = $Zergpoolpassword1Switch
$Zergpoolpassword2 = $Zergpoolpassword2Switch
$Zergpoolpassword3 = $Zergpoolpassword3Switch
$CPUcurrency = $CPUcurrencySwitch
Clear-Content ".\Build\Data\Info.txt" -Force
Write-Host "Leaving Donation Mode- Thank you For The Support!" -foregroundcolor "darkred"
Continue
}
}
}
}
##Get Price Data
try {
$T = [string]$CoinExchange
$R= [string]$Currency
Write-Host "MM.Hash Is Entering Sniper Mode: Building The Coin Database- It Can Take Some Time." -foreground "yellow"
$Exchanged = Invoke-RestMethod "https://min-api.cryptocompare.com/data/price?fsym=$T&tsyms=$R" -UseBasicParsing | Select-Object -ExpandProperty $R
$Rates = Invoke-RestMethod "https://api.coinbase.com/v2/exchange-rates?currency=$R" -UseBasicParsing | Select-Object -ExpandProperty data | Select-Object -ExpandProperty rates
$Currency | Where-Object {$Rates.$_} | ForEach-Object {$Rates | Add-Member $_ ([Double]$Rates.$_) -Force}
}
catch {
Write-Host -Level Warn "Coinbase Unreachable. "
Write-Host -ForegroundColor Yellow "Last Refresh: $(Get-Date)"
Write-host "Trying To Contact Cryptonator.." -foregroundcolor "Yellow"
$Rates = [PSCustomObject]@{}
$Currency | ForEach {$Rates | Add-Member $_ (Invoke-WebRequest "https://api.cryptonator.com/api/ticker/btc-$_" -UseBasicParsing | ConvertFrom-Json).ticker.price}
}
##Load File Stats
if($TimeoutTimer.Elapsed.TotalSeconds -lt $TimeoutTime -or $Timeout -eq 0)
{
$Stats = $null
$Stats = [PSCustomObject]@{}
$AllStats = if(Test-Path "Stats"){Get-ChildItemContent "Stats" | ForEach {$Stats | Add-Member $_.Name $_.Content}}
$AllStats | Out-Null
}
else
{
$AllStats = if(Test-Path "./Stats"){Get-ChildItemContent "./Stats"}
$AllStats | ForEach-Object{
if($_.Content.Live -eq 0)
{
$Removed = Join-Path "./Stats" "$($_.Name).txt"
$Change = $($_.Name) -replace "HashRate","TIMEOUT"
if(Test-Path (Join-Path "./Timeout" "$($Change).txt")){Remove-Item (Join-Path "./Timeout" "$($Change).txt")}
Remove-Item $Removed
Write-Host "$($_.Name) Hashrate and Timeout Notification was Removed"
}
}
Write-Host "Cleared Timeouts" -ForegroundColor Red
$TimeoutTimer.Restart()
continue
}
##Load Algo Pools
Write-Host "Checking Algo Pools" -Foregroundcolor yellow
$AllAlgoPools = $null
$AllAlgoPools = if(Test-Path "AlgoPools"){Get-ChildItemContent "AlgoPools" | ForEach {$_.Content | Add-Member @{Name = $_.Name} -PassThru} |
Where {$PoolName.Count -eq 0 -or (Compare-Object $PoolName $_.Name -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0} |
Where {$Algorithm.Count -eq 0 -or (Compare-Object $Algorithm $_.Algorithm -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0}}
if($AllAlgoPools.Count -eq 0){"No Pools! Check Internet Connection."| Out-Host; start-sleep $Interval; continue}
$AlgoPools = $null
$AlgoPools = [PSCustomObject]@{}
$AgloPools_Comparison = $null
$AlgoPools_Comparison = [PSCustomObject]@{}
$AllAlgoPools.Symbol | Select -Unique | ForEach {$AlgoPools | Add-Member $_ ($AllAlgoPools | Where Symbol -EQ $_ | Sort-Object Price -Descending | Select -First 1)}
$AllAlgoPools.Symbol | Select -Unique | ForEach {$AlgoPools_Comparison | Add-Member $_ ($AllAlgoPools | Where Symbol -EQ $_ | Sort-Object StablePrice -Descending | Select -First 1)}
##Make Algorithm Available Only List
$PoolAlgorithms = $null
$PoolAlgorithms = @()
$AlgoPools | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name | foreach{
$PoolAlgorithms += $_
}
##Load Only Needed Algorithm Miners
Write-Host "Checking Algo Miners"
$AlgoMiners = $null
$AlgoMiners = if(Test-Path "Miners\unix"){Get-ChildItemContent "Miners\unix" | ForEach {$_.Content | Add-Member @{Name = $_.Name} -PassThru} |
Where {$Platform.Count -eq 0 -or (Compare-Object $Platform $_.Platform -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0} |
Where {$Type.Count -eq 0 -or (Compare-Object $Type $_.Type -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0} |
Where {$PoolAlgorithms.Count -eq 0 -or (Compare-Object $PoolAlgorithms $_.Selected.PSObject.Properties.Name -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0}}
##Download Miners
$AlgoMiners = $AlgoMiners | ForEach {
$AlgoMiner = $_
##Re-Name Instance In Case Of Crashe\
if(Test-Path (Split-Path $AlgoMiner.Path))
{
Set-Location (Split-Path $AlgoMiner.Path)
if(Test-Path "*$($AlgoMiner.Type)*")
{
$OldInstance = Get-ChildItem "*$($AlgoMiner.Type)*"
Rename-Item $OldInstance -NewName "$($AlgoMiner.MinerName)" -force
}
Set-Location $Dir
}
if((Test-Path $AlgoMiner.Path) -eq $false)
{
if($AlgoMiner.BUILD -eq "Linux" -or $AlgoMiner.BUILD -eq "Linux-Clean" -or $AlgoMiner.BUILD -eq "Linux-Zip-Build")
{
Expand-WebRequest -URI $AlgoMiner.URI -BuildPath $AlgoMiner.BUILD -Path (Split-Path $AlgoMiner.Path) -MineName (Split-Path $AlgoMiner.Path -Leaf) -MineType $AlgoMiner.Type
}
if($AlgoMiner.BUILD -eq "Windows" -or "Linux-Zip" -or "Zip")
{
if((Split-Path $AlgoMiner.URI -Leaf) -eq (Split-Path $AlgoMiner.Path -Leaf))
{
New-Item (Split-Path $AlgoMiner.Path) -ItemType "Directory" | Out-Null
Invoke-WebRequest $AlgoMiner.URI -OutFile $_.Path -UseBasicParsing
}
else
{
Expand-WebRequest -URI $AlgoMiner.URI -BuildPath $AlgoMiner.BUILD -Path (Split-Path $AlgoMiner.Path) -MineName (Split-Path $AlgoMiner.Path -Leaf) -MineType $AlgoMiner.Type
}
}
}
else
{
$AlgoMiner
}
}
if($AlgoMiners.Count -eq 0){"No Miners!" | Out-Host; start-sleep $Interval; continue}
##Sort Alorithm Miners
$AlgoMiners | ForEach {
$AlgoMiner = $_
$AlgoMiner_HashRates = [PSCustomObject]@{}
$AlgoMiner_Pools = [PSCustomObject]@{}
$AlgoMiner_Pools_Comparison = [PSCustomObject]@{}
$AlgoMiner_Profits = [PSCustomObject]@{}
$AlgoMiner_Profits_Comparison = [PSCustomObject]@{}
$AlgoMiner_Profits_Bias = [PSCustomObject]@{}
$AlgoMiner_Types = $AlgoMiner.Type | Select -Unique
$AlgoMiner_Indexes = $AlgoMiner.Index | Select -Unique
$AlgoMiner.HashRates | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name | ForEach {
$AlgoMiner_HashRates | Add-Member $_ ([Double]$AlgoMiner.HashRates.$_)
$AlgoMiner_Pools | Add-Member $_ ([PSCustomObject]$AlgoPools.$_)
$AlgoMiner_Pools_Comparison | Add-Member $_ ([PSCustomObject]$AlgoPools_Comparison.$_)
$AlgoMiner_Profits | Add-Member $_ ([Double]$AlgoMiner.HashRates.$_*$AlgoPools.$_.Price)
$AlgoMiner_Profits_Comparison | Add-Member $_ ([Double]$AlgoMiner.HashRates.$_*$AlgoPools_Comparison.$_.Price)
$AlgoMiner_Profits_Bias | Add-Member $_ ([Double]$AlgoMiner.HashRates.$_*$AlgoPools.$_.Price*(1-($AlgoPools.$_.MarginOfError*[Math]::Pow($DecayBase,$DecayExponent))))
}
$AlgoMiner_Profit = [Double]($AlgoMiner_Profits.PSObject.Properties.Value | Measure -Sum).Sum
$AlgoMiner_Profit_Comparison = [Double]($AlgoMiner_Profits_Comparison.PSObject.Properties.Value | Measure -Sum).Sum
$AlgoMiner_Profit_Bias = [Double]($AlgoMiner_Profits_Bias.PSObject.Properties.Value | Measure -Sum).Sum
$AlgoMiner.HashRates | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name | ForEach {
if(-not [String]$AlgoMiner.HashRates.$_)
{
$AlgoMiner_HashRates.$_ = $null
$AlgoMiner_Profits.$_ = $null
$AlgoMiner_Profits_Comparison.$_ = $null
$AlgoMiner_Profits_Bias.$_ = $null
$AlgoMiner_Profit = $null
$AlgoMiner_Profit_Comparison = $null
$AlgoMiner_Profit_Bias = $null
}
}
if($AlgoMiner_Types -eq $null){$AlgoMiner_Types = $AlgoMiners.Type | Select -Unique}
if($AlgoMiner_Indexes -eq $null){$AlgoMiner_Indexes = $AlgoMiners.Index | Select -Unique}
if($AlgoMiner_Types -eq $null){$AlgoMiner_Types = ""}
if($AlgoMiner_Indexes -eq $null){$AlgoMiner_Indexes = 0}
$AlgoMiner.HashRates = $AlgoMiner_HashRates
$AlgoMiner | Add-Member Pools $AlgoMiner_Pools
$AlgoMiner | Add-Member Profits $AlgoMiner_Profits
$AlgoMiner | Add-Member Profits_Comparison $AlgoMiner_Profits_Comparison
$AlgoMiner | Add-Member Profits_Bias $AlgoMiner_Profits_Bias
$AlgoMiner | Add-Member Profit $AlgoMiner_Profit
$AlgoMiner | Add-Member Profit_Comparison $AlgoMiner_Profit_Comparison
$AlgoMiner | Add-Member Profit_Bias $AlgoMiner_Profit_Bias
$AlgoMiner | Add-Member Type $AlgoMiner_Types -Force
$AlgoMiner | Add-Member Index $AlgoMiner_Indexes -Force
$AlgoMiner.Path = Convert-Path $AlgoMiner.Path
}
$AlgoMiners | ForEach {
$AlgoMiner = $_
$AlgoMiner_Devices = $AlgoMiner.Device | Select -Unique
if($AlgoMiner_Devices -eq $null){$AlgoMiner_Devices = ($AlgoMiners | Where {(Compare-Object $AlgoMiner.Type $_.Type -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0}).Device | Select -Unique}
if($AlgoMiner_Devices -eq $null){$AlgoMiner_Devices = $AlgoMiner.Type}
$AlgoMiner | Add-Member Device $AlgoMiner_Devices -Force
}
#Don't penalize active miners & sort by threshold
$ActiveMinerPrograms | ForEach {$AlgoMiners | Where Path -EQ $_.Path | Where Arguments -EQ $_.Arguments | ForEach {$_.Profit_Bias = $_.Profit}}
$GoodAlgoMiners = $null
$GoodAlgoMiners = @()
$AlgoMiners | Where [Double]Profit -lt $Threshold | foreach {$GoodAlgoMiners += $_}
#Get most profitable algo miner combination i.e. AMD+NVIDIA+CPU add algo miners to miners list
$Miners = $null
$Miners = @()
$GoodAlgoMiners | foreach {$Miners += $_}
$BestAlgoMiners = $GoodAlgoMiners | Select Type,Index -Unique | ForEach {$AlgoMiner_GPU = $_; ($GoodAlgoMiners | Where {(Compare-Object $AlgoMiner_GPU.Type $_.Type | Measure).Count -eq 0 -and (Compare-Object $AlgoMiner_GPU.Index $_.Index | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Bias -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$BestDeviceAlgoMiners = $GoodAlgoMiners | Select Device -Unique | ForEach {$AlgoMiner_GPU = $_; ($GoodAlgoMiners | Where {(Compare-Object $AlgoMiner_GPU.Device $_.Device | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Bias -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$BestAlgoMiners_Comparison = $GoodAlgoMiners | Select Type,Index -Unique | ForEach {$AlgoMiner_GPU = $_; ($GoodAlgoMiners | Where {(Compare-Object $AlgoMiner_GPU.Type $_.Type | Measure).Count -eq 0 -and (Compare-Object $AlgoMiner_GPU.Index $_.Index | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Comparison -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$BestDeviceAlgoMiners_Comparison = $GoodAlgoMiners | Select Device -Unique | ForEach {$AlgoMiner_GPU = $_; ($GoodAlgoMiners | Where {(Compare-Object $AlgoMiner_GPU.Device $_.Device | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Comparison -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$AlgoMiners_Type_Combos = @([PSCustomObject]@{Combination = @()}) + (Get-Combination ($GoodAlgoMiners | Select Type -Unique) | Where{(Compare-Object ($_.Combination | Select -ExpandProperty Type -Unique) ($_.Combination | Select -ExpandProperty Type) | Measure).Count -eq 0})
$AlgoMiners_Index_Combos = @([PSCustomObject]@{Combination = @()}) + (Get-Combination ($GoodAlgoMiners | Select Index -Unique) | Where{(Compare-Object ($_.Combination | Select -ExpandProperty Index -Unique) ($_.Combination | Select -ExpandProperty Index) | Measure).Count -eq 0})
$AlgoMiners_Device_Combos = (Get-Combination ($GoodAlgoMiners | Select Device -Unique) | Where{(Compare-Object ($_.Combination | Select -ExpandProperty Device -Unique) ($_.Combination | Select -ExpandProperty Device) | Measure).Count -eq 0})
$BestAlgoMiners_Combos = $AlgoMiners_Type_Combos | ForEach {$AlgoMiner_Type_Combo = $_.Combination; $AlgoMiners_Index_Combos | ForEach {$AlgoMiner_Index_Combo = $_.Combination; [PSCustomObject]@{Combination = $AlgoMiner_Type_Combo | ForEach {$AlgoMiner_Type_Count = $_.Type.Count; [Regex]$AlgoMiner_Type_Regex = ‘^(‘ + (($_.Type | ForEach {[Regex]::Escape($_)}) -join “|”) + ‘)$’; $AlgoMiner_Index_Combo | ForEach {$AlgoMiner_Index_Count = $_.Index.Count; [Regex]$AlgoMiner_Index_Regex = ‘^(‘ + (($_.Index | ForEach {[Regex]::Escape($_)}) –join “|”) + ‘)$’; $BestAlgoMiners | Where {([Array]$_.Type -notmatch $AlgoMiner_Type_Regex).Count -eq 0 -and ([Array]$_.Index -notmatch $AlgoMiner_Index_Regex).Count -eq 0 -and ([Array]$_.Type -match $AlgoMiner_Type_Regex).Count -eq $AlgoMiner_Type_Count -and ([Array]$_.Index -match $AlgoMiner_Index_Regex).Count -eq $AlgoMiner_Index_Count}}}}}}
$BestAlgoMiners_Combos += $AlgoMiners_Device_Combos | ForEach {$AlgoMiner_Device_Combo = $_.Combination; [PSCustomObject]@{Combination = $AlgoMiner_Device_Combo | ForEach {$AlgoMiner_Device_Count = $_.Device.Count; [Regex]$AlgoMiner_Device_Regex = ‘^(‘ + (($_.Device | ForEach {[Regex]::Escape($_)}) -join “|”) + ‘)$’; $BestDeviceAlgoMiners | Where {([Array]$_.Device -notmatch $AlgoMiner_Device_Regex).Count -eq 0 -and ([Array]$_.Device -match $AlgoMiner_Device_Regex).Count -eq $AlgoMiner_Device_Count}}}}
$BestAlgoMiners_Combos_Comparison = $AlgoMiners_Type_Combos | ForEach {$AlgoMiner_Type_Combo = $_.Combination; $AlgoMiners_Index_Combos | ForEach {$AlgoMiner_Index_Combo = $_.Combination; [PSCustomObject]@{Combination = $AlgoMiner_Type_Combo | ForEach {$AlgoMiner_Type_Count = $_.Type.Count; [Regex]$AlgoMiner_Type_Regex = ‘^(‘ + (($_.Type | ForEach {[Regex]::Escape($_)}) -join “|”) + ‘)$’; $AlgoMiner_Index_Combo | ForEach {$AlgoMiner_Index_Count = $_.Index.Count; [Regex]$AlgoMiner_Index_Regex = ‘^(‘ + (($_.Index | ForEach {[Regex]::Escape($_)}) –join “|”) + ‘)$’; $BestAlgoMiners_Comparison | Where {([Array]$_.Type -notmatch $AlgoMiner_Type_Regex).Count -eq 0 -and ([Array]$_.Index -notmatch $AlgoMiner_Index_Regex).Count -eq 0 -and ([Array]$_.Type -match $AlgoMiner_Type_Regex).Count -eq $AlgoMiner_Type_Count -and ([Array]$_.Index -match $AlgoMiner_Index_Regex).Count -eq $AlgoMiner_Index_Count}}}}}}
$BestAlgoMiners_Combos_Comparison += $AlgoMiners_Device_Combos | ForEach {$AlgoMiner_Device_Combo = $_.Combination; [PSCustomObject]@{Combination = $AlgoMiner_Device_Combo | ForEach {$AlgoMiner_Device_Count = $_.Device.Count; [Regex]$AlgoMiner_Device_Regex = ‘^(‘ + (($_.Device | ForEach {[Regex]::Escape($_)}) -join “|”) + ‘)$’; $BestDeviceAlgoMiners_Comparison | Where {([Array]$_.Device -notmatch $AlgoMiner_Device_Regex).Count -eq 0 -and ([Array]$_.Device -match $AlgoMiner_Device_Regex).Count -eq $AlgoMiner_Device_Count}}}}
$BestAlgoMiners_Combo = $BestAlgoMiners_Combos | Sort-Object -Descending {($_.Combination | Where Profit -EQ $null | Measure).Count},{($_.Combination | Measure Profit_Bias -Sum).Sum},{($_.Combination | Where Profit -NE 0 | Measure).Count} | Select -First 1 | Select -ExpandProperty Combination
$BestAlgoMiners_Combo_Comparison = $BestAlgoMiners_Combos_Comparison | Sort-Object -Descending {($_.Combination | Where Profit -EQ $null | Measure).Count},{($_.Combination | Measure Profit_Comparison -Sum).Sum},{($_.Combination | Where Profit -NE 0 | Measure).Count} | Select -First 1 | Select -ExpandProperty Combination
$BestMiners_Combo = $BestAlgoMiners_Combo
$CoinMiners = $null
#check if Auto_Coin is working- Start Coin Sorting
if($Auto_Coin -eq "Yes")
{
$AddCoinMiners = $null
$AddCoinMiners = @()
$NeedsToBeBench = $false
#Check if Benchmarking/Disable Coins
$BestAlgoMiners_Combo | foreach {
if($_.Profit -eq $null)
{
$NeedsToBeBench = $true
Write-Host "Coins Disabled - Benchmarking Required." -foreground yellow
}
}
#Get Specific Coin Miners
if($NeedsToBeBench -eq $false){$BestAlgoMiners_Combo | foreach {if($_.MinerPool -like "*algo*"){$AddCoinMiners += $_}}}
#Get Specfic Coin Algorithms
if($AddCoinMiners -ne $null)
{
$CoinAlgo = @()
$AddCoinMiners.Algo | foreach {$CoinAlgo += $_}
Write-Host "Best Pool Is CoinPool: Searching For Coins For $($CoinAlgo) Algorithm" -ForegroundColor Magenta
#Load Coin Pools
$AllCoinPools = $null
$AllCoinPools = if(Test-Path "CoinPools"){Get-ChildItemContent "CoinPools" | ForEach {$_.Content | Add-Member @{Name = $_.Name} -PassThru} |
Where {$PoolName.Count -eq 0 -or (Compare-Object $PoolName $_.Name -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0} |
Where {$CoinAlgo.Count -eq 0 -or (Compare-Object $CoinAlgo $_.Algorithm -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0}}
$CoinPools = $null
$CoinPools = [PSCustomObject]@{}
$CoinPools_Comparison = $null
$CoinPools_Comparison = [PSCustomObject]@{}
$AllCoinPools.Symbol | Select -Unique | ForEach {$CoinPools | Add-Member $_ ($AllCoinPools | Where Symbol -EQ $_ | Sort-Object Price -Descending | Select -Unique -First 1)}
$AllCoinPools.Symbol | Select -Unique | ForEach {$CoinPools_Comparison | Add-Member $_ ($AllCoinPools | Where Symbol -EQ $_ | Sort-Object StablePrice -Descending | Select -Unique -First 1)}
#Load Coin Miners
$CoinMiners = $null
$CoinMiners = if(Test-Path "Miners\unix"){Get-ChildItemContent "Miners\unix" | ForEach {$_.Content | Add-Member @{Name = $_.Name} -PassThru} |
Where {$Platform.Count -eq 0 -or (Compare-Object $Platform $_.Platform -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0} |
Where {$Type.Count -eq 0 -or (Compare-Object $Type $_.Type -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0} |
Where {$CoinAlgo.Count -eq 0 -or (Compare-Object $CoinAlgo $_.Selected.PSObject.Properties.Name -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0}}
}
}
##Sort Coin Miners
if($CoinMiners -ne $null)
{
$CoinMiners | ForEach {
$CoinMiner = $_
$CoinMiner_HashRates = [PSCustomObject]@{}
$CoinMiner_Pools = [PSCustomObject]@{}
$CoinMiner_Pools_Comparison = [PSCustomObject]@{}
$CoinMiner_Profits = [PSCustomObject]@{}
$CoinMiner_Profits_Comparison = [PSCustomObject]@{}
$CoinMiner_Profits_Bias = [PSCustomObject]@{}
$CoinMiner_Types = $CoinMiner.Type | Select -Unique
$CoinMiner_Indexes = $CoinMiner.Index | Select -Unique
$CoinMiner.HashRates | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name | ForEach {
$CoinMiner_HashRates | Add-Member $_ ([Double]$CoinMiner.HashRates.$_)
$CoinMiner_Pools | Add-Member $_ ([PSCustomObject]$CoinPools.$_)
$CoinMiner_Pools_Comparison | Add-Member $_ ([PSCustomObject]$CoinPools_Comparison.$_)
$CoinMiner_Profits | Add-Member $_ ([Double]$CoinMiner.HashRates.$_*$CoinPools.$_.Price)
$CoinMiner_Profits_Comparison | Add-Member $_ ([Double]$CoinMiner.HashRates.$_*$CoinPools_Comparison.$_.Price)
$CoinMiner_Profits_Bias | Add-Member $_ ([Double]$CoinMiner.HashRates.$_*$CoinPools.$_.Price*(1-($CoinPools.$_.MarginOfError*[Math]::Pow($DecayBase,$DecayExponent))))
}
$CoinMiner_Profit = [Double]($CoinMiner_Profits.PSObject.Properties.Value | Measure -Sum).Sum
$CoinMiner_Profit_Comparison = [Double]($CoinMiner_Profits_Comparison.PSObject.Properties.Value | Measure -Sum).Sum
$CoinMiner_Profit_Bias = [Double]($CoinMiner_Profits_Bias.PSObject.Properties.Value | Measure -Sum).Sum
##Not Needed- Added for future use
$CoinMiner.HashRates | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name | ForEach {
if(-not [String]$CoinMiner.HashRates.$_)
{
$CoinMiner_HashRates.$CoinMinerAlgo = $null
$CoinMiner_Profits.$CoinSymbol = $null
$CoinMiner_Profits_Comparison.$CoinSymbol = $null
$CoinMiner_Profits_Bias.$CoinSymbol = $null
$CoinMiner_Profit = $null
$CoinMiner_Profit_Comparison = $null
$CoinMiner_Profit_Bias = $null
}
}
if($CoinMiner_Types -eq $null){$CoinMiner_Types = $CoinMiners.Type | Select -Unique}
if($CoinMiner_Indexes -eq $null){$CoinMiner_Indexes = $CoinMiners.Index | Select -Unique}
if($CoinMiner_Types -eq $null){$CoinMiner_Types = ""}
if($CoinMiner_Indexes -eq $null){$CoinMiner_Indexes = 0}
$CoinMiner.HashRates = $CoinMiner_HashRates
$CoinMiner | Add-Member Pools $CoinMiner_Pools
$CoinMiner | Add-Member Profits $CoinMiner_Profits
$CoinMiner | Add-Member Profits_Comparison $CoinMiner_Profits_Comparison
$CoinMiner | Add-Member Profits_Bias $CoinMiner_Profits_Bias
$CoinMiner | Add-Member Profit $CoinMiner_Profit
$CoinMiner | Add-Member Profit_Comparison $CoinMiner_Profit_Comparison
$CoinMiner | Add-Member Profit_Bias $CoinMiner_Profit_Bias
$CoinMiner | Add-Member Type $CoinMiner_Types -Force
$CoinMiner | Add-Member Index $CoinMiner_Indexes -Force
$CoinMiner.Path = Convert-Path $CoinMiner.Path
}
$CoinMiners | ForEach {
$CoinMiner = $_
$CoinMiner_Devices = $CoinMiner.Device | Select -Unique
if($CoinMiner_Devices -eq $null){$CoinMiner_Devices = ($CoinMiners | Where {(Compare-Object $CoinMiner.Type $_.Type -IncludeEqual -ExcludeDifferent | Measure).Count -gt 0}).Device | Select -Unique}
if($CoinMiner_Devices -eq $null){$CoinMiner_Devices = $CoinMiner.Type}
$CoinMiner | Add-Member Device $CoinMiner_Devices -Force
}
$NewCoinAlgo = $null
$Miners = $null
$BestMiners_Combo = $null
$NewCoinAlgo = @()
$Miners = @()
if($Favor_Coins -eq "Yes")
{
$CoinAlgo | foreach {
if($BestAlgoMiners_Combo.MinerPool -like "*algo*")
{
$NewCoinAlgo += [PSCustomObject]@{
$_ = "$($_)"
}
}
}
}
$ProfitsArray = $null
$ProfitsArray = @()
if($Favor_Coins -eq "Yes")
{
$CoinMiners | Where [Double]Profit -lt $Threshold | foreach {$Miners += $_}
}
else{
$GoodAlgoMiners | foreach {$Miners += $_}
$CoinMiners | Where [Double]Profit -lt $Threshold | foreach {$Miners += $_}
}
$ActiveMinerPrograms | ForEach {$Miners | Where Path -EQ $_.Path | Where Arguments -EQ $_.Arguments | ForEach {$_.Profit_Bias = $_.Profit}}
$BestMiners = $Miners | Select Type,Index -Unique | ForEach {$Miner_GPU = $_; ($Miners | Where {(Compare-Object $Miner_GPU.Type $_.Type | Measure).Count -eq 0 -and (Compare-Object $Miner_GPU.Index $_.Index | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Bias -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$BestDeviceMiners = $Miners | Select Device -Unique | ForEach {$Miner_GPU = $_; ($Miners | Where {(Compare-Object $Miner_GPU.Device $_.Device | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Bias -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$BestMiners_Comparison = $Miners | Select Type,Index -Unique | ForEach {$Miner_GPU = $_; ($Miners | Where {(Compare-Object $Miner_GPU.Type $_.Type | Measure).Count -eq 0 -and (Compare-Object $Miner_GPU.Index $_.Index | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Comparison -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$BestDeviceMiners_Comparison = $Miners | Select Device -Unique | ForEach {$Miner_GPU = $_; ($Miners | Where {(Compare-Object $Miner_GPU.Device $_.Device | Measure).Count -eq 0} | Sort-Object -Descending {($_ | Where Profit -EQ $null | Measure).Count},{($_ | Measure Profit_Comparison -Sum).Sum},{($_ | Where Profit -NE 0 | Measure).Count} | Select -First 1)}
$Miners_Type_Combos = @([PSCustomObject]@{Combination = @()}) + (Get-Combination ($Miners | Select Type -Unique) | Where{(Compare-Object ($_.Combination | Select -ExpandProperty Type -Unique) ($_.Combination | Select -ExpandProperty Type) | Measure).Count -eq 0})
$Miners_Index_Combos = @([PSCustomObject]@{Combination = @()}) + (Get-Combination ($Miners | Select Index -Unique) | Where{(Compare-Object ($_.Combination | Select -ExpandProperty Index -Unique) ($_.Combination | Select -ExpandProperty Index) | Measure).Count -eq 0})
$Miners_Device_Combos = (Get-Combination ($Miners | Select Device -Unique) | Where{(Compare-Object ($_.Combination | Select -ExpandProperty Device -Unique) ($_.Combination | Select -ExpandProperty Device) | Measure).Count -eq 0})
$BestMiners_Combos = $Miners_Type_Combos | ForEach {$Miner_Type_Combo = $_.Combination; $Miners_Index_Combos | ForEach {$Miner_Index_Combo = $_.Combination; [PSCustomObject]@{Combination = $Miner_Type_Combo | ForEach {$Miner_Type_Count = $_.Type.Count; [Regex]$Miner_Type_Regex = '^(' + (($_.Type | ForEach {[Regex]::Escape($_)}) -join "|") + ')$'; $Miner_Index_Combo | ForEach {$Miner_Index_Count = $_.Index.Count; [Regex]$Miner_Index_Regex = '^(' + (($_.Index | ForEach {[Regex]::Escape($_)}) -join "|") + ')$'; $BestMiners | Where {([Array]$_.Type -notmatch $Miner_Type_Regex).Count -eq 0 -and ([Array]$_.Index -notmatch $Miner_Index_Regex).Count -eq 0 -and ([Array]$_.Type -match $Miner_Type_Regex).Count -eq $Miner_Type_Count -and ([Array]$_.Index -match $Miner_Index_Regex).Count -eq $Miner_Index_Count}}}}}}
$BestMiners_Combos += $Miners_Device_Combos | ForEach {$Miner_Device_Combo = $_.Combination; [PSCustomObject]@{Combination = $Miner_Device_Combo | ForEach {$Miner_Device_Count = $_.Device.Count; [Regex]$Miner_Device_Regex = '^(' + (($_.Device | ForEach {[Regex]::Escape($_)}) -join "|") + ')$'; $BestDeviceMiners | Where {([Array]$_.Device -notmatch $Miner_Device_Regex).Count -eq 0 -and ([Array]$_.Device -match $Miner_Device_Regex).Count -eq $Miner_Device_Count}}}}
$BestMiners_Combos_Comparison = $Miners_Type_Combos | ForEach {$Miner_Type_Combo = $_.Combination; $Miners_Index_Combos | ForEach {$Miner_Index_Combo = $_.Combination; [PSCustomObject]@{Combination = $Miner_Type_Combo | ForEach {$Miner_Type_Count = $_.Type.Count; [Regex]$Miner_Type_Regex = '^(' + (($_.Type | ForEach {[Regex]::Escape($_)}) -join "|") + ')$'; $Miner_Index_Combo | ForEach {$Miner_Index_Count = $_.Index.Count; [Regex]$Miner_Index_Regex = '^(' + (($_.Index | ForEach {[Regex]::Escape($_)}) -join "|") + ')$'; $BestMiners_Comparison | Where {([Array]$_.Type -notmatch $Miner_Type_Regex).Count -eq 0 -and ([Array]$_.Index -notmatch $Miner_Index_Regex).Count -eq 0 -and ([Array]$_.Type -match $Miner_Type_Regex).Count -eq $Miner_Type_Count -and ([Array]$_.Index -match $Miner_Index_Regex).Count -eq $Miner_Index_Count}}}}}}
$BestMiners_Combos_Comparison += $Miners_Device_Combos | ForEach {$Miner_Device_Combo = $_.Combination; [PSCustomObject]@{Combination = $Miner_Device_Combo | ForEach {$Miner_Device_Count = $_.Device.Count; [Regex]$Miner_Device_Regex = '^(' + (($_.Device | ForEach {[Regex]::Escape($_)}) -join "|") + ')$'; $BestDeviceMiners_Comparison | Where {([Array]$_.Device -notmatch $Miner_Device_Regex).Count -eq 0 -and ([Array]$_.Device -match $Miner_Device_Regex).Count -eq $Miner_Device_Count}}}}
$BestMiners_Combo = $BestMiners_Combos | Sort-Object -Descending {($_.Combination | Where Profit -EQ $null | Measure).Count},{($_.Combination | Measure Profit_Bias -Sum).Sum},{($_.Combination | Where Profit -NE 0 | Measure).Count} | Select -First 1 | Select -ExpandProperty Combination
$BestMiners_Combo_Comparison = $BestMiners_Combos_Comparison | Sort-Object -Descending {($_.Combination | Where Profit -EQ $null | Measure).Count},{($_.Combination | Measure Profit_Comparison -Sum).Sum},{($_.Combination | Where Profit -NE 0 | Measure).Count} | Select -First 1 | Select -ExpandProperty Combination
if($Favor_Coins -eq "Yes")
{
$BestMiners_Combo | Foreach {
$ProfitsArray += [PSCustomObject]@{
Type = $_.Type
Profits = $_.Profit
}
}
$GoodAlgoMiners | Foreach{
if($NewCoinAlgo.$($_.Symbol) -ne "$($_.Symbol)")
{
if(($ProfitsArray | Where Type -EQ $_.Type).Profits -gt $_.Profit)
{
$Miners += $_
}
}
}
}
}
$BestMiners_Selected = $BestMiners_Combo.Symbol
$BestPool_Selected = $BestMiners_Combo.MinerPool
Write-Host "Most Profitable Choice Is $($BestMiners_Selected) on $($BestPool_Selected)" -foregroundcolor green
$ProfitTable = $null
$ProfitTable = @()
$Miners | foreach {
$ProfitTable += [PSCustomObject]@{
Type = $_.Type
Miner = $_.Name
Name = $($_.Symbol)
Arguments = $($_.Arguments)
HashRates = $_.HashRates.$($_.Symbol)
Profits = $_.Profit_Bias
Algo = $_.Algo
Fullname = $_.FullName
MinerPool = $_.MinerPool
}
}
##Add Instance Settings To Miners For Tracking
$BestMiners_Combo | ForEach {
if(-not ($ActiveMinerPrograms | Where Path -eq $_.Path | Where Arguments -eq $_.Arguments ))
{
$ActiveMinerPrograms += [PSCustomObject]@{
Name = $_.Name
Type = $_.Type
Devices = $_.Devices
DeviceCall = $_.DeviceCall
MinerName = $_.MinerName
Path = $_.Path
Arguments = $_.Arguments
API = $_.API
Port = $_.Port
Coins = $_.Symbol
New = $false
Active = [TimeSpan]0
Activated = 0
Status = "Idle"
HashRate = 0
Benchmarked = 0
Timeout = 0
WasBenchmarked = $false
XProcess = $null
MinerPool = $_.MinerPool
Algo = $_.Algo
Bad_Benchmark = 0
FullName = $_.FullName
Instance = $null
InstanceNumber = $null
Username = $_.Username
Connection = $_.Connection
Password = $_.Password
BestMiner = $null
}
}
}
##Simple Switches For User Notification
$Restart = $false
$NoMiners = $false
$ActiveMinerPrograms | foreach {
if($BestMiners_Combo | Where Path -EQ $_.Path | Where Arguments -EQ $_.Arguments){$_.BestMiner = $true}
else{$_.BestMiner = $false}
}
##Close & Launch Miners
$ActiveMinerPrograms | foreach {
if($_.BestMiner -eq $false)
{
if($_.XProcess.HasExited){
if($_.Status -eq "Running"){
$_.Status = Failed""
}
}
else
{