Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPlusGH authored Jul 3, 2018
1 parent 6888ee4 commit 9b7a040
Show file tree
Hide file tree
Showing 12 changed files with 2,181 additions and 28 deletions.
13 changes: 12 additions & 1 deletion Algorithms.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"sha256t": "Sha256t",
"allium": "Allium",
"vit": "Vitalium",
"vitalium": "Vitalium",
"x16r": "X16r",
"x16s": "X16s",
"keccakc": "Keccakc",
Expand All @@ -13,6 +17,9 @@
"blakevanilla": "BlakeVanilla",
"c11": "C11",
"cryptonight": "CryptoNight",
"cryptonightV7": "CryptoNightV7",
"cryptonightheavy": "cryptonight-heavy",
"cryptonight-heavy": "cryptonight-heavy",
"daggerhashimoto": "Ethash",
"darkcoinmod": "X11",
"decred": "Decred",
Expand All @@ -22,6 +29,7 @@
"groestl": "Groestl",
"groestlcoin": "Groestl",
"hmq1725": "HMQ1725",
"hodl": "hodl",
"jha": "JHA",
"keccak": "Keccak",
"lbry": "Lbry",
Expand Down Expand Up @@ -59,5 +67,8 @@
"x17": "X17",
"xmr": "CryptoNight",
"yescrypt": "Yescrypt",
"yescryptr16": "YescryptR16",
"yescryptr32": "YescryptR32",
"yescryptr8": "YescryptR8",
"zuikkis": "Scrypt"
}
}
541 changes: 541 additions & 0 deletions Core.ps1

Large diffs are not rendered by default.

66 changes: 57 additions & 9 deletions EarningsTrackerJob.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
<#
This file is part of NPlusMiner
Copyright (c) 2018 MrPlus
NPlusMiner is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
NPlusMiner is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
#>

<#
Product: NPlusMiner
File: EarningsTrackerJob.ps1
version: 4.0
version date: 20180703
#>

# param(
# [Parameter(Mandatory=$false)]
# [String]$Pool = "ahashpool",
Expand All @@ -21,6 +46,9 @@
# To start the job one could use the following
# $job = Start-Job -FilePath .\EarningTrackerJob.ps1 -ArgumentList $params

# Remove progress info from job.childjobs.Progress to avoid memory leak
$ProgressPreference="SilentlyContinue"

# Set Process Priority
(Get-Process -Id $PID).PriorityClass = "BelowNormal"

Expand All @@ -31,7 +59,7 @@ sleep $StartDelay

if (-not $APIUri){
try {
$poolapi = Invoke-WebRequest "http://tiny.cc/l355qy" -UseBasicParsing -Headers @{"Cache-Control"="no-cache"} | ConvertFrom-Json} catch {$poolapi = Get-content ".\Config\poolapiref.json" | Convertfrom-json}
$poolapi = Invoke-WebRequest "http://tiny.cc/l355qy" -TimeoutSec 15 -UseBasicParsing -Headers @{"Cache-Control"="no-cache"} | ConvertFrom-Json} catch {$poolapi = Get-content ".\Config\poolapiref.json" | Convertfrom-json}
if ($poolapi -ne $null) {
$poolapi | ConvertTo-json | Out-File ".\Config\poolapiref.json"
If (($poolapi | ? {$_.Name -eq $pool}).EarnTrackSupport -eq "yes") {
Expand All @@ -50,15 +78,15 @@ while ($true) {
$CurDate = Get-Date
If ($Pool -eq "nicehash"){
try {
$BalanceData = Invoke-WebRequest ($APIUri+$Wallet) -UseBasicParsing -Headers @{"Cache-Control"="no-cache"} | ConvertFrom-Json } catch { }
if (-not $BalanceData.$BalanceJson) {$BalanceData | Add-Member -NotePropertyName $BalanceJson -NotePropertyValue ($BalanceData.result.Stats | measure -sum $BalanceJson).sum -Force}
if (-not $BalanceData.$TotalJson) {$BalanceData | Add-Member -NotePropertyName $TotalJson -NotePropertyValue ($BalanceData.result.Stats | measure -sum $BalanceJson).sum -Force}
$TempBalanceData = Invoke-WebRequest ($APIUri+$Wallet) -TimeoutSec 15 -UseBasicParsing -Headers @{"Cache-Control"="no-cache"} | ConvertFrom-Json } catch { }
if (-not $TempBalanceData.$BalanceJson) {$TempBalanceData | Add-Member -NotePropertyName $BalanceJson -NotePropertyValue ($TempBalanceData.result.Stats | measure -sum $BalanceJson).sum -Force}
if (-not $TempBalanceData.$TotalJson) {$TempBalanceData | Add-Member -NotePropertyName $TotalJson -NotePropertyValue ($TempBalanceData.result.Stats | measure -sum $BalanceJson).sum -Force}
} elseif ($Pool -eq "miningpoolhub") {
try {
$BalanceData = ((((Invoke-WebRequest ($APIUri+$Wallet) -UseBasicParsing -Headers @{"Cache-Control"="no-cache"}).content | ConvertFrom-Json).getuserallbalances).data | Where {$_.coin -eq "bitcoin"}) } catch { }#.confirmed
$TempBalanceData = ((((Invoke-WebRequest ($APIUri+$Wallet) -TimeoutSec 15 -UseBasicParsing -Headers @{"Cache-Control"="no-cache"}).content | ConvertFrom-Json).getuserallbalances).data | Where {$_.coin -eq "bitcoin"}) } catch { }#.confirmed
} else {
try {
$TempBalanceData = Invoke-WebRequest ($APIUri+$Wallet) -UseBasicParsing -Headers @{"Cache-Control"="no-cache"} | ConvertFrom-Json } catch { }
$TempBalanceData = Invoke-WebRequest ($APIUri+$Wallet) -TimeoutSec 15 -UseBasicParsing -Headers @{"Cache-Control"="no-cache"} | ConvertFrom-Json } catch { }
}
If ($TempBalanceData.$BalanceJson){$BalanceData = $TempBalanceData}

Expand All @@ -73,9 +101,27 @@ while ($true) {
}
$BalanceObject = $BalanceObjectS[$BalanceOjectS.Count-1]
If ((($CurDate - ($BalanceObjectS[0].Date)).TotalMinutes) -eq 0) {$CurDate = $CurDate.AddMinutes(1)}
$Growth1 = If ((($CurDate - ($BalanceObjectS[0].Date)).TotalHours) -ge 1) {$BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddHours(-1)}).total_earned | measure -Minimum).Minimum} Else {(($BalanceObject.total_earned - $BalanceObjectS[0].total_earned) / ($CurDate - ($BalanceObjectS[0].Date)).TotalMinutes)*60}
$Growth6 = If ((($CurDate - ($BalanceObjectS[0].Date)).TotalHours) -ge 6) {$BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddHours(-6)}).total_earned | measure -Minimum).Minimum} Else {$Growth1*6}
$Growth24 = If ((($CurDate - ($BalanceObjectS[0].Date)).TotalDays) -ge 1) {$BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddDays(-1)}).total_earned | measure -Minimum).Minimum} Else {$Growth1*24}



If ((($CurDate - ($BalanceObjectS[0].Date)).TotalDays) -ge 1) {
$Growth1 = $BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddHours(-1)}).total_earned | measure -Minimum).Minimum
$Growth6 = $BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddHours(-6)}).total_earned | measure -Minimum).Minimum
$Growth24 = $BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddDays(-1)}).total_earned | measure -Minimum).Minimum
}
If ((($CurDate - ($BalanceObjectS[0].Date)).TotalDays) -lt 1) {
$Growth1 = $BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddHours(-1)}).total_earned | measure -Minimum).Minimum
$Growth6 = $BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddHours(-6)}).total_earned | measure -Minimum).Minimum
$Growth24 = (($BalanceObject.total_earned - $BalanceObjectS[0].total_earned) / ($CurDate - ($BalanceObjectS[0].Date)).TotalHours)*24
}
If ((($CurDate - ($BalanceObjectS[0].Date)).TotalHours) -lt 6) {
$Growth1 = $BalanceObject.total_earned - (($BalanceObjectS | ? {$_.Date -ge $CurDate.AddHours(-1)}).total_earned | measure -Minimum).Minimum
$Growth6 = (($BalanceObject.total_earned - $BalanceObjectS[0].total_earned) / ($CurDate - ($BalanceObjectS[0].Date)).TotalHours)*6
}
If ((($CurDate - ($BalanceObjectS[0].Date)).TotalHours) -lt 1) {
$Growth1 = (($BalanceObject.total_earned - $BalanceObjectS[0].total_earned) / ($CurDate - ($BalanceObjectS[0].Date)).TotalMinutes)*60
}

$AvgBTCHour = If ((($CurDate - ($BalanceObjectS[0].Date)).TotalHours) -ge 1) {(($BalanceObject.total_earned - $BalanceObjectS[0].total_earned) / ($CurDate - ($BalanceObjectS[0].Date)).TotalHours)} else {$Growth1}
$EarningsObject = [PSCustomObject]@{
Pool = $pool
Expand All @@ -98,6 +144,7 @@ while ($true) {
EstimatedPayDate = if ($PaymentThreshold){IF ($BalanceObject.balance -lt $PaymentThreshold) {If ($AvgBTCHour -gt 0) {$CurDate.AddHours(($PaymentThreshold - $BalanceObject.balance) / $AvgBTCHour)} Else {"Unknown"}} else {"Next Payout !"}}else{"Unknown"}
TrustLevel = if(($CurDate - ($BalanceObjectS[0].Date)).TotalMinutes -le 360){($CurDate - ($BalanceObjectS[0].Date)).TotalMinutes/360}else{1}
PaymentThreshold = $PaymentThreshold
TotalHours = ($CurDate - ($BalanceObjectS[0].Date)).TotalHours
}

$EarningsObject
Expand All @@ -110,6 +157,7 @@ while ($true) {
# Results in showing bad negative earnings
# Detecting if current is more than 50% less than previous and reset history if so
If ($BalanceObject.total_earned -lt ($BalanceObjectS[$BalanceObjectS.Count-2].total_earned/2)){$BalanceObjectS=@();$BalanceObjectS += $BalanceObject}


# Sleep until next update based on $Interval. Modulo $Interval.
# Sleep (60*($Interval-((get-date).minute%$Interval))) # Changed to avoid pool API load.
Expand Down
Loading

0 comments on commit 9b7a040

Please sign in to comment.