From 1b2a4010ae9551ac096d1f069d434c6b2b0a33f7 Mon Sep 17 00:00:00 2001 From: MaynardMiner <38481606+MaynardMiner@users.noreply.github.com> Date: Sun, 4 Aug 2019 22:56:34 -0400 Subject: [PATCH] all pools updated --- algopools/ahashpool.ps1 | 117 +++++----- algopools/blazepool.ps1 | 112 +++++----- algopools/blockmasters.ps1 | 173 +++++++-------- algopools/fairpool.ps1 | 126 ++++++----- algopools/hashrefinery.ps1 | 121 ++++++----- algopools/nicehash.ps1 | 2 - algopools/nlpool.ps1 | 175 ++++++++------- algopools/zergpool.ps1 | 168 +++++++-------- algopools/zpool.ps1 | 189 ++++++++-------- build/powershell/background/initial.psm1 | 5 +- build/powershell/global/stats.psm1 | 6 +- build/powershell/miner/gather.psm1 | 2 +- build/powershell/pool/gather.psm1 | 49 +---- coinpools/zergpool.ps1 | 247 +++++++++------------ coinpools/zpool.ps1 | 260 ++++++++++------------- config/parameters/default.json | 3 +- config/pools/pool-algos.json | 10 +- custompools/whalesburg.ps1 | 5 +- 18 files changed, 833 insertions(+), 937 deletions(-) diff --git a/algopools/ahashpool.ps1 b/algopools/ahashpool.ps1 index 3e5dd5720..90328cb08 100755 --- a/algopools/ahashpool.ps1 +++ b/algopools/ahashpool.ps1 @@ -1,74 +1,73 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$ahashpool_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true; -$Shuffle = 0; -$SmallestValue = 1E-20 +$Pool_Request = [PSCustomObject]@{ } -if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } +if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } if ($Name -in $(arg).PoolName) { - try { $ahashpool_Request = Invoke-RestMethod "https://www.ahashpool.com/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "https://www.ahashpool.com/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - if (($ahashpool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." return } - - $ahashpool_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$ahashpool_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $ahashpool_Request.$_.name.ToLower(); - $local:ahashpool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $ahashpool_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $ahashpool_Algorithm -or $(arg).ASIC_ALGO -contains $ahashpool_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$ahashpool_Algorithm.exclusions -and $ahashpool_Algorithm -notin $(vars).BanHammer) { - - $StatAlgo = $ahashpool_Algorithm -replace "`_", "`-" - $Estimate = [Double]$ahashpool_Request.$_.estimate_current - - if ($(arg).mode -eq "easy") { - if( $ahashpool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $ahashpool_Request.$_.estimate_current $ahashpool_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} - $ahashpool_Host = "$_.mine.ahashpool.com$X" - $ahashpool_Port = $ahashpool_Request.$_.port - $Divisor = 1000000 * $ahashpool_Request.$_.mbtc_mh_factor - $Hashrate = $ahashpool_Request.$_.hashrate - $previous = [Math]::Max(([Double]$ahashpool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($ahashpool_Request.$_.fees / 100)),$SmallestValue) + $Algos = @() + $Algos += $(vars).Algorithm + $Algos += $(arg).ASIC_ALGO + $Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($ahashpool_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$ahashpool_Algorithm) { $(vars).Pool_Hashrates.Add("$ahashpool_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$ahashpool_Algorithm.$Name) { $(vars).Pool_Hashrates.$ahashpool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } - - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } - [PSCustomObject]@{ - Symbol = "$ahashpool_Algorithm-Algo" - Algorithm = $ahashpool_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $ahashpool_Host - Port = $ahashpool_Port - User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" - Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" - Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $Previous - } - } + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h + $_ | Add-Member "deviation" $Raw + } + + $Pool_Sorted | ForEach-Object { + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } + else { $Estimate = [Double]$_.estimate_current } + + $Pool_Port = $_.port + $Pool_Host = "$($_.Original_Algo).mine.ahashpool.com$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $Hashrate = $_.hashrate_shared + $previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) + + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} + + $Level = $Stat.$($(arg).Stat_Algo) + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } + + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" + Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" + Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" + Previous = $previous } } -} +} \ No newline at end of file diff --git a/algopools/blazepool.ps1 b/algopools/blazepool.ps1 index 326864896..7b1a6cb01 100755 --- a/algopools/blazepool.ps1 +++ b/algopools/blazepool.ps1 @@ -1,74 +1,74 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$blazepool_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true +$Pool_Request = [PSCustomObject]@{ } - -if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} +if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } if ($Name -in $(arg).PoolName) { - try { $blazepool_Request = Invoke-RestMethod "http://api.blazepool.com/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "http://api.blazepool.com/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - if (($blazepool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." return - } - - $blazepool_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$blazepool_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $blazepool_Request.$_.name.ToLower(); - $local:blazepool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $blazepool_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $blazepool_Algorithm -or $(arg).ASIC_ALGO -contains $blazepool_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$blazepool_Algorithm.exclusions -and $blazepool_Algorithm -notin $(vars).BanHammer) { + } + + $PoolAlgos = @() + $PoolAlgos += $(vars).Algorithm + $PoolAlgos += $(arg).ASIC_ALGO + $Algos = $PoolAlgos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } + + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } - $StatAlgo = $blazepool_Algorithm -replace "`_", "`-" - $Estimate = [Double]$blazepool_Request.$_.estimate_current + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h + $_ | Add-Member "deviation" $Raw + } - if ($(arg).mode -eq "easy") { - if( $blazepool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $blazepool_Request.$_.estimate_current $blazepool_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} + $Pool_Sorted | ForEach-Object { - $blazepool_Host = "$_.mine.blazepool.com$X" - $blazepool_Port = $blazepool_Request.$_.port - $Divisor = 1000000 * $blazepool_Request.$_.mbtc_mh_factor - $Hashrate = $blazepool_Request.$_.hashrate - $previous = [Math]::Max(([Double]$blazepool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($blazepool_Request.$_.fees / 100)),$SmallestValue) + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } + else { $Estimate = [Double]$_.estimate_current } + + $Pool_Port = $_.port + $Pool_Host = "$($_.Original_Algo).mine.blazepool.com$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $Hashrate = $_.hashrate + $previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($blazepool_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$blazepool_Algorithm) { $(vars).Pool_Hashrates.Add("$blazepool_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$blazepool_Algorithm.$Name) { $(vars).Pool_Hashrates.$blazepool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $SmallestValue = 1E-20 - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } + $Level = $Stat.$($(arg).Stat_Algo) + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } - [PSCustomObject]@{ - Symbol = "$blazepool_Algorithm-Algo" - Algorithm = $blazepool_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $blazepool_Host - Port = $blazepool_Port - User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" - Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" - Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $previous - } - } + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" + Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" + Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" + Previous = $previous } } } \ No newline at end of file diff --git a/algopools/blockmasters.ps1 b/algopools/blockmasters.ps1 index 97efe76a7..1ca608323 100755 --- a/algopools/blockmasters.ps1 +++ b/algopools/blockmasters.ps1 @@ -1,109 +1,110 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$blockpool_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true +$Pool_Request = [PSCustomObject]@{ } -if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} +if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } if ($Name -in $(arg).PoolName) { - try { $blockpool_Request = Invoke-RestMethod "http://blockmasters.co/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "http://blockmasters.co/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - if (($blockpool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." return - } + } + + $PoolAlgos = @() + $PoolAlgos += $(vars).Algorithm + $PoolAlgos += $(arg).ASIC_ALGO + $Algos = $PoolAlgos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } + + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h + $_ | Add-Member "deviation" $Raw + } + Switch ($(arg).Location) { "US" { $Region = $null } default { $Region = "eu." } } - - $blockpool_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$blockpool_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $blockpool_Request.$_.name.ToLower(); - $local:blockpool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $blockpool_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $blockpool_Algorithm -or $(arg).ASIC_ALGO -contains $blockpool_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$blockpool_Algorithm.exclusions -and $blockpool_Algorithm -notin $(vars).BanHammer) { - - $StatAlgo = $blockpool_Algorithm -replace "`_", "`-" - $Estimate = [Double]$blockpool_Request.$_.estimate_current - if ($(arg).mode -eq "easy") { - if( $blockpool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $blockpool_Request.$_.estimate_current $blockpool_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} + $Pool_Sorted | ForEach-Object { - $blockpool_Host = "$($Region)blockmasters.co$X" - $blockpool_Port = $blockpool_Request.$_.port - $Divisor = 1000000 * $blockpool_Request.$_.mbtc_mh_factor - $Hashrate = $blockpool_Request.$_.hashrate - $previous = [Math]::Max(([Double]$blockpool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($blockpool_Request.$_.fees / 100)),$SmallestValue) + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } + else { $Estimate = [Double]$_.estimate_current } + + $Pool_Port = $_.port + $Pool_Host = "$($Region)blockmasters.co$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $Hashrate = $_.hashrate + $previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($blockpool_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$blockpool_Algorithm) { $(vars).Pool_Hashrates.Add("$blockpool_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$blockpool_Algorithm.$Name) { $(vars).Pool_Hashrates.$blockpool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } - - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $SmallestValue = 1E-20 - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} + + $Level = $Stat.$($(arg).Stat_Algo) + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } - $Pass1 = $global:Wallets.Wallet1.Keys - $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - $Pass2 = $global:Wallets.Wallet2.Keys - $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - $Pass3 = $global:Wallets.Wallet3.Keys - $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - - if ($global:Wallets.AltWallet1.keys) { - $global:Wallets.AltWallet1.Keys | ForEach-Object { - if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { - $Pass1 = $_; - $User1 = $global:Wallets.AltWallet1.$_.address; - } - } - } - if ($global:Wallets.AltWallet2.keys) { - $global:Wallets.AltWallet2.Keys | ForEach-Object { - if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { - $Pass2 = $_; - $User2 = $global:Wallets.AltWallet2.$_.address; - } - } + $Pass1 = $global:Wallets.Wallet1.Keys + $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + $Pass2 = $global:Wallets.Wallet2.Keys + $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + $Pass3 = $global:Wallets.Wallet3.Keys + $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + + if ($global:Wallets.AltWallet1.keys) { + $global:Wallets.AltWallet1.Keys | ForEach-Object { + if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { + $Pass1 = $_; + $User1 = $global:Wallets.AltWallet1.$_.address; } - if ($global:Wallets.AltWallet3.keys) { - $global:Wallets.AltWallet3.Keys | ForEach-Object { - if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { - $Pass3 = $_; - $User3 = $global:Wallets.AltWallet3.$_.address; - } - } + } + } + if ($global:Wallets.AltWallet2.keys) { + $global:Wallets.AltWallet2.Keys | ForEach-Object { + if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { + $Pass2 = $_; + $User2 = $global:Wallets.AltWallet2.$_.address; } - - [PSCustomObject]@{ - Symbol = "$blockpool_Algorithm-Algo" - Algorithm = $blockpool_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $blockpool_Host - Port = $blockpool_Port - User1 = $User1 - User2 = $User2 - User3 = $User3 - Pass1 = "c=$Pass1,id=$($(arg).RigName1)" - Pass2 = "c=$Pass2,id=$($(arg).RigName2)" - Pass3 = "c=$Pass3,id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $previous + } + } + if ($global:Wallets.AltWallet3.keys) { + $global:Wallets.AltWallet3.Keys | ForEach-Object { + if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { + $Pass3 = $_; + $User3 = $global:Wallets.AltWallet3.$_.address; } } } + + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $User1 + User2 = $User2 + User3 = $User3 + Pass1 = "c=$Pass1,id=$($(arg).RigName1)" + Pass2 = "c=$Pass2,id=$($(arg).RigName2)" + Pass3 = "c=$Pass3,id=$($(arg).RigName3)" + Previous = $previous + } } -} +} \ No newline at end of file diff --git a/algopools/fairpool.ps1 b/algopools/fairpool.ps1 index 2070d10f8..b7f759e37 100755 --- a/algopools/fairpool.ps1 +++ b/algopools/fairpool.ps1 @@ -1,79 +1,77 @@ - $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$fairpool_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true +$Pool_Request = [PSCustomObject]@{ } + +if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } -if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} - if ($Name -in $(arg).PoolName) { - try { $fairpool_Request = Invoke-RestMethod "https://fairpool.pro/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "https://fairpool.pro/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - if (($fairpool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." return } + $Algos = @() + $Algos += $(vars).Algorithm + $Algos += $(arg).ASIC_ALGO + $Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } + + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } + + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h + $_ | Add-Member "deviation" $Raw + } + Switch ($(arg).Location) { "US" { $Region = "us1.fairpool.pro" } default { $Region = "eu1.fairpool.pro" } - } + } - $fairpool_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$fairpool_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $fairpool_Request.$_.name.ToLower(); - $local:fairpool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $fairpool_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $fairpool_Algorithm -or $(arg).ASIC_ALGO -contains $fairpool_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$fairpool_Algorithm.exclusions -and $fairpool_Algorithm -notin $(vars).BanHammer) { - - $StatAlgo = $fairpool_Algorithm -replace "`_", "`-" - $Estimate = [Double]$fairpool_Request.$_.estimate_current - - if ($(arg).mode -eq "easy") { - if( $fairpool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $fairpool_Request.$_.estimate_current $fairpool_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} - - - $fairpool_Host = "$region$X" - $fairpool_Port = $fairpool_Request.$_.port - $Divisor = 1000000 * $fairpool_Request.$_.mbtc_mh_factor - $Hashrate = $fairpool_Request.$_.hashrate - $previous = [Math]::Max(([Double]$fairpool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($fairpool_Request.$_.fees / 100)),$SmallestValue) - - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($fairpool_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$fairpool_Algorithm) { $(vars).Pool_Hashrates.Add("$fairpool_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$fairpool_Algorithm.$Name) { $(vars).Pool_Hashrates.$fairpool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } - - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $SmallestValue = 1E-20 - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } - - [PSCustomObject]@{ - Symbol = "$fairpool_Algorithm-Algo" - Algorithm = $fairpool_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $fairpool_Host - Port = $fairpool_Port - User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" - Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" - Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $previous - } - } + $Pool_Sorted | ForEach-Object { + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } + else { $Estimate = [Double]$_.estimate_current } + + $Pool_Port = $_.port + $Pool_Host = "$region$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $Hashrate = $_.hashrate_shared + $previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) + + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} + + $Level = $Stat.$($(arg).Stat_Algo) + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } + + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" + Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" + Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" + Previous = $previous } } -} +} \ No newline at end of file diff --git a/algopools/hashrefinery.ps1 b/algopools/hashrefinery.ps1 index fc382c59f..a34588dd2 100755 --- a/algopools/hashrefinery.ps1 +++ b/algopools/hashrefinery.ps1 @@ -1,73 +1,72 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$Hashrefinery_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true +$Pool_Request = [PSCustomObject]@{ } + +if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } -if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} - if ($Name -in $(arg).PoolName) { - try { $Hashrefinery_Request = Invoke-RestMethod "http://pool.hashrefinery.com/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "http://pool.hashrefinery.com/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - - if (($Hashrefinery_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." return - } - - $Hashrefinery_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$Hashrefinery_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $Hashrefinery_Request.$_.name.ToLower(); - $local:Hashrefinery_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $Hashrefinery_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $Hashrefinery_Algorithm -or $(arg).ASIC_ALGO -contains $Hashrefinery_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$Hashrefinery_Algorithm.exclusions -and $Hashrefinery_Algorithm -notin $(vars).BanHammer) { - - $StatAlgo = $Hashrefinery_Algorithm -replace "`_", "`-" - $Estimate = [Double]$Hashrefinery_Request.$_.estimate_current - - if ($(arg).mode -eq "easy") { - if( $Hashrefinery_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $Hashrefinery_Request.$_.estimate_current $Hashrefinery_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} + } - $Hashrefinery_Host = "$_.us.hashrefinery.com$X" - $Hashrefinery_Port = $Hashrefinery_Request.$_.port - $Divisor = 1000000 * $Hashrefinery_Request.$_.mbtc_mh_factor - $Hashrate = $Hashrefinery_Request.$_.hashrate - $previous = [Math]::Max(([Double]$Hashrefinery_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($Hashrefinery_Request.$_.fees / 100)),$SmallestValue) + $Algos = @() + $Algos += $(vars).Algorithm + $Algos += $(arg).ASIC_ALGO + $Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($Hashrefinery_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$Hashrefinery_Algorithm) { $(vars).Pool_Hashrates.Add("$Hashrefinery_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$Hashrefinery_Algorithm.$Name) { $(vars).Pool_Hashrates.$Hashrefinery_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $SmallestValue = 1E-20 - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h + $_ | Add-Member "deviation" $Raw + } - [PSCustomObject]@{ - Symbol = "$Hashrefinery_Algorithm-Algo" - Algorithm = $Hashrefinery_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $Hashrefinery_Host - Port = $Hashrefinery_Port - User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" - Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" - Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $Previous - } - } + $Pool_Sorted | ForEach-Object { + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } + else { $Estimate = [Double]$_.estimate_current } + + $Pool_Port = $_.port + $Pool_Host = "$($_.Original_Algo).us.hashrefinery.com$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $Hashrate = $_.hashrate_shared + $previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) + + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} + + $Level = $Stat.$($(arg).Stat_Algo) + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } + + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" + Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" + Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" + Previous = $previous } } -} - +} \ No newline at end of file diff --git a/algopools/nicehash.ps1 b/algopools/nicehash.ps1 index 12368df8b..ff6b04b52 100755 --- a/algopools/nicehash.ps1 +++ b/algopools/nicehash.ps1 @@ -1,7 +1,6 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName $nicehash_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true ## Make a Port map so I don't have to pull from nicehash twice $Nicehash_Ports = @@ -101,7 +100,6 @@ if ($Name -in $(arg).PoolName) { Pass1 = "x" Pass2 = "x" Pass3 = "x" - Meets_Threshold = $Meets_Threshold Previous = $Previous } } diff --git a/algopools/nlpool.ps1 b/algopools/nlpool.ps1 index 87b278e93..f75505bdb 100755 --- a/algopools/nlpool.ps1 +++ b/algopools/nlpool.ps1 @@ -1,106 +1,105 @@ -$Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$nlpool_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true +$Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName +$Pool_Request = [PSCustomObject]@{ } -if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} +if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } if ($Name -in $(arg).PoolName) { - try { $nlpool_Request = Invoke-RestMethod "https://nlpool.nl/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "https://nlpool.nl/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - - if (($nlpool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." - return + return } - $nlpool_Request.PSObject.Properties.Value | % { $_.estimate_current = [Decimal]$_.estimate_current } + $Algos = @() + $Algos += $(vars).Algorithm + $Algos += $(arg).ASIC_ALGO + $Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } - $nlpool_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$nlpool_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $nlpool_Request.$_.name.ToLower(); - $local:nlpoolAlgo_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $nlpoolAlgo_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $nlpoolAlgo_Algorithm -or $(arg).ASIC_ALGO -contains $nlpoolAlgo_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$nlpoolAlgo_Algorithm.exclusions -and $nlpoolAlgo_Algorithm -notin $(vars).BanHammer) { - - $StatAlgo = $nlpoolAlgo_Algorithm -replace "`_", "`-" - $Estimate = [Double]$nlpool_Request.$_.estimate_current - - if ($(arg).mode -eq "easy") { - if( $nlpool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $nlpool_Request.$_.estimate_current $nlpool_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} - - $nlpoolAlgo_Host = "mine.nlpool.nl$X" - $nlpoolAlgo_Port = $nlpool_Request.$_.port - $Divisor = 1000000 * $nlpool_Request.$_.mbtc_mh_factor - $Hashrate = $nlpool_Request.$_.hashrate - $previous = [Math]::Max(([Double]$nlpool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($nlpool_Request.$_.fees / 100)),$SmallestValue) + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($nlpool_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$nlpoolAlgo_Algorithm) { $(vars).Pool_Hashrates.Add("$nlpoolAlgo_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$nlpoolAlgo_Algorithm.$Name) { $(vars).Pool_Hashrates.$nlpoolAlgo_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h + $_ | Add-Member "deviation" $Raw + } - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $SmallestValue = 1E-20 - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } + $Pool_Sorted | ForEach-Object { + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } + else { $Estimate = [Double]$_.estimate_current } + + $Pool_Port = $_.port + $Pool_Host = "mine.nlpool.nl$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $Hashrate = $_.hashrate_shared + $previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) + + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} - $Pass1 = $global:Wallets.Wallet1.Keys - $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - $Pass2 = $global:Wallets.Wallet2.Keys - $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - $Pass3 = $global:Wallets.Wallet3.Keys - $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + $Level = $Stat.$($(arg).Stat_Algo) + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } - if ($global:Wallets.AltWallet1.keys) { - $global:Wallets.AltWallet1.Keys | ForEach-Object { - if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { - $Pass1 = $_; - $User1 = $global:Wallets.AltWallet1.$_.address; - } - } - } - if ($global:Wallets.AltWallet2.keys) { - $global:Wallets.AltWallet2.Keys | ForEach-Object { - if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { - $Pass2 = $_; - $User2 = $global:Wallets.AltWallet2.$_.address; - } - } + $Pass1 = $global:Wallets.Wallet1.Keys + $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + $Pass2 = $global:Wallets.Wallet2.Keys + $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + $Pass3 = $global:Wallets.Wallet3.Keys + $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + + if ($global:Wallets.AltWallet1.keys) { + $global:Wallets.AltWallet1.Keys | ForEach-Object { + if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { + $Pass1 = $_; + $User1 = $global:Wallets.AltWallet1.$_.address; } - if ($global:Wallets.AltWallet3.keys) { - $global:Wallets.AltWallet3.Keys | ForEach-Object { - if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { - $Pass3 = $_; - $User3 = $global:Wallets.AltWallet3.$_.address; - } - } + } + } + if ($global:Wallets.AltWallet2.keys) { + $global:Wallets.AltWallet2.Keys | ForEach-Object { + if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { + $Pass2 = $_; + $User2 = $global:Wallets.AltWallet2.$_.address; } - - [PSCustomObject]@{ - Symbol = "$nlpoolAlgo_Algorithm-Algo" - Algorithm = $nlpoolAlgo_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $nlpoolAlgo_Host - Port = $nlpoolAlgo_Port - User1 = $User1 - User2 = $User2 - User3 = $User3 - Pass1 = "c=$Pass1,id=$($(arg).RigName1)" - Pass2 = "c=$Pass2,id=$($(arg).RigName2)" - Pass3 = "c=$Pass3,id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $previous + } + } + if ($global:Wallets.AltWallet3.keys) { + $global:Wallets.AltWallet3.Keys | ForEach-Object { + if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { + $Pass3 = $_; + $User3 = $global:Wallets.AltWallet3.$_.address; } } } + + + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" + Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" + Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" + Previous = $previous + } } -} +} \ No newline at end of file diff --git a/algopools/zergpool.ps1 b/algopools/zergpool.ps1 index 5d9835dcf..4bcd945c3 100755 --- a/algopools/zergpool.ps1 +++ b/algopools/zergpool.ps1 @@ -1,107 +1,107 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$Zergpool_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true +$Pool_Request = [PSCustomObject]@{ } if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } if ($Name -in $(arg).PoolName) { - try { $Zergpool_Request = Invoke-RestMethod "http://api.zergpool.com:8080/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "http://api.zergpool.com:8080/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - if (($Zergpool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." return } - - $Zergpool_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$Zergpool_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $Zergpool_Request.$_.name.ToLower(); - $local:Zergpool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $Zergpool_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $Zergpool_Algorithm -or $(arg).ASIC_ALGO -contains $Zergpool_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$Zergpool_Algorithm.exclusions -and $Zergpool_Algorithm -notin $(vars).BanHammer) { + $Algos = @() + $Algos += $(vars).Algorithm + $Algos += $(arg).ASIC_ALGO + $Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } - $StatAlgo = $Zergpool_Algorithm -replace "`_", "`-" - $Estimate = [Double]$Zergpool_Request.$_.estimate_current + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } + + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h_shared + $_ | Add-Member "deviation" $Raw + } - if ($(arg).mode -eq "easy") { - if( $Zergpool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $Zergpool_Request.$_.estimate_current $Zergpool_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} + $Pool_Sorted | ForEach-Object { + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if(-not (test-Path ".\stats\$StatPath") ){ $Estimate = [Double]$_.estimate_last24h } + else{ $Estimate = [Double]$_.estimate_current } - $Zergpool_Port = $Zergpool_Request.$_.port - $Zergpool_Host = "$($Zergpool_Request.$_.name.ToLower()).mine.zergpool.com$X" - $Divisor = 1000000 * $Zergpool_Request.$_.mbtc_mh_factor - $(vars).divisortable.zergpool.Add($Zergpool_Algorithm, $Zergpool_Request.$_.mbtc_mh_factor) - $(vars).FeeTable.zergpool.Add($Zergpool_Algorithm, $Zergpool_Request.$_.fees) - $Hashrate = $Zergpool_Request.$_.hashrate_shared - $previous = [Math]::Max(([Double]$Zergpool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($Zergpool_Request.$_.fees / 100)),$SmallestValue) + $Pool_Port = $_.port + $Pool_Host = "$($_.Original_Algo.ToLower()).mine.zergpool.com$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $(vars).divisortable.zergpool.Add($_.Name, $_.mbtc_mh_factor) + $(vars).FeeTable.zergpool.Add($_.Name, $_.fees) + $Hashrate = $_.hashrate_shared + $previous = [Math]::Max(([Double]$_.actual_last24h_shared * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($Zergpool_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$Zergpool_Algorithm) { $(vars).Pool_Hashrates.Add("$Zergpool_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$Zergpool_Algorithm.$Name) { $(vars).Pool_Hashrates.$Zergpool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $SmallestValue = 1E-20 - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } + $Level = $Stat.$($(arg).Stat_Algo) + + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } - $Pass1 = $global:Wallets.Wallet1.Keys - $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - $Pass2 = $global:Wallets.Wallet2.Keys - $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - $Pass3 = $global:Wallets.Wallet3.Keys - $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + $Pass1 = $global:Wallets.Wallet1.Keys + $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + $Pass2 = $global:Wallets.Wallet2.Keys + $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + $Pass3 = $global:Wallets.Wallet3.Keys + $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - if ($global:Wallets.AltWallet1.keys) { - $global:Wallets.AltWallet1.Keys | ForEach-Object { - if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { - $Pass1 = $_; - $User1 = $global:Wallets.AltWallet1.$_.address; - } - } - } - if ($global:Wallets.AltWallet2.keys) { - $global:Wallets.AltWallet2.Keys | ForEach-Object { - if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { - $Pass2 = $_; - $User2 = $global:Wallets.AltWallet2.$_.address; - } - } - } - if ($global:Wallets.AltWallet3.keys) { - $global:Wallets.AltWallet3.Keys | ForEach-Object { - if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { - $Pass3 = $_; - $User3 = $global:Wallets.AltWallet3.$_.address; - } - } - } - - [PSCustomObject]@{ - Symbol = "$Zergpool_Algorithm-Algo" - Algorithm = $Zergpool_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $Zergpool_Host - Port = $Zergpool_Port - User1 = $User1 - User2 = $User2 - User3 = $User3 - Pass1 = "c=$Pass1,id=$($(arg).RigName1)" - Pass2 = "c=$Pass2,id=$($(arg).RigName2)" - Pass3 = "c=$Pass3,id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $previous + if ($global:Wallets.AltWallet1.keys) { + $global:Wallets.AltWallet1.Keys | ForEach-Object { + if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { + $Pass1 = $_; + $User1 = $global:Wallets.AltWallet1.$_.address; + } + } + } + if ($global:Wallets.AltWallet2.keys) { + $global:Wallets.AltWallet2.Keys | ForEach-Object { + if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { + $Pass2 = $_; + $User2 = $global:Wallets.AltWallet2.$_.address; } } } + if ($global:Wallets.AltWallet3.keys) { + $global:Wallets.AltWallet3.Keys | ForEach-Object { + if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { + $Pass3 = $_; + $User3 = $global:Wallets.AltWallet3.$_.address; + } + } + } + + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $User1 + User2 = $User2 + User3 = $User3 + Pass1 = "c=$Pass1,id=$($(arg).RigName1)" + Pass2 = "c=$Pass2,id=$($(arg).RigName2)" + Pass3 = "c=$Pass3,id=$($(arg).RigName3)" + Previous = $previous + } } } diff --git a/algopools/zpool.ps1 b/algopools/zpool.ps1 index 3d2679c15..b88a7b07d 100755 --- a/algopools/zpool.ps1 +++ b/algopools/zpool.ps1 @@ -1,114 +1,111 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$Zpool_Request = [PSCustomObject]@{ } -$Meets_Threshold = $true +$Pool_Request = [PSCustomObject]@{ } + +if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } -if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} - if ($Name -in $(arg).PoolName) { - try { $Zpool_Request = Invoke-RestMethod "http://www.zpool.ca/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + try { $Pool_Request = Invoke-RestMethod "http://www.zpool.ca/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) but there was no response."; return } - - if (($Zpool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { + + if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { log "SWARM contacted ($Name) but ($Name) the response was empty." - return - } - - Switch ($(arg).Location) { - "US" { $region = "na" } - "EUROPE" { $region = "eu" } - "ASIA" { $region = "sea" } + return } - - $Zpool_Request | - Get-Member -MemberType NoteProperty -ErrorAction Ignore | - Select-Object -ExpandProperty Name | - Where-Object { [Double]$Zpool_Request.$_.estimate_current -gt 0 } | - Where-Object { - $Algo = $Zpool_Request.$_.name.ToLower(); - $local:Zpool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } - return $Zpool_Algorithm - } | - ForEach-Object { - if ($(vars).Algorithm -contains $Zpool_Algorithm -or $(arg).ASIC_ALGO -contains $Zpool_Algorithm) { - if ($Name -notin $global:Config.Pool_Algos.$Zpool_Algorithm.exclusions -and $Zpool_Algorithm -notin $(vars).BanHammer) { - $StatAlgo = $Zpool_Algorithm -replace "`_", "`-" - $StatPath = ".\stats\($Name)_$($StatAlgo)_profit.txt" - if(Test-Path $StatPath) { $Estimate = [Double]$Zpool_Request.$_.estimate_current } - $Estimate = [Double]$Zpool_Request.$_.estimate_current + $Algos = @() + $Algos += $(vars).Algorithm + $Algos += $(arg).ASIC_ALGO + $Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } - if ($(arg).mode -eq "easy") { - if( $Zpool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} - $Shuffle = Shuffle $Zpool_Request.$_.estimate_current $Zpool_Request.$_.actual_last24h - } else {$Meets_Threshold = $true} + ## Only get algos we need & convert name to universal schema + $Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { + $N = $_.Name; + $_ | Add-Member "Original_Algo" $N + $_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; + if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } + } - $Zpool_Port = $Zpool_Request.$_.port - $Zpool_Host = "$($Zpool_Request.$_.name.ToLower()).$($region).mine.zpool.ca$X" - $Divisor = 1000000 * $Zpool_Request.$_.mbtc_mh_factor - $(vars).divisortable.zpool.Add($Zpool_Algorithm, $Zpool_Request.$_.mbtc_mh_factor) - $(vars).FeeTable.zpool.Add($Zpool_Algorithm, $Zpool_Request.$_.fees) - $Hashrate = $zpool_Request.$_.hashrate_shared - $previous = [Math]::Max(([Double]$zpool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($zpool_Request.$_.fees / 100)),$SmallestValue) + ## Add 24 hour deviation. + $Pool_Sorted | ForEach-Object { + $Raw = shuffle $_.estimate_last24h $_.actual_last24h + $_ | Add-Member "deviation" $Raw + } + + Switch ($(arg).Location) { + "US" { $region = "na" } + "EUROPE" { $region = "eu" } + "ASIA" { $region = "sea" } + } - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($Zpool_Request.$_.fees / 100))) -Shuffle $Shuffle - if (-not $(vars).Pool_Hashrates.$Zpool_Algorithm) { $(vars).Pool_Hashrates.Add("$Zpool_Algorithm", @{ }) } - if (-not $(vars).Pool_Hashrates.$Zpool_Algorithm.$Name) { $(vars).Pool_Hashrates.$Zpool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } + $Pool_Sorted | ForEach-Object { + $StatAlgo = $_.Name -replace "`_", "`-" + $StatPath = "$($Name)_$($StatAlgo)_profit" + if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } + else { $Estimate = [Double]$_.estimate_current } + + $Pool_Port = $_.port + $Pool_Host = "$($_.Original_Algo).$($region).mine.zpool.ca$X" + $Divisor = 1000000 * $_.mbtc_mh_factor + $Hashrate = $_.hashrate_shared + $previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) + + $Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation + if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } + if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} + + $Level = $Stat.$($(arg).Stat_Algo) + if ($(arg).mode -eq "easy") { + $SmallestValue = 1E-20 + $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) + } - $Level = $Stat.$($(arg).Stat_Algo) - if($(arg).mode -eq "easy") { - $SmallestValue = 1E-20 - $Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) - } - - $Pass1 = $global:Wallets.Wallet1.Keys - $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - $Pass2 = $global:Wallets.Wallet2.Keys - $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - $Pass3 = $global:Wallets.Wallet3.Keys - $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + $Pass1 = $global:Wallets.Wallet1.Keys + $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + $Pass2 = $global:Wallets.Wallet2.Keys + $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + $Pass3 = $global:Wallets.Wallet3.Keys + $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - if ($global:Wallets.AltWallet1.keys) { - $global:Wallets.AltWallet1.Keys | ForEach-Object { - if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { - $Pass1 = $_; - $User1 = $global:Wallets.AltWallet1.$_.address; - } - } - } - if ($global:Wallets.AltWallet2.keys) { - $global:Wallets.AltWallet2.Keys | ForEach-Object { - if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { - $Pass2 = $_; - $User2 = $global:Wallets.AltWallet2.$_.address; - } - } + if ($global:Wallets.AltWallet1.keys) { + $global:Wallets.AltWallet1.Keys | ForEach-Object { + if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { + $Pass1 = $_; + $User1 = $global:Wallets.AltWallet1.$_.address; } - if ($global:Wallets.AltWallet3.keys) { - $global:Wallets.AltWallet3.Keys | ForEach-Object { - if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { - $Pass3 = $_; - $User3 = $global:Wallets.AltWallet3.$_.address; - } - } + } + } + if ($global:Wallets.AltWallet2.keys) { + $global:Wallets.AltWallet2.Keys | ForEach-Object { + if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { + $Pass2 = $_; + $User2 = $global:Wallets.AltWallet2.$_.address; } - - [PSCustomObject]@{ - Symbol = "$Zpool_Algorithm-Algo" - Algorithm = $Zpool_Algorithm - Price = $Level - Protocol = "stratum+tcp" - Host = $Zpool_Host - Port = $Zpool_Port - User1 = $User1 - User2 = $User2 - User3 = $User3 - Pass1 = "c=$Pass1,id=$($(arg).RigName1)" - Pass2 = "c=$Pass2,id=$($(arg).RigName2)" - Pass3 = "c=$Pass3,id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - Previous = $previous + } + } + if ($global:Wallets.AltWallet3.keys) { + $global:Wallets.AltWallet3.Keys | ForEach-Object { + if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { + $Pass3 = $_; + $User3 = $global:Wallets.AltWallet3.$_.address; } } } + + + [PSCustomObject]@{ + Symbol = "$($_.Name)-Algo" + Algorithm = "$($_.Name)" + Price = $Level + Protocol = "stratum+tcp" + Host = $Pool_Host + Port = $Pool_Port + User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" + Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" + Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" + Previous = $previous + } } -} +} \ No newline at end of file diff --git a/build/powershell/background/initial.psm1 b/build/powershell/background/initial.psm1 index d0029b879..f8fa29712 100755 --- a/build/powershell/background/initial.psm1 +++ b/build/powershell/background/initial.psm1 @@ -18,10 +18,13 @@ function Global:Invoke-MinerCheck { $global:StartTime = Get-Date Write-Host "Waiting for all miners to launch `n" $Check = $false; + $Time = 0 do{ $check = Test-Path ".\build\pid\start.txt"; start-sleep -S 1 - }while($check -eq $false) + $Time++ + if($Time -gt 29){$check = $true} + }Until($check -eq $true) } } diff --git a/build/powershell/global/stats.psm1 b/build/powershell/global/stats.psm1 index e6462290b..c1748f261 100755 --- a/build/powershell/global/stats.psm1 +++ b/build/powershell/global/stats.psm1 @@ -17,7 +17,11 @@ function Global:Start-Shuffle($X, $Y) { $X = [Double]$X * 1000 $Z = [Double]$Y - $X $X = [math]::Round( ($Z / $X) , 4) - if($X -gt 0.50) { $X = 0.50 } + if($X -gt 0.30){$X = 0.30} + if($X -lt -0.30){ + if($X -le -1){ $X = -1 } + else{ $X = -0.30 } + } return $X } diff --git a/build/powershell/miner/gather.psm1 b/build/powershell/miner/gather.psm1 index a8aed47e8..f1d60e45d 100755 --- a/build/powershell/miner/gather.psm1 +++ b/build/powershell/miner/gather.psm1 @@ -119,7 +119,7 @@ function Global:Get-CoinMiners { $(vars).Coins = $true log "Checking Coin Miners. . . . ." -ForegroundColor Yellow ##Load Only Needed Coin Miners - Get-Miners | % { $(vars).Miners.Add($_) | Out-Null } + Global:Get-Miners | % { $(vars).Miners.Add($_) | Out-Null } remove CoinPools $(vars).QuickTimer.Stop() log "Coin Miners Loading Time: $([math]::Round($(vars).QuickTimer.Elapsed.TotalSeconds)) seconds" -Foreground Green diff --git a/build/powershell/pool/gather.psm1 b/build/powershell/pool/gather.psm1 index cb80d6b16..1cbeaa39b 100755 --- a/build/powershell/pool/gather.psm1 +++ b/build/powershell/pool/gather.psm1 @@ -7,12 +7,9 @@ function Global:Get-Pools { ) Switch ($PoolType) { - "Algo" { $GetPools = if ($Items) { Global:Get-ChildItemContent -Items $Items | ForEach { if ($_ -ne $Null) { $_.Content | Add-Member @{Name = $_.Name } -PassThru } } } - } - "Coin" { $GetPools = if ($Items) { Global:Get-ChildItemContent -Items $Items | ForEach { if ($_ -ne $Null) { $_.Content | Add-Member @{Name = $_.Name } -PassThru } } } - } - "Custom" { $GetPools = if ($Items) { Global:Get-ChildItemContent -Items $Items | ForEach { if ($_ -ne $Null) { $_.Content | Add-Member @{Name = $_.Name } -PassThru } } } - } + "Algo" { $GetPools = if ($Items) { Global:Get-ChildItemContent -Items $Items | ForEach { if ($_ -ne $Null) { $_.Content | Add-Member @{Name = $_.Name } -PassThru } } } } + "Coin" { $GetPools = if ($Items) { Global:Get-ChildItemContent -Items $Items | ForEach { if ($_ -ne $Null) { $_.Content | Add-Member @{Name = $_.Name } -PassThru } } } } + "Custom" { $GetPools = if ($Items) { Global:Get-ChildItemContent -Items $Items | ForEach { if ($_ -ne $Null) { $_.Content | Add-Member @{Name = $_.Name } -PassThru } } } } } $GetPools @@ -35,7 +32,6 @@ function Global:Get-AlgoPools { $AllAlgoPools.Symbol | Select-Object -Unique | ForEach-Object { $AllAlgoPools | Where-Object Symbol -EQ $_ | - Where-Object Meets_Threshold -eq $true | Sort-Object Price -Descending | Select-Object -First 3 | ForEach-Object { $(vars).AlgoPools.Add($_) | Out-Null } @@ -43,34 +39,10 @@ function Global:Get-AlgoPools { $AllCustomPools.Symbol | Select-Object -Unique | ForEach-Object { $AllCustomPools | Where-Object Symbol -EQ $_ | - Where-Object Meets_Threshold -eq $true | Sort-Object Price -Descending | Select-Object -First 3 | ForEach-Object { $(vars).AlgoPools.Add($_) | Out-Null } - }; - - $Check = $AllAlgoPools | Where-Object Meets_Threshold -eq $false - if ($Check) { - if (-not $(vars).Cut_Items.AlgoPools) { $(vars).Cut_Items.Add( "AlgoPools", @() ) } - $Check | ForEach-Object { - $(vars).Cut_Items.AlgoPools += [PSCustomObject] @{ - pool = $_.Name - algo = $_.Algorithm - } - } } - - $Check = $AllCustomPools | Where-Object Meets_Threshold -eq $false - if ($Check) { - if (-not $(vars).Cut_Items.AlgoPools) { $(vars).Cut_Items.Add( "AlgoPools", @() ) } - $Check | ForEach-Object { - $(vars).Cut_Items.AlgoPools += [PSCustomObject] @{ - pool = $_.Name - algo = $_.Algorithm - } - } - } - $(vars).QuickTimer.Stop() log "Algo Pools Loading Time: $([math]::Round($(vars).QuickTimer.Elapsed.TotalSeconds)) seconds" -Foreground Green } @@ -86,7 +58,6 @@ function Global:Get-CoinPools { $AllCoinPools.algorithm | Select-Object -Unique | ForEach-Object { $AllCoinPools | Where-Object algorithm -EQ $_ | - Where-Object Meets_Threshold -eq $true | Sort-Object Price -Descending | Select-Object -First 3 | ForEach-Object { @@ -97,20 +68,6 @@ function Global:Get-CoinPools { $Remove = $(vars).AlgoPools | Where-Object Name -eq $_ $Remove | ForEach-Object { $(vars).AlgoPools.Remove($_) | Out-Null } } - - $Check = $AllCoinPools | Where-Object Meets_Threshold -eq $false - if ($Check) { - if (-not $(vars).Cut_Items.CoinPools) { $(vars).Cut_Items.Add( "CoinPools", @() ) } - $Check | ForEach-Object { - $Check2 = $(vars).Cut_Items.CoinPools | Where pool -eq $_.Name | Where algorithm -eq $_.Algorithm - if (-not $Check2) { - $(vars).Cut_Items.CoinPools += [PSCustomObject] @{ - pool = $_.Name - algo = $_.Algorithm - } - } - } - } $(vars).QuickTimer.Stop() log "Coin Pools Loading Time: $([math]::Round($(vars).QuickTimer.Elapsed.TotalSeconds)) seconds" -Foreground Green } diff --git a/coinpools/zergpool.ps1 b/coinpools/zergpool.ps1 index 5924ddc13..2db3e3637 100755 --- a/coinpools/zergpool.ps1 +++ b/coinpools/zergpool.ps1 @@ -3,7 +3,7 @@ $Meets_Threshold = $true $zergpool_Request = [PSCustomObject]@{ } $Zergpool_Sorted = [PSCustomObject]@{ } -$Zergpool_UnSorted = [PSCustomObject]@{ } +$SmallestValue = 1E-20 if ($(arg).Ban_GLT -eq "Yes") { $NoGLT = "GLT" } if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } @@ -54,160 +54,119 @@ if ($Name -in $(arg).PoolName) { else { $Algos | ForEach-Object { $Selected = $_ - $AlgoPool_list = $zergpool_Request.PSObject.Properties.Value | - Where-Object Algo -eq $Selected | - Where-Object Algo -in $(vars).FeeTable.zergpool.keys | - Where-Object Algo -in $(vars).divisortable.zergpool.Keys | - Where-Object { $global:Config.Pool_Algos.$($_.Algo) } | - Where-Object { $Name -notin $global:Config.Pool_Algos.$($_.Algo).exclusions } | - Where-Object Sym -notin $(vars).BanHammer | - Where-Object Sym -notlike "*$NoGLT*" | - Where-Object noautotrade -eq "0" | - Where-Object estimate -gt 0 | - Where-Object hashrate -ne 0 - - if ($(arg).mode -eq "easy") { - $AlgoPool_list | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Select-Object -ExpandProperty Name | ForEach-Object { - $_ | Add-Member "Shuffle" (Coin_Shuffle $Zergpool_Request.$_.estimate $Zergpool_Request.$_.actual_last24h) - } - } - - ## Only choose coins with 24 hour returns or choose all coins (since they all have historical ttf longer than 24 hr). - if ( ($Algopool."24h_btc_shared" | Measure-Object -Sum | select -ExpandProperty Sum) -ne 0 ) { - $BestCoins = $AlgoPool_list | Where "24h_btc_shared" -ne 0 - } - else { $BestCoins = $AlgoPool_list } - - ## Narrow the coins with pipeline (faster): - ## Not directly banned - ## Not a GLT coin (if -Ban_GLT is "Yes") - ## Is specified by user (i.e. the algorithm wasn't specifically banned.) - ## estimate isn't 0 - $Best = $BestCoins | Sort-Object Price -Descending | Select -First 1 - - ## Add It to the sorting list - if ($Best) { $Zergpool_Sorted | Add-Member $Best.sym $Best -Force } - - ## Add remaining coins for historical stats if user specified a - ## time frame higher than live. If it is live, there is no point - ## to record all coins. - if ($(arg).Stat_Coin -ne "live") { - $AlgoPool_list | Where sym -ne $Best.sym | ForEach-Object { - $Zergpool_UnSorted | Add-Member $_.sym $_ -Force - } - } + $zergpool_Request.PSObject.Properties.Value | + Where-Object Algo -eq $Selected | + Where-Object Algo -in $(vars).FeeTable.zergpool.keys | + Where-Object Algo -in $(vars).divisortable.zergpool.Keys | + Where-Object { $global:Config.Pool_Algos.$($_.Algo) } | + Where-Object { $Name -notin $global:Config.Pool_Algos.$($_.Algo).exclusions } | + Where-Object Sym -notin $(vars).BanHammer | + Where-Object Sym -notlike "*$NoGLT*" | + Where-Object noautotrade -eq "0" | + Where-Object estimate -gt 0 | + ForEach-Object { $Zergpool_Sorted | Add-Member $_.sym $_ -Force } } } - ## First stat the historical coins. - $Zergpool_UnSorted | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Select-Object -ExpandProperty Name | ForEach-Object { - $Zergpool_Algorithm = $Zergpool_UnSorted.$_.algo.ToLower() - $Zergpool_Symbol = $Zergpool_UnSorted.$_.sym.ToUpper() - - $StatAlgo = $Zergpool_Algorithm -replace "`_", "`-" - $StatPath = ".\stats\($Name)_$($StatAlgo)_profit.txt" - if (Test-Path $StatPath) { $Estimate = [Double]$Zergpool_Request.$_.estimate * 0.001 } - else { $Estimate = [Double]$Zergpool_Request.$_."24h_btc_shared" } - - if ($(arg).mode -eq "easy") { $Shuffle = Shuffle $Zergpool_Request.$_.estimate_current $Zergpool_Request.$_.actual_last24h } - - $zergpool_Fees = [Double]$(vars).FeeTable.zergpool.$Zergpool_Algorithm - $Divisor = 1000000 * [Double]$(vars).divisortable.zergpool.$Zergpool_Algorithm - - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_coin_profit" -Value ( $Estimate / $Divisor * (1 - ($zergpool_fees / 100))) - } - - ## Now to the best coins. - $Zergpool_Sorted | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Select-Object -ExpandProperty Name | ForEach-Object { - - if ($(arg).Mode -eq "easy") { - if ( $Zergpool_Sorted.$_.estimate -lt $Zergpool_Sorted.$_."24h_btc_shared" -or [Double]$Zergpool_Sorted.$_."24h_btc_shared" -eq 0) { - $Meets_Threshold = Global:Get-Requirement $Zergpool_Sorted.$_.estimate $Zergpool_Sorted.$_."24h_btc_shared" - } - else { $Meets_Threshold = $true } - } - - $Zergpool_Algorithm = $Zergpool_Sorted.$_.algo.ToLower() + $Zergpool_Sorted | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name | ForEach-Object { + $Zergpool_Algo = $Zergpool_Sorted.$_.algo.ToLower() $Zergpool_Symbol = $Zergpool_Sorted.$_.sym.ToUpper() - $mc = "mc=$Zergpool_Symbol," - $zergpool_Port = $Zergpool_Sorted.$_.port - $zergpool_Host = "$($Zergpool_Sorted.$_.Original_Algo).mine.zergpool.com$X" - $zergpool_Fees = [Double]$(vars).FeeTable.zergpool.$Zergpool_Algorithm - $zergpool_Estimate = [Double]$Zergpool_Sorted.$_.estimate * 0.001 - $Divisor = 1000000 * [Double]$(vars).divisortable.zergpool.$Zergpool_Algorithm $StatAlgo = $Zergpool_Symbol -replace "`_", "`-" - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_coin_profit" -Value ([double]$zergpool_Estimate / $Divisor * (1 - ($zergpool_fees / 100))) - - ## Wallet Swapping/Solo mining - $Pass1 = $global:Wallets.Wallet1.Keys - $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - $Pass2 = $global:Wallets.Wallet2.Keys - $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - $Pass3 = $global:Wallets.Wallet3.Keys - $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - - if ($global:Wallets.AltWallet1.keys) { - $global:Wallets.AltWallet1.Keys | ForEach-Object { - if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { - $Pass1 = $_; - $User1 = $global:Wallets.AltWallet1.$_.address; + $Divisor = 1000000 * [Double]$(vars).divisortable.zergpool.$Zergpool_Algo + $zergpool_Fees = [Double]$(vars).FeeTable.zergpool.$Zergpool_Algo + $zergpool_Estimate = [Double]$Zergpool_Sorted.$_.estimate * 0.001 + $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_coin_profit" -Value ([double]$zergpool_Estimate / $Divisor * (1 - ($zergpool_fees / 100))) -Shuffle $Zergpool_Sorted.$_.Shuffle + $Level = $Stat.$($(arg).Stat_Algo) + $Zergpool_Sorted.$_ | Add-Member "Level" $Level + } + + ## Break the algos to groups to sort it down. + $Algos | ForEach-Object { + $Selected = $_ + + $Best = $Zergpool_Sorted.PSObject.Properties.Value | Where-Object Algo -eq $Selected | Sort-Object Level -Descending | Select-Object -First 1 + + if ($Best) { + $Best | ForEach-Object { + + $Zergpool_Algo = $_.algo.ToLower() + $Zergpool_Symbol = $_.sym.ToUpper() + $mc = "mc=$Zergpool_Symbol," + $zergpool_Port = $_.port + $zergpool_Host = "$($_.Original_Algo).mine.zergpool.com$X" + + ## Wallet Swapping/Solo mining + $Pass1 = $global:Wallets.Wallet1.Keys + $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + $Pass2 = $global:Wallets.Wallet2.Keys + $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + $Pass3 = $global:Wallets.Wallet3.Keys + $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + + if ($global:Wallets.AltWallet1.keys) { + $global:Wallets.AltWallet1.Keys | ForEach-Object { + if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { + $Pass1 = $_; + $User1 = $global:Wallets.AltWallet1.$_.address; + } + } } - } - } - if ($global:Wallets.AltWallet2.keys) { - $global:Wallets.AltWallet2.Keys | ForEach-Object { - if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { - $Pass2 = $_; - $User2 = $global:Wallets.AltWallet2.$_.address; + if ($global:Wallets.AltWallet2.keys) { + $global:Wallets.AltWallet2.Keys | ForEach-Object { + if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { + $Pass2 = $_; + $User2 = $global:Wallets.AltWallet2.$_.address; + } + } } - } - } - if ($global:Wallets.AltWallet3.keys) { - $global:Wallets.AltWallet3.Keys | ForEach-Object { - if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { - $Pass3 = $_; - $User3 = $global:Wallets.AltWallet3.$_.address; + if ($global:Wallets.AltWallet3.keys) { + $global:Wallets.AltWallet3.Keys | ForEach-Object { + if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { + $Pass3 = $_; + $User3 = $global:Wallets.AltWallet3.$_.address; + } + } } - } - } - if ($(vars).All_AltWallets) { - $(vars).All_AltWallets.keys | ForEach-Object { - $Sym = $_ - $Zerg_Sym = $Zergpool_Symbol -split "-" | Select -First 1 - if ($Sym -eq $Zerg_Sym -or $Sym -eq $Zergpool_Symbol) { - if ($(vars).All_AltWallets.$Sym.exchange -ne "Yes") { - $Pass1 = $Sym - $Pass2 = $Sym - $Pass3 = $Sym - $mc = "" - if ($(vars).All_AltWallets.$Sym.address -ne "add address of coin if you wish to mine to that address, or leave alone." -and $(vars).All_AltWallets.$_.address -ne "") { - $User1 = $(vars).All_AltWallets.$Sym.address - $User2 = $(vars).All_AltWallets.$Sym.address - $User3 = $(vars).All_AltWallets.$Sym.address - } + if ($(vars).All_AltWallets) { + $(vars).All_AltWallets.keys | ForEach-Object { + $Sym = $_ + $Zerg_Sym = $Zergpool_Symbol -split "-" | Select -First 1 + if ($Sym -eq $Zerg_Sym -or $Sym -eq $Zergpool_Symbol) { + if ($(vars).All_AltWallets.$Sym.exchange -ne "Yes") { + $Pass1 = $Sym + $Pass2 = $Sym + $Pass3 = $Sym + $mc = "" + if ($(vars).All_AltWallets.$Sym.address -ne "add address of coin if you wish to mine to that address, or leave alone." -and $(vars).All_AltWallets.$_.address -ne "") { + $User1 = $(vars).All_AltWallets.$Sym.address + $User2 = $(vars).All_AltWallets.$Sym.address + $User3 = $(vars).All_AltWallets.$Sym.address + } + } + if ($(vars).All_AltWallets.$Sym.solo -eq "Yes") { + $mc += "m=solo," + } + } } - if ($(vars).All_AltWallets.$Sym.solo -eq "Yes") { - $mc += "m=solo," - } - } + } + + [PSCustomObject]@{ + Symbol = "$ZergPool_Symbol-Coin" + Algorithm = $Zergpool_Algo + Price = $_.Level + Protocol = "stratum+tcp" + Host = $zergpool_Host + Port = $zergpool_Port + User1 = $User1 + User2 = $User2 + User3 = $User3 + Pass1 = "c=$Pass1,$($mc)id=$($(arg).RigName1)" + Pass2 = "c=$Pass2,$($mc)id=$($(arg).RigName2)" + Pass3 = "c=$Pass3,$($mc)id=$($(arg).RigName3)" + Meets_Threshold = $Meets_Threshold + } } } - - [PSCustomObject]@{ - Symbol = "$Zergpool_Symbol-Coin" - Algorithm = $zergpool_Algorithm - Price = $Stat.$($(arg).Stat_Coin) - Protocol = "stratum+tcp" - Host = $zergpool_Host - Port = $zergpool_Port - User1 = $User1 - User2 = $User2 - User3 = $User3 - Pass1 = "c=$Pass1,$($mc)id=$($(arg).RigName1)" - Pass2 = "c=$Pass2,$($mc)id=$($(arg).RigName2)" - Pass3 = "c=$Pass3,$($mc)id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - } } } \ No newline at end of file diff --git a/coinpools/zpool.ps1 b/coinpools/zpool.ps1 index 7e6c7daad..672586eec 100755 --- a/coinpools/zpool.ps1 +++ b/coinpools/zpool.ps1 @@ -1,17 +1,16 @@ $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName +$Meets_Threshold = $true + $zpool_Request = [PSCustomObject]@{ } $zpool_Sorted = [PSCustomObject]@{ } -$zpool_UnSorted = [PSCustomObject]@{ } -$Meets_Threshold = $true if ($(arg).Ban_GLT -eq "Yes") { $NoGLT = "GLT" } - if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } ## Skip if user didn't specify if ($Name -in $(arg).PoolName) { - - try { $zpool_Request = Invoke-RestMethod "https://zpool.ca/api/currencies" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } + + try { $zpool_Request = Invoke-RestMethod "http://zpool.ca/api/currencies" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } catch { log "SWARM contacted ($Name) for a failed API check. (Coins)"; return @@ -21,12 +20,6 @@ if ($Name -in $(arg).PoolName) { log "SWARM contacted ($Name) but ($Name) the response was empty." return } - - Switch ($(arg).Location) { - "US" { $region = "na" } - "EUROPE" { $region = "eu" } - "ASIA" { $region = "sea" } - } ## Add symbol to the list for sorting $zpool_Request.PSObject.Properties.Name | ForEach-Object { $zpool_Request.$_ | Add-Member "sym" $_ } @@ -38,15 +31,15 @@ if ($Name -in $(arg).PoolName) { $zpool_Request.$_.Algo = $global:Config.Pool_Algos.PSObject.Properties.Name | % { if ($Algo -in $global:Config.Pool_Algos.$_.alt_names) { $_ } } } - ## Make an algo list, include asic algorithms not usually in SWARM + # Make an algo list, include asic algorithms not usually in SWARM ## Remove algos that users/SWARM have banned. - $zpoolAlgos = @() - $zpoolAlgos += $(vars).Algorithm - $zpoolAlgos += $(arg).ASIC_ALGO - $Algos = $zpoolAlgos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } + $Algos = @() + $Algos += $(vars).Algorithm + $Algos += $(arg).ASIC_ALGO + $Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } ## Convert estimate to decimal - $zpool_Request.PSObject.Properties.Value | % { $_.Estimate = [Decimal]$_.Estimate } + $zpool_Request.PSObject.Properties.Value | ForEach-Object { $_.Estimate = [Decimal]$_.Estimate } ## Automatically add Active Coins for calcs. Active Coins are coins that are currently being mined. $Active = $zpool_Request.PSObject.Properties.Value | Where-Object sym -in $(vars).ActiveSymbol @@ -56,146 +49,129 @@ if ($Name -in $(arg).PoolName) { if ($(arg).Coin.Count -gt 1 -and $(arg).Coin -ne "") { $CoinsOnly = $zpool_Request.PSObject.Properties.Value | Where-Object sym -in $(arg).Coin if ($CoinsOnly) { $CoinsOnly | ForEach-Object { $zpool_Sorted | Add-Member $_.sym $_ -Force } } - } else { + } + else { $Algos | ForEach-Object { $Selected = $_ - $AlgoPool_list = $zpool_Request.PSObject.Properties.Value | - Where-Object Algo -eq $Selected | - Where-Object Algo -in $(vars).FeeTable.zpool.keys | - Where-Object Algo -in $(vars).divisortable.zpool.Keys | - Where-Object { $global:Config.Pool_Algos.$($_.Algo) } | - Where-Object { $Name -notin $global:Config.Pool_Algos.$($_.sym).exclusions } | - Where-Object Sym -notin $(vars).BanHammer | - Where-Object Sym -notlike "*$NoGLT*" | - Where-Object estimate -gt 0 - - ## Only choose coins with 24 hour returns or choose all coins (since they all have historical ttf longer than 24 hr). - if ( ($Algopool."24h_btc" | Measure-Object -Sum | select -ExpandProperty Sum) -ne 0 ) { - $BestCoins = $AlgoPool_list | Where "24h_btc" -ne 0 - } else { $BestCoins = $AlgoPool_list } - - ## Narrow the coins with pipeline (faster): - ## Not directly banned - ## Not a GLT coin (if -Ban_GLT is "Yes") - ## Is specified by user (i.e. the algorithm wasn't specifically banned.) - ## estimate isn't 0 - $Best = $BestCoins | Sort-Object Price -Descending | Select -First 1 - - ## Add It to the sorting list - if ($Best) { $zpool_Sorted | Add-Member $Best.sym $Best -Force } - - ## Add remaining coins for historical stats if user specified a - ## time frame higher than live. If it is live, there is no point - ## to record all coins. - if ($(arg).Stat_Coin -ne "live") { - $AlgoPool_list | Where sym -ne $Best.sym | - ForEach-Object { - $zpool_UnSorted | Add-Member $_.sym $_ -Force - } - } + $zpool_Request.PSObject.Properties.Value | + Where-Object Algo -eq $Selected | + Where-Object Algo -in $(vars).FeeTable.zpool.keys | + Where-Object Algo -in $(vars).divisortable.zpool.Keys | + Where-Object { $global:Config.Pool_Algos.$($_.Algo) } | + Where-Object { $Name -notin $global:Config.Pool_Algos.$($_.Algo).exclusions } | + Where-Object Sym -notin $(vars).BanHammer | + Where-Object Sym -notlike "*$NoGLT*" | + Where-Object noautotrade -eq "0" | + Where-Object estimate -gt 0 | + ForEach-Object { $zpool_Sorted | Add-Member $_.sym $_ -Force } } } - - ## First stat the historical coins. - $zpool_UnSorted | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Select-Object -ExpandProperty Name | ForEach-Object { - $zpool_Algorithm = $zpool_UnSorted.$_.algo.ToLower() - $zpool_Symbol = $zpool_UnSorted.$_.sym.ToUpper() - $zpool_Fees = [Double]$(vars).FeeTable.zpool.$zpool_Algorithm - $zpool_Estimate = [Double]$zpool_UnSorted.$_.estimate - $Divisor = 1000000 * [Double]$(vars).divisortable.zpool.$zpool_Algorithm + $zpool_Sorted | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name | ForEach-Object { + $zpool_Algo = $zpool_Sorted.$_.algo.ToLower() + $zpool_Symbol = $zpool_Sorted.$_.sym.ToUpper() $StatAlgo = $zpool_Symbol -replace "`_", "`-" - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_coin_profit" -Value ([double]$zpool_Estimate / $Divisor * (1 - ($zpool_fees / 100))) + $Divisor = 1000000 * [Double]$(vars).divisortable.zpool.$zpool_Algo + $zpool_Fees = [Double]$(vars).FeeTable.zpool.$zpool_Algo + $zpool_Estimate = [Double]$zpool_Sorted.$_.estimate * 0.001 + $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_coin_profit" -Value ([double]$zpool_Estimate / $Divisor * (1 - ($zpool_fees / 100))) -Shuffle $zpool_Sorted.$_.Shuffle + $Level = $Stat.$($(arg).Stat_Algo) + $zpool_Sorted.$_ | Add-Member "Level" $Level } - ## Now to the best coins. - $zpool_Sorted | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Select-Object -ExpandProperty Name | ForEach-Object { - - if($(arg).Mode -eq "Easy") { - if ( $zpool_Sorted.$_.estimate -lt $zpool_Sorted.$_."24h_btc" -or [Double]$zpool_Sorted.$_."24h_btc" -eq 0) { - $Meets_Threshold = Global:Get-Requirement $zpool_Sorted.$_.estimate $zpool_Sorted.$_."24h_btc" - } else { $Meets_Threshold = $true } - } - - $zpool_Algorithm = $zpool_Sorted.$_.algo.ToLower() - $zpool_Symbol = $zpool_Sorted.$_.sym.ToUpper() - $zap = "zap=$zpool_Symbol," - $zpool_Port = $zpool_Sorted.$_.port - $Zpool_Host = "$($zpool_Request.$_.Original_Algo).$($region).mine.zpool.ca$X" - $zpool_Fees = [Double]$(vars).FeeTable.zpool.$zpool_Algorithm - $zpool_Estimate = [Double]$zpool_Sorted.$_.estimate - $Divisor = 1000000 * [Double]$(vars).divisortable.zpool.$zpool_Algorithm - $StatAlgo = $zpool_Symbol -replace "`_", "`-" - $Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_coin_profit" -Value ([double]$zpool_Estimate / $Divisor * (1 - ($zpool_fees / 100))) - - ## Wallet Swapping/Solo mining - $Pass1 = $global:Wallets.Wallet1.Keys - $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address - $Pass2 = $global:Wallets.Wallet2.Keys - $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address - $Pass3 = $global:Wallets.Wallet3.Keys - $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address - - if ($global:Wallets.AltWallet1.keys) { - $global:Wallets.AltWallet1.Keys | ForEach-Object { - if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { - $Pass1 = $_; - $User1 = $global:Wallets.AltWallet1.$_.address; + Switch ($(arg).Location) { + "US" { $region = "na" } + "EUROPE" { $region = "eu" } + "ASIA" { $region = "sea" } + } + + ## Break the algos to groups to sort it down. + $Algos | ForEach-Object { + $Selected = $_ + + $Best = $zpool_Sorted.PSObject.Properties.Value | Where-Object Algo -eq $Selected | Sort-Object Level -Descending | Select-Object -First 1 + + if ($Best) { + $Best | ForEach-Object { + + $zpool_Algo = $_.algo.ToLower() + $zpool_Symbol = $_.sym.ToUpper() + $mc = "zap=$zpool_Symbol," + $zpool_Port = $_.port + $zpool_Host = "$($_.Original_Algo).$($region).mine.zpool.ca$X" + + ## Wallet Swapping/Solo mining + $Pass1 = $global:Wallets.Wallet1.Keys + $User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address + $Pass2 = $global:Wallets.Wallet2.Keys + $User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address + $Pass3 = $global:Wallets.Wallet3.Keys + $User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address + + if ($global:Wallets.AltWallet1.keys) { + $global:Wallets.AltWallet1.Keys | ForEach-Object { + if ($global:Wallets.AltWallet1.$_.Pools -contains $Name) { + $Pass1 = $_; + $User1 = $global:Wallets.AltWallet1.$_.address; + } + } } - } - } - if ($global:Wallets.AltWallet2.keys) { - $global:Wallets.AltWallet2.Keys | ForEach-Object { - if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { - $Pass2 = $_; - $User2 = $global:Wallets.AltWallet2.$_.address; + if ($global:Wallets.AltWallet2.keys) { + $global:Wallets.AltWallet2.Keys | ForEach-Object { + if ($global:Wallets.AltWallet2.$_.Pools -contains $Name) { + $Pass2 = $_; + $User2 = $global:Wallets.AltWallet2.$_.address; + } + } } - } - } - if ($global:Wallets.AltWallet3.keys) { - $global:Wallets.AltWallet3.Keys | ForEach-Object { - if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { - $Pass3 = $_; - $User3 = $global:Wallets.AltWallet3.$_.address; + if ($global:Wallets.AltWallet3.keys) { + $global:Wallets.AltWallet3.Keys | ForEach-Object { + if ($global:Wallets.AltWallet3.$_.Pools -contains $Name) { + $Pass3 = $_; + $User3 = $global:Wallets.AltWallet3.$_.address; + } + } } - } - } - if ($(vars).All_AltWallets) { - $(vars).All_AltWallets.keys | ForEach-Object { - $Sym = $_ - $Zpool_Sym = $zpool_Symbol -split "-" | Select -First 1 - if ($(vars).All_AltWallets.$Sym.exchange -ne "Yes") { - $Pass1 = $Sym - $Pass2 = $Sym - $Pass3 = $Sym - $mc = "" - if ($(vars).All_AltWallets.$Sym.address -ne "add address of coin if you wish to mine to that address, or leave alone." -and $(vars).All_AltWallets.$_.address -ne "") { - $User1 = $(vars).All_AltWallets.$Sym.address - $User2 = $(vars).All_AltWallets.$Sym.address - $User3 = $(vars).All_AltWallets.$Sym.address + if ($(vars).All_AltWallets) { + $(vars).All_AltWallets.keys | ForEach-Object { + $Sym = $_ + $zpool_sym = $zpool_Symbol -split "-" | Select -First 1 + if ($Sym -eq $zpool_sym -or $Sym -eq $zpool_Symbol) { + if ($(vars).All_AltWallets.$Sym.exchange -ne "Yes") { + $Pass1 = $Sym + $Pass2 = $Sym + $Pass3 = $Sym + $mc = "" + if ($(vars).All_AltWallets.$Sym.address -ne "add address of coin if you wish to mine to that address, or leave alone." -and $(vars).All_AltWallets.$_.address -ne "") { + $User1 = $(vars).All_AltWallets.$Sym.address + $User2 = $(vars).All_AltWallets.$Sym.address + $User3 = $(vars).All_AltWallets.$Sym.address + } + } + if ($(vars).All_AltWallets.$Sym.solo -eq "Yes") { + $mc += "m=solo," + } + } } } + + [PSCustomObject]@{ + Symbol = "$zpool_Symbol-Coin" + Algorithm = $zpool_Algo + Price = $_.Level + Protocol = "stratum+tcp" + Host = $zpool_Host + Port = $zpool_Port + User1 = $User1 + User2 = $User2 + User3 = $User3 + Pass1 = "c=$Pass1,$($mc)id=$($(arg).RigName1)" + Pass2 = "c=$Pass2,$($mc)id=$($(arg).RigName2)" + Pass3 = "c=$Pass3,$($mc)id=$($(arg).RigName3)" + Meets_Threshold = $Meets_Threshold + } } } - - ## Add the stat for next step in calcuation: - [PSCustomObject]@{ - Symbol = "$zpool_Symbol-Coin" - Algorithm = $zpool_Algorithm - Price = $Stat.$($(arg).Stat_Coin) - Protocol = "stratum+tcp" - Host = $zpool_Host - Port = $zpool_Port - User1 = $User1 - User2 = $User2 - User3 = $User3 - Pass1 = "c=$Pass1,$($zap)id=$($(arg).RigName1)" - Pass2 = "c=$Pass2,$($zap)id=$($(arg).RigName2)" - Pass3 = "c=$Pass3,$($zap)id=$($(arg).RigName3)" - Meets_Threshold = $Meets_Threshold - } - - ## Done } } \ No newline at end of file diff --git a/config/parameters/default.json b/config/parameters/default.json index 3b8b6ead1..a209ac95f 100755 --- a/config/parameters/default.json +++ b/config/parameters/default.json @@ -21,7 +21,7 @@ ], "Auto_Algo": "Yes", "Auto_Coin": "No", - "Ban_GLT": "Yes", + "Ban_GLT": "No", "Bans": [], "Benchmark": 190, "CLPlatform": "", @@ -81,7 +81,6 @@ "Rigname3": "SWARM", "Startup": "Yes", "Stat_Algo": "Live", - "Stat_All": "No", "Stat_Coin": "Live", "StatsInterval": 1, "SWARM_Hash": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", diff --git a/config/pools/pool-algos.json b/config/pools/pool-algos.json index cbbd3960d..31be74c77 100755 --- a/config/pools/pool-algos.json +++ b/config/pools/pool-algos.json @@ -49,7 +49,15 @@ }, "argon2d500": { "alt_names": [ - "argon2d500", + "argon2d500" + ], + "exclusions": [ + "add pool or miner here", + "comma seperated" + ] + }, + "argon2d-dyn": { + "alt_names": [ "argon2d-dyn" ], "exclusions": [ diff --git a/custompools/whalesburg.ps1 b/custompools/whalesburg.ps1 index e2fbce2e2..b4d08c49a 100755 --- a/custompools/whalesburg.ps1 +++ b/custompools/whalesburg.ps1 @@ -10,9 +10,7 @@ ## to nicehash, but it seems to cause weird bugs in miners. $Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName -$Meets_Threshold = $True $Whalesburg_Request = [PSCustomObject]@{} -if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} if ($(arg).PoolName -eq $Name) { try {$Whalesburg_Request = Invoke-RestMethod "https://payouts.whalesburg.com/profitabilities/share_price" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop} @@ -35,6 +33,7 @@ if ($(arg).PoolName -eq $Name) { $Prorate = 2 ## btc/mhs/day $Estimate = ((([Double]$Whalesburg_Request.mh_per_second_price * 86400))) * $ETHExchangeRate + $Previous = $Estimate $Stat = Global:Set-Stat -Name "$($Name)_$($Whalesburg_Algorithm)_profit" -Value ([Double]$Estimate * (1 - ($Prorate / 100))) @@ -52,7 +51,7 @@ if ($(arg).PoolName -eq $Name) { CPUser = $(arg).ETH Worker = "$($(arg).Worker)" Location = $(arg).Location - Meets_Threshold = $Meets_Threshold + Previous = $Previous } } }