Skip to content

Instantly share code, notes, and snippets.

@rvrsh3ll
Created December 11, 2017 11:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvrsh3ll/f82256101b757ade9d44198fc225e490 to your computer and use it in GitHub Desktop.
Save rvrsh3ll/f82256101b757ade9d44198fc225e490 to your computer and use it in GitHub Desktop.
function Mine-MostProfitableCoin {
# Modify to your appropriate miner's locations
$ElectroneumMiner = "C:\Users\rvrsh3ll\Desktop\mining\Active_Miners\ccminer-x64-2.2.2-cuda9\ccminer-x64.exe"
$MoneroMiner = "C:\Users\rvrsh3ll\Desktop\mining\Active_Miners\ccminer-x64-2.2.2-cuda9\ccminer-x64.exe"
$BitCoinGoldMiner = "C:\Users\rvrsh3ll\Desktop\mining\Active_Miners\ccminer-x64-2.2.2-cuda9\ccminer-x64.exe"
$MonaCoin = "C:\Users\rvrsh3ll\Desktop\mining\Active_Miners\xmr-stak-monero\xmr-stak.exe"
# Modify to your public wallet's addresse's
$ElectroneumAddress = "etnkL9RRWWXaA1am6ZGsCvERaytZGPmLXi7jruxiQuXP4pLYYhkG3PXKczkheD3j1YPchvRGvpe7ySgRw77QqXjV8WV2QZsJM9"
$MoneroAddress = "4ALcw9nTAStZSshoWVUJakZ6tLwTDhixhQUQNJkCn4t3fG3MMK19WZM44HnQRvjqmz4LkkA8t565v7iBwQXx2r34HNroSAZ"
$BitCoinGoldAddress = "GZW8HNJKouHdVCWcAxCb3EXumfbN9nyW54"
$MonaCoinAddress = ""
function Start-ProfitabilityCheck {
# Get API JSON and convert it
$request = Invoke-WebRequest -Uri 'https://whattomine.com/coins.json' | ConvertFrom-Json
#Select the coins we are mining and their current profitability
$Electroneum = $request.coins.Electroneum.profitability
$Monero = $request.coins.Monero.profitability
$BitCoinGold = $request.coins.BitcoinGold.profitability
$CoinsToMine = @{Electroneum=$Electroneum;Monero=$Monero;BitcoinGold=$BitCoinGold}
#$sorted_list = $CoinsToMine.GetEnumerator() | sort -Property Value -Descending
$MostProfitableCoin = Get-Variable -Name BitCoinGold,Electroneum,Monero | Sort-Object -Property Value | Select -Last 1 -ExpandProperty Name
$MostProfitableCoin
}
function Start-Mining {
$MostProfitableCoin = Start-ProfitabilityCheck
Write-Output $MostProfitableCoin
if ($MostProfitableCoin -eq "Electroneum") {
Write-Output "The most profitable coin is currently $MostProfitableCoin"
Write-Output " "
Write-Output "Beginning to mine $MostProfitableCoin..."
Start-Process $ElectroneumMiner -ArgumentList "-a cryptonight -o stratum+tcp://etn.dedpool.io:5555 -u etnkL9RRWWXaA1am6ZGsCvERaytZGPmLXi7jruxiQuXP4pLYYhkG3PXKczkheD3j1YPchvRGvpe7ySgRw77QqXjV8WV2QZsJM9 -p x --cpu-priority=3"
$NewResult = $MostProfitableCoin
While ($MostProfitableCoin -eq $NewResult) {
Start-Sleep -Seconds 1800
$NewResult = Start-ProfitabilityCheck
if ($NewResult -ne $MostProfitableCoin) {
Stop-Process -Processname "ccminer-x64"
}
}
} elseif ($MostProfitableCoin -eq "Monero") {
Write-Output "The most profitable coin is currently $MostProfitableCoin"
Write-Output " "
Write-Output "Beginning to mine $MostProfitableCoin..."
Start-Process $MoneroMiner -ArgumentList "-a cryptonight -o stratum+tcp://xmr-us-east1.nanopool.org:14444 -u 4ALcw9nTAStZSshoWVUJakZ6tLwTDhixhQUQNJkCn4t3fG3MMK19WZM44HnQRvjqmz4LkkA8t565v7iBwQXx2r34HNroSAZ -p x --cpu-priority=3"
$NewResult = $MostProfitableCoin
While ($MostProfitableCoin -eq $NewResult) {
Start-Sleep -Seconds 1800
$NewResult = Start-ProfitabilityCheck
if ($NewResult -ne $MostProfitableCoin) {
Stop-Process -Processname "ccminer-x64"
}
}
} elseif ($MostProfitableCoin -eq "BitCoinGold") {
Write-Output "The most profitable coin is currently $MostProfitableCoin"
Write-Output " "
Write-Output "Beginning to mine $MostProfitableCoin..."
Start-Process $BitCoinGoldMiner -ArgumentList "-a equihash -o stratum+tcp://us-east.equihash-hub.miningpoolhub.com:12023 -u GZW8HNJKouHdVCWcAxCb3EXumfbN9nyW54.rvrsh3llbtg1 -p btg1 --cpu-priority=3"
$NewResult = $MostProfitableCoin
While ($MostProfitableCoin -eq $NewResult) {
Start-Sleep -Seconds 1800
$NewResult = Start-ProfitabilityCheck
if ($NewResult -ne $MostProfitableCoin) {
Stop-Process -Processname "ccminer-x64"
}
}
}
} Start-Mining
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment