MultiPoolMiner / MultiPoolMiner

Monitors crypto mining pools in real-time in order to find the most profitable for your machine. Controls any miner that is available via command line.
GNU General Public License v3.0
900 stars 343 forks source link

Suggestion: Changes to pool code (e.g. SSL vs. non-SSL, different currencies) #345

Closed UselessGuru closed 6 years ago

UselessGuru commented 7 years ago

My aims are:

  1. Keep pool specific config in pool file, so I can mine to a different address or different payout currency with each pool
    
    . .\Include.ps1

Static values per pool

$Wallet = "3QYQg9JwVSvTTwpAdfaXJe2jQPC8JhG4X8" $WorkerName = "1080ti" # max. 7 chars $Currency = "BTC" if (-not $WorkerName) {$WorkerName = $env:computername} If ($WorkerName.Length -gt 7) {$WorkerName = $WorkerName.substring(0,7)} $Password = "x" $URL = "http://api.nicehash.com/api?method=simplemultialgo.info"

$Nicehash_Regions = "eu", "usa", "hk", "jp", "in", "br"

$Nicehash_Regions = "eu" ...

2. Disable disfunct algos per pool (in case an algo is not working well with the pool, often a temporary issue)

...

In case some algos are not working properly

$DisabledAlgorithms = @("cryptonight","sia","scrypt")

$NiceHash_Request.result.simplemultialgo | ForEach-Object {

$NiceHash_Algorithm = $_.name

# Do only for selected algorithms, creates a smaller pool list
if ($DisabledAlgorithms -inotcontains $NiceHash_Algorithm -and ($Algorithm -eq $null -or $Algorithm -icontains $NiceHash_Algorithm)) {

...

3. Remove redundant code by creating only either SSL or NON-SSL pool information
This will
a) create a smaller $AllPools in MultiPoolMiner.ps1
b) eliminate the need to filter for SSL in building $Pools / $Pools_Comparison (=faster code)

...

Make SSL either true or false, will not be empty after this

$SSL = (-not -not $SSL) if ($SSL) {$protocol = "stratum+ssl"} else {$protocol = "stratum+tcp"} ... $NiceHash_Host = "nicehash.com" $NiceHashPort = $.port $NiceHash_Algorithm_Norm = Get-Algorithm $NiceHash_Algorithm $NiceHash_Coin = ""

    $Divisor = 1000000000

    $Stat = Set-Stat -Name "$($Name)_$($NiceHash_Algorithm_Norm)_Profit" -Value ([Double]$_.paying / $Divisor)

    $NiceHash_Regions | ForEach-Object {
        $NiceHash_Region = $_
        $NiceHash_Region_Norm = Get-Region $NiceHash_Region

        if ($Wallet) {
            if (($NiceHash_Algorithm_Norm) -ne "Sia") {
                [PSCustomObject]@{
                    Algorithm       = $NiceHash_Algorithm_Norm
                    Info            = $NiceHash_Coin
                    StatsTimestamp  = $StatsTimestamp
                    Price           = $Stat.Live
                    StablePrice     = $Stat.Week
                    MarginOfError   = $Stat.Week_Fluctuation
                    Protocol        = $protocol
                    Host            = "$NiceHash_Algorithm.$NiceHash_Region.$NiceHash_Host"
                    Port            = $NiceHash_Port
                    User            = "$Wallet.$WorkerName"
                    Pass            = "$Password"
                    Region          = $NiceHash_Region_Norm
                    SSL             = $SSL
                }
            }

            [PSCustomObject]@{
                Algorithm       = "$($NiceHash_Algorithm_Norm)NiceHash"
                Info            = $NiceHash_Coin
                StatsTimestamp  = $StatsTimestamp
                Price           = $Stat.Live
                StablePrice     = $Stat.Week
                MarginOfError   = $Stat.Week_Fluctuation
                Protocol        = $protocol
                Host            = "$NiceHash_Algorithm.$NiceHash_Region.$NiceHash_Host"
                Port            = $NiceHash_Port
                User            = "$Wallet.$WorkerName"
                Pass            = "$Password"
                Region          = $NiceHash_Region_Norm
                SSL             = $SSL
            }
        }
    }
}

}

aaronsace commented 7 years ago

This does need speeding up; I'll consider your suggestions.

UselessGuru commented 7 years ago

How is '{$_.SSL -EQ $SSL}' in your original code below supposed to work? I assume it is ment to allow only SSL or NON-SSL pools in the resulting $Pool array, but not both. If I don't use '-SSL' ( -> $SSL=$true) as parameter, $Pools will still contain pools with SSL=False Is this intended?

    $AllPools.Algorithm | ForEach-Object {$_.ToLower()} | Select-Object -Unique | ForEach-Object {$Pools | Add-Member $_ ($AllPools | Sort-Object -Descending {$PoolName.Count -eq 0 -or (Compare-Object $PoolName $_.Name -IncludeEqual -ExcludeDifferent | Measure-Object).Count -gt 0}, Price, {$_.Region -EQ $Region}, {$_.SSL -EQ $SSL} | Where-Object Algorithm -EQ $_ | Select-Object -First 1)}
    $AllPools.Algorithm | ForEach-Object {$_.ToLower()} | Select-Object -Unique | ForEach-Object {$Pools_Comparison | Add-Member $_ ($AllPools | Sort-Object -Descending {$PoolName.Count -eq 0 -or (Compare-Object $PoolName $_.Name -IncludeEqual -ExcludeDifferent | Measure-Object).Count -gt 0}, StablePrice, {$_.Region -EQ $Region}, {$_.SSL -EQ $SSL} | Where-Object Algorithm -EQ $_ | Select-Object -First 1)}
aaronsace commented 7 years ago

Yes, I don't actually remove any pools; I simply sort them in order of preference.

I've been measuring a few command times before calling it a night and the main speed problem is in the two lines that you have just quoted. The number of pools need reducing before sorting.