diff --git a/README.md b/README.md index 67efbc0..d3a52e3 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,12 @@ * **[Download latest release](https://github.com/angelbbs/ZergPoolMinerLegacy/releases)** -"Miner Legacy Fork Fix" is an free open source easy to use CPU & GPU cryptocurrency miner program with classic GUI for Windows. +"Miner Legacy Fork Fix" is an free open source easy to use CPU & GPU cryptocurrency miner program with classic GUI for Windows. - Easy installer. - Support AMD, INTEL, NVIDIA GPUs and CPU. - Support wallets with guaranteed payouts coins. - Included most profitable miners programs. +- Dual algorithms. - Fast benchmark - 1-2 min per algo. - Auto-switch between most profitable algorithms taking into account the consumption of devices and the cost of electricity. - Tariff zones for electricity. diff --git a/ZergPoolMiner/Configs/Data/GeneralConfig.cs b/ZergPoolMiner/Configs/Data/GeneralConfig.cs index c32cbf8..2a01e25 100644 --- a/ZergPoolMiner/Configs/Data/GeneralConfig.cs +++ b/ZergPoolMiner/Configs/Data/GeneralConfig.cs @@ -11,6 +11,8 @@ public class GeneralConfig { public Version ConfigFileVersion; public double ForkFixVersion; + public DateTime updated_at; + public DateTime InstallDateTime; public bool ShowSplash = true; public bool DecreasePowerCost = false; public bool ShowTotalPower = false; @@ -19,7 +21,7 @@ public class GeneralConfig public bool NoForceTRexClose; public bool UseNegativeProfit = false; public bool ShowHiddenAlgos = false; - public double DaggerOrderMaxPay = 0; + public double ProfitabilityCorrection = 0.8; public int KawpowLiteMaxEpoch3GB = 220; public int KawpowLiteMaxEpoch4GB = 354; public int KawpowLiteMaxEpoch5GB = 488; diff --git a/ZergPoolMiner/Devices/Algorithms/DefaultAlgorithms.cs b/ZergPoolMiner/Devices/Algorithms/DefaultAlgorithms.cs index 3c737a4..cfebc6d 100644 --- a/ZergPoolMiner/Devices/Algorithms/DefaultAlgorithms.cs +++ b/ZergPoolMiner/Devices/Algorithms/DefaultAlgorithms.cs @@ -578,6 +578,9 @@ public static class DefaultAlgorithms */ new Algorithm(MinerBaseType.miniZ, AlgorithmType.Ethashb3, "Ethashb3") { + }, + new Algorithm(MinerBaseType.miniZ, AlgorithmType.Meraki, "Meraki") + { } } }, @@ -691,6 +694,7 @@ public static class DefaultAlgorithms new Algorithm(MinerBaseType.CryptoDredge, AlgorithmType.NeoScrypt, "NeoScrypt"), //после переключения монет реджекты //new Algorithm(MinerBaseType.CryptoDredge, AlgorithmType.Cryptonight_GPU, "Cryptonight_GPU"), + new Algorithm(MinerBaseType.CryptoDredge, AlgorithmType.Allium, "Allium"), new Algorithm(MinerBaseType.CryptoDredge, AlgorithmType.SHA256csm, "SHA256csm"), //new Algorithm(MinerBaseType.CryptoDredge, AlgorithmType.FiroPow, "FiroPow") } @@ -731,6 +735,9 @@ public static class DefaultAlgorithms }, new Algorithm(MinerBaseType.miniZ, AlgorithmType.Ethashb3, "Ethashb3") { + }, + new Algorithm(MinerBaseType.miniZ, AlgorithmType.Meraki, "Meraki") + { } } }, diff --git a/ZergPoolMiner/Devices/Algorithms/GroupAlgorithms.cs b/ZergPoolMiner/Devices/Algorithms/GroupAlgorithms.cs index 877958c..c4a4461 100644 --- a/ZergPoolMiner/Devices/Algorithms/GroupAlgorithms.cs +++ b/ZergPoolMiner/Devices/Algorithms/GroupAlgorithms.cs @@ -52,6 +52,14 @@ private static Dictionary> CreateForDevice(Comput }); } + if (device.GpuRam < (ulong)(1024 * 1024 * 1024 * 8.2)) + { + algoSettings = FilterMinerAlgos(algoSettings, new List + { + AlgorithmType.FiroPow + }); + } + //lite algo? if (device.GpuRam < (ulong)(1024 * 1024 * 1024 * 7.5)) { diff --git a/ZergPoolMiner/Forms/Form_Main.Designer.cs b/ZergPoolMiner/Forms/Form_Main.Designer.cs index 64c7a72..b092388 100644 --- a/ZergPoolMiner/Forms/Form_Main.Designer.cs +++ b/ZergPoolMiner/Forms/Form_Main.Designer.cs @@ -433,6 +433,7 @@ private void InitializeComponent() this.linkLabelNewVersion.Text = "link"; this.linkLabelNewVersion.TextAlign = System.Drawing.ContentAlignment.TopRight; this.linkLabelNewVersion.Visible = false; + this.linkLabelNewVersion.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelNewVersion_LinkClicked_1); // // flowLayoutPanel1 // diff --git a/ZergPoolMiner/Forms/Form_Main.cs b/ZergPoolMiner/Forms/Form_Main.cs index 4b93f5a..175af52 100644 --- a/ZergPoolMiner/Forms/Form_Main.cs +++ b/ZergPoolMiner/Forms/Form_Main.cs @@ -75,6 +75,9 @@ public partial class Form_Main : Form, Form_Loading.IAfterInitializationCaller, public static bool _demoMode; public static string _PayoutTreshold = ",pl=0"; + public static string wallet = ""; + public static string worker = ""; + public static string payoutCurrency = ""; private readonly Random R; private Form_Loading _loadingScreen; @@ -3403,14 +3406,20 @@ public StartMiningReturnType StartMining(bool showWarnings) InitFlowPanelStart(); ClearRatesAll(); bool isMining; + payoutCurrency = ConfigManager.GeneralConfig.PayoutCurrency; _PayoutTreshold = ",pl=" + ConfigManager.GeneralConfig.PayoutCurrencyTreshold.ToString(); + worker = Miner.GetFullWorkerName(); + wallet = ConfigManager.GeneralConfig.Wallet; if (_demoMode) { + worker = "demo"; + payoutCurrency = "LTC"; _PayoutTreshold = ",pl=0"; + wallet = Globals.DemoUser; } + var password = " c=" + payoutCurrency + _PayoutTreshold + ",ID=" + worker; - isMining = MinersManager.StartInitialize(this, textBoxWorkerName.Text.Trim(), - ConfigManager.GeneralConfig.Wallet, ConfigManager.GeneralConfig.PayoutCurrency); + isMining = MinersManager.StartInitialize(this, wallet, password); if (!_demoMode) ConfigManager.GeneralConfigFileCommit(); _minerStatsCheck.Start(); @@ -3983,6 +3992,21 @@ private void Form_Main_Activated(object sender, EventArgs e) { this.Width = ConfigManager.GeneralConfig.FormWidth; } + + private void linkLabelNewVersion_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e) + { + settings = new Form_Settings(); + try + { + // SetChildFormCenter(settings); + settings.tabControlGeneral.SelectedTab = settings.tabPageAbout; + settings.ShowDialog(); + } + catch (Exception er) + { + Helpers.ConsolePrint("settings", er.ToString()); + } + } } static class TimeSpanExtensions diff --git a/ZergPoolMiner/Forms/Form_Settings.cs b/ZergPoolMiner/Forms/Form_Settings.cs index 7445437..08b949c 100644 --- a/ZergPoolMiner/Forms/Form_Settings.cs +++ b/ZergPoolMiner/Forms/Form_Settings.cs @@ -69,6 +69,7 @@ public Form_Settings() button_ZIL_additional_mining.Visible = false; button_Lite_Algo.Visible = false; + groupBoxConnection.Visible = false; IsChange = false; IsChangeSaved = false; diff --git a/ZergPoolMiner/Miners/ClaymoreNeoscryptMiner.cs b/ZergPoolMiner/Miners/ClaymoreNeoscryptMiner.cs index 9011a45..b333e51 100644 --- a/ZergPoolMiner/Miners/ClaymoreNeoscryptMiner.cs +++ b/ZergPoolMiner/Miners/ClaymoreNeoscryptMiner.cs @@ -16,15 +16,11 @@ public ClaymoreNeoscryptMiner() } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { - string psw = "c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName(); - if (ConfigManager.GeneralConfig.StaleProxy) psw = "stale"; - string username = ConfigManager.GeneralConfig.Wallet; - LastCommandLine = " " + GetDevicesCommandString() + " -mport -" + ApiPort + - GetServer("neoscrypt") + - " -wal " + username + " -psw " + psw + " -dbg -1 -ftime 10 -retrydelay 5"; + LastCommandLine = " " + GetDevicesCommandString() + " -mport -" + ApiPort + " -pool " + + GetServer("neoscrypt").Replace("stratum+ssl://", "stratum+tcp://").Replace("14233", "4233") + + " -wal " + wallet + " -psw " + password + " -dbg -1 -ftime 10 -retrydelay 5"; ProcessHandle = _Start(); } diff --git a/ZergPoolMiner/Miners/CryptoDredge.cs b/ZergPoolMiner/Miners/CryptoDredge.cs index 8e8c96b..445f051 100644 --- a/ZergPoolMiner/Miners/CryptoDredge.cs +++ b/ZergPoolMiner/Miners/CryptoDredge.cs @@ -29,7 +29,7 @@ protected override int GetMaxCooldownTimeInMilliseconds() return 60 * 1000 * 8; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { if (!IsInit) { @@ -40,16 +40,15 @@ public override void Start(string btcAdress, string worker) var apiBind = " --api-bind 127.0.0.1:" + ApiPort + " "; IsApiReadException = false; - string wallet = "--user " + ConfigManager.GeneralConfig.Wallet; - string password = " -p c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _wallet = "--user " + wallet; + string _password = " -p " + password + " "; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); _algo = _algo.Replace("cryptonight_gpu", "cngpu"); LastCommandLine = " --algo " + _algo + " " + apiBind + - " -o " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + + " -o stratum+ssl://" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + + _wallet + " " + _password + " -d " + GetDevicesCommandString() + " " + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.NVIDIA) + " "; @@ -161,6 +160,10 @@ protected override void BenchmarkThreadRoutine(object commandLine) delay_before_calc_hashrate = 10; MinerStartDelay = 20; } + if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Allium)) + { + _benchmarkTimeWait = _benchmarkTimeWait + 120; + } Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTag(), "Benchmark should end in: " + _benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)commandLine); diff --git a/ZergPoolMiner/Miners/GMiner.cs b/ZergPoolMiner/Miners/GMiner.cs index 1e6d93c..c994c12 100644 --- a/ZergPoolMiner/Miners/GMiner.cs +++ b/ZergPoolMiner/Miners/GMiner.cs @@ -40,11 +40,11 @@ public GMiner(AlgorithmType secondaryAlgorithmType) : base("GMiner") IsMultiType = true; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { string url = ""; - LastCommandLine = GetStartCommand(url, btcAdress, worker); + LastCommandLine = GetStartCommand(url, wallet, password); const string vcp = "msvcp120.dll"; var vcpPath = WorkingDirectory + vcp; if (!File.Exists(vcpPath)) @@ -75,7 +75,7 @@ protected override void _Stop(MinerStopType willswitch) Stop_cpu_ccminer_sgminer_nheqminer(willswitch); KillGminer(); } - private string GetStartCommand(string url, string btcAddress, string worker) + private string GetStartCommand(string url, string wallet, string password) { string ZilMining = ""; DeviceType devtype = DeviceType.NVIDIA; @@ -101,20 +101,19 @@ private string GetStartCommand(string url, string btcAddress, string worker) ConfigManager.GeneralConfig.ZIL_mining_state == 2) { ZilMining = " --zilserver " + ConfigManager.GeneralConfig.ZIL_mining_pool + ":" + - ConfigManager.GeneralConfig.ZIL_mining_port + " --ziluser " + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + worker + " "; + ConfigManager.GeneralConfig.ZIL_mining_port + " --ziluser " + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + wallet + " "; } - string wallet = "--user " + ConfigManager.GeneralConfig.Wallet; - string password = " -p c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _wallet = "--user " + wallet; + var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); _algo = _algo.Replace("equihash125", "equihash125_4"); _algo = _algo.Replace("equihash144", "equihash144_5 --pers auto"); return " --algo " + _algo + " " + $"--api {ApiPort} " + " " + - " -s " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + + " --ssl -s " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + + "-u " + wallet + " -p " + password + " " + GetDevicesCommandString().Trim(); } diff --git a/ZergPoolMiner/Miners/Grouping/GroupMiner.cs b/ZergPoolMiner/Miners/Grouping/GroupMiner.cs index 742cb56..042c84f 100644 --- a/ZergPoolMiner/Miners/Grouping/GroupMiner.cs +++ b/ZergPoolMiner/Miners/Grouping/GroupMiner.cs @@ -119,7 +119,7 @@ public void End() PowerRate = 0; } - public void Start(string btcAdress, string worker) + public void Start(string wallet, string password) { if (Miner.IsRunning) { @@ -128,7 +128,7 @@ public void Start(string btcAdress, string worker) // Wait before new start System.Threading.Thread.Sleep(100); //var locationUrl = Globals.GetLocationUrl(AlgorithmType, miningLocation, Miner.ConectionType); - Miner.Start(btcAdress, worker); + Miner.Start(wallet, password); Thread.Sleep(Math.Max(ConfigManager.GeneralConfig.MinerRestartDelayMS, 500)); } } diff --git a/ZergPoolMiner/Miners/Miner.cs b/ZergPoolMiner/Miners/Miner.cs index f35b5e9..4968077 100644 --- a/ZergPoolMiner/Miners/Miner.cs +++ b/ZergPoolMiner/Miners/Miner.cs @@ -26,6 +26,7 @@ using System.Timers; using System.Windows.Forms; using Timer = System.Timers.Timer; +using ZergPoolMinerLegacy.UUID; namespace ZergPoolMiner { @@ -446,7 +447,7 @@ public void KillAllUsedMinerProcesses() _allPidData.RemoveAll(x => toRemovePidData.Contains(x)); } - public abstract void Start(string btcAdress, string worker); + public abstract void Start(string wallet, string password); protected abstract void _Stop(MinerStopType willswitch); @@ -670,6 +671,11 @@ protected virtual Process BenchmarkStartProcess(string commandLine) { benchmarkHandle.StartInfo.FileName = benchmarkHandle.StartInfo.FileName.Replace("CryptoDredge.exe", "CryptoDredge.0.25.1.exe"); } + if (benchmarkHandle.StartInfo.FileName.ToLower().Contains("cryptodredge") && + (commandLine.ToLower().Contains("allium"))) + { + benchmarkHandle.StartInfo.FileName = benchmarkHandle.StartInfo.FileName.Replace("CryptoDredge.exe", "CryptoDredge.0.23.0.exe"); + } if (benchmarkHandle.StartInfo.FileName.ToLower().Contains("t-rex") && (commandLine.ToLower().Contains("x16r") || commandLine.ToLower().Contains("x16rv2") || commandLine.ToLower().Contains("x21s") || @@ -1202,10 +1208,11 @@ public string GetServer(string algo) string ret = ""; try { + algo = algo.Replace("-", "_"); var _a = Stats.Stats.MiningAlgorithmsList.FirstOrDefault(item => item.name.ToLower() == algo.ToLower()); string serverUrl = Form_Main.regionList[ConfigManager.GeneralConfig.ServiceLocation].RegionLocation + "mine.zergpool.com"; - ret = Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "") + ":" + _a.port.ToString(); + ret = Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "") + ":" + _a.tls_port.ToString(); } catch (Exception ex) { @@ -1368,6 +1375,11 @@ protected virtual MinerProcess _Start() { Path = MiningSetup.MinerPath.Replace("CryptoDredge.exe", "CryptoDredge.0.25.1.exe"); } + if (MiningSetup.MinerPath.ToLower().Contains("cryptodredge") && + (LastCommandLine.ToLower().Contains("allium"))) + { + Path = MiningSetup.MinerPath.Replace("CryptoDredge.exe", "CryptoDredge.0.23.0.exe"); + } if (MiningSetup.MinerPath.ToLower().Contains("t-rex") && (LastCommandLine.ToLower().Contains("x16r") || LastCommandLine.ToLower().Contains("x16rv2") || LastCommandLine.ToLower().Contains("x21s") || @@ -1451,7 +1463,7 @@ protected virtual MinerProcess _Start() int algo = (int)MiningSetup.CurrentAlgorithmType; int algo2 = (int)MiningSetup.CurrentSecondaryAlgorithmType; - string w = Stats.Stats.GetFullWorkerName(); + string w = GetFullWorkerName(); NativeOverclock.OverclockStart(P.Id, algo, algo2, Path, strPlatform, w, false); @@ -1471,6 +1483,22 @@ protected virtual MinerProcess _Start() } } + public static string GetFullWorkerName() + { + string mac = WindowsMacUtils.GetMACAddress(); + string w = ""; + + if (string.IsNullOrEmpty(ConfigManager.GeneralConfig.WorkerName.Trim())) + { + w = "demo"; + } + else + { + w = ConfigManager.GeneralConfig.WorkerName.Trim(); + } + return w + mac; + } + protected void StartCoolDownTimerChecker() { if (ConfigManager.GeneralConfig.CoolDownCheckEnabled) diff --git a/ZergPoolMiner/Miners/MinerVersion.cs b/ZergPoolMiner/Miners/MinerVersion.cs index 788b567..30b5da8 100644 --- a/ZergPoolMiner/Miners/MinerVersion.cs +++ b/ZergPoolMiner/Miners/MinerVersion.cs @@ -1299,6 +1299,10 @@ public static string GetMinerFakeVersion(string miner, string algo) { miner = miner + " 0.25.1"; } + else if (miner.ToLower().Contains("cryptodredge") && (algo.ToLower().Contains("allium"))) + { + miner = miner + " 0.23.0"; + } else { miner = miner + MinerVersion.GetMinerVersion(miner); diff --git a/ZergPoolMiner/Miners/MinersManager.cs b/ZergPoolMiner/Miners/MinersManager.cs index 6e919de..2abffdb 100644 --- a/ZergPoolMiner/Miners/MinersManager.cs +++ b/ZergPoolMiner/Miners/MinersManager.cs @@ -45,10 +45,10 @@ public static double GetTotalPower() } public static bool StartInitialize(IMainFormRatesComunication mainFormRatesComunication, - string worker, string btcAdress, string payoutCurrency) + string wallet, string password) { _curMiningSession = new MiningSession(ComputeDeviceManager.Available.Devices, - mainFormRatesComunication, worker, btcAdress, payoutCurrency); + mainFormRatesComunication, wallet, password); return _curMiningSession.IsMiningEnabled; } diff --git a/ZergPoolMiner/Miners/MiningSession.cs b/ZergPoolMiner/Miners/MiningSession.cs index 8b0d506..9de6867 100644 --- a/ZergPoolMiner/Miners/MiningSession.cs +++ b/ZergPoolMiner/Miners/MiningSession.cs @@ -36,9 +36,8 @@ public class MiningSession // session varibles fixed //public static string _miningLocation; - public static string _btcAdress; - public static string _payoutCurrency; - public static string _worker; + public static string _wallet; + public static string _password; public static List _miningDevices; private readonly IMainFormRatesComunication _mainFormRatesComunication; @@ -96,7 +95,7 @@ public static void StopEvent() public MiningSession(List devices, IMainFormRatesComunication mainFormRatesComunication, - string worker, string btcAdress, string payoutCurrency) + string wallet, string password) { _ticks = new int[devices.Count]; for (int d = 0; d < _ticks.Length; d++) @@ -109,9 +108,8 @@ public MiningSession(List devices, _switchingManager = new AlgorithmSwitchingManager(); _miningDevices = GroupSetupUtils.GetMiningDevices(devices, true); - _btcAdress = btcAdress; - _payoutCurrency = payoutCurrency; - _worker = worker; + _wallet = wallet; + _password = password; // initial settup if (_miningDevices.Count > 0) @@ -426,6 +424,7 @@ private bool CheckIfShouldMine(double currentProfit, bool log = true) } else { + Helpers.ConsolePrint("CheckIfShouldMine", "MINING NOT PROFITABLE!"); _mainFormRatesComunication.ShowNotProfitable( International.GetText("Form_Main_MINING_NOT_PROFITABLE")); } @@ -472,6 +471,8 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e stringBuilderFull.AppendLine("Current device profits:"); double smaTmp = 0; + bool algoZero = false; + string algoZeroS = ""; Form_Main.KawpowLiteEnabled = false; foreach (var device in _miningDevices) { @@ -482,6 +483,16 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e Form_Main.KawpowLiteEnabled = true; } smaTmp = smaTmp + algo.CurNhmSmaDataVal; + + if (algo.CurPayingRatio + algo.CurSecondPayingRatio == 0) + { + if ((AlgorithmType)device.Device.AlgorithmID == algo.ZergPoolID || + (AlgorithmType)device.Device.SecondAlgorithmID == algo.DualZergPoolID) + { + algoZero = true; + algoZeroS = algo.AlgorithmName; + } + } } // most profitable string profitStr = ExchangeRateApi.ConvertBTCToNationalCurrency(device.GetCurrentMostProfitValueWithoutPower).ToString("F2") + " " + @@ -567,6 +578,13 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e double b = Math.Min(prevStateProfit, currentProfit); percDiff = ((a - b)) / Math.Abs(b); + if (percDiff > 10 && percDiff < 1000) //1000% + { + Helpers.ConsolePrint(Tag, + $"SWITCH DISABLED due api error. Profit diff is {Math.Round(percDiff * 100, 2):f2}%, current threshold {ConfigManager.GeneralConfig.SwitchProfitabilityThreshold * 100}%"); + return; + } + if (percDiff <= ConfigManager.GeneralConfig.SwitchProfitabilityThreshold) { // don't switch @@ -586,7 +604,7 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e { if (!KawpowLiteForceStop) { - if (Form_Main.adaptiveRunning) + if (Form_Main.adaptiveRunning && !algoZero) { Helpers.ConsolePrint(Tag, "Switching temporary disabled because adaptive algo is running"); needSwitch = false; @@ -687,6 +705,12 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e var a = Math.Max(prevStateProfit, currentProfit); var b = Math.Min(prevStateProfit, currentProfit); percDiff = ((a - b)) / Math.Abs(b); + if (percDiff > 10 && percDiff < 1000) //1000% + { + Helpers.ConsolePrint(Tag, + $"SWITCH DISABLED due api error. Profit diff is {Math.Round(percDiff * 100, 2):f2}%, current threshold {ConfigManager.GeneralConfig.SwitchProfitabilityThreshold * 100}%"); + return; + } if (percDiff <= ConfigManager.GeneralConfig.SwitchProfitabilityThreshold) { // don't switch @@ -715,7 +739,7 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e { if (!KawpowLiteForceStop) { - if (Form_Main.adaptiveRunning) + if (Form_Main.adaptiveRunning && !algoZero) { Helpers.ConsolePrint(Tag, "Switching temporary disabled because adaptive algo is running"); needSwitch = false; @@ -810,6 +834,11 @@ public void SwichMostProfitableGroupUpMethod(object sender, SmaUpdateEventArgs e KawpowLiteForceStop = false; needSwitch = true; } + if (algoZero) + { + Helpers.ConsolePrint(Tag, "Force switch from zero or deleted algo " + algoZeroS); + needSwitch = true; + } if (!needSwitch) { @@ -972,11 +1001,11 @@ private void NewGrouping(List profitableDevices) if (ConfigManager.GeneralConfig.ServiceLocation == 0) { - toStart.Start(_btcAdress, _worker); + toStart.Start(_wallet, _password); } else { - toStart.Start(_btcAdress, _worker); + toStart.Start(_wallet, _password); } _runningGroupMiners[toStart.Key] = toStart; } diff --git a/ZergPoolMiner/Miners/Nanominer.cs b/ZergPoolMiner/Miners/Nanominer.cs index f4baf49..9d14343 100644 --- a/ZergPoolMiner/Miners/Nanominer.cs +++ b/ZergPoolMiner/Miners/Nanominer.cs @@ -36,9 +36,9 @@ public Nanominer() : base("Nanominer") ConectionType = NhmConectionType.NONE; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { - LastCommandLine = GetStartCommand(btcAdress, worker); + LastCommandLine = GetStartCommand(wallet, password); ProcessHandle = _Start(); try { @@ -59,12 +59,12 @@ private string GetServer(string algo) string ret = ""; try { - algo = algo.Replace("xelisv2_pepew", "xelisv2-pepew"); + algo = algo.Replace("-", "_"); var _a = Stats.Stats.MiningAlgorithmsList.FirstOrDefault(item => item.name.ToLower() == algo.ToLower()); string serverUrl = Form_Main.regionList[ConfigManager.GeneralConfig.ServiceLocation].RegionLocation + "mine.zergpool.com"; - ret = "pool1 = " + Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "") + ":" + _a.port.ToString(); + ret = "pool1 = " + Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "") + ":" + _a.tls_port.ToString(); } catch (Exception ex) { @@ -74,7 +74,7 @@ private string GetServer(string algo) return ret + " "; } - private string GetStartCommand(string btcAdress, string worker) + private string GetStartCommand(string wallet, string password) { IsInBenchmark = false; var param = ""; @@ -155,9 +155,8 @@ private string GetStartCommand(string btcAdress, string worker) + String.Format(param) + "\n" + String.Format("coin = VRSC\n") + String.Format("devices = {0}", GetDevicesCommandString()) + "\n" - + String.Format("wallet = {0}", ConfigManager.GeneralConfig.Wallet) + "\n" - + String.Format("rigPassword= {0}", "c=" + ConfigManager.GeneralConfig.PayoutCurrency.Trim() - + Form_Main._PayoutTreshold + ",ID=" + Stats.Stats.GetFullWorkerName()) + "\n" + + String.Format("wallet = {0}", wallet.Trim()) + "\n" + + String.Format("rigPassword= {0}", password.Trim()) + "\n" + String.Format("protocol = stratum\n") + String.Format("watchdog = false\n") + GetServer("verushash"); @@ -362,7 +361,7 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti + string.Format("devices = {0}", GetDevicesCommandString()) + "\n" + string.Format("wallet = {0}", Globals.DemoUser) + "\n" + string.Format("rigPassword= {0}", "c=LTC" + - ",ID=" + Stats.Stats.GetFullWorkerName()) + "\n" + ",ID=" + Miner.GetFullWorkerName()) + "\n" + string.Format("protocol = stratum\n") + string.Format("watchdog = false\n") + GetServer("verushash"); @@ -389,7 +388,7 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti + String.Format("devices = {0}", GetDevicesCommandString().Trim(' ')) + "\n" + string.Format("wallet = {0}", Globals.DemoUser) + "\n" + string.Format("rigPassword= {0}", "c=LTC" + - ",ID=" + Stats.Stats.GetFullWorkerName()) + "\n" + ",ID=" + Miner.GetFullWorkerName()) + "\n" + string.Format("protocol = stratum\n") + string.Format("watchdog = false\n") + GetServer("kawpow"); diff --git a/ZergPoolMiner/Miners/Rigel.cs b/ZergPoolMiner/Miners/Rigel.cs index 746e4bb..f8c42ef 100644 --- a/ZergPoolMiner/Miners/Rigel.cs +++ b/ZergPoolMiner/Miners/Rigel.cs @@ -34,11 +34,11 @@ public Rigel() : base("Rigel") ConectionType = NhmConectionType.NONE; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { string url = ""; RejectsLimit = ConfigManager.GeneralConfig.KAWPOW_Rigel_Max_Rejects; - LastCommandLine = GetStartCommand(url, btcAdress, worker); + LastCommandLine = GetStartCommand(url, wallet, password); ProcessHandle = _Start(); } @@ -54,7 +54,7 @@ protected override void _Stop(MinerStopType willswitch) Stop_cpu_ccminer_sgminer_nheqminer(willswitch); KillRigel(); } - private string GetStartCommand(string url, string btcAddress, string worker) + private string GetStartCommand(string url, string wallet, string password) { var algo = ""; var algo2 = ""; @@ -95,7 +95,7 @@ private string GetStartCommand(string url, string btcAddress, string worker) { ZilMining = " -o [2]ethstratum+tcp://" + ConfigManager.GeneralConfig.ZIL_mining_pool.Replace("stratum+tcp://", "") + ":" + ConfigManager.GeneralConfig.ZIL_mining_port + - " -u [2]" + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + worker + " "; + " -u [2]" + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + "worker" + " "; } } if (Form_additional_mining.isAlgoZIL(MiningSetup.AlgorithmName, MinerBaseType.Rigel, devtype) && @@ -112,33 +112,30 @@ private string GetStartCommand(string url, string btcAddress, string worker) { ZilMining = " -o [3]ethstratum+tcp://" + ConfigManager.GeneralConfig.ZIL_mining_pool.Replace("stratum+tcp://", "") + ":" + ConfigManager.GeneralConfig.ZIL_mining_port + - " -u [3]" + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + worker + " "; + " -u [3]" + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + "worker" + " "; } } if (MiningSetup.CurrentSecondaryAlgorithmType == AlgorithmType.NONE)//single { - string wallet = "-u " + ConfigManager.GeneralConfig.Wallet; - string password = " -p c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _wallet = "-u " + wallet; + string _password = "-p " + password + " "; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); _algo = _algo.Replace("equihash125", "equihash125_4"); _algo = _algo.Replace("equihash144", "equihash144_5 --pers auto"); return " -a " + _algo + " " + $"--api-bind 127.0.0.1:{ApiPort} " + " " + - "-o stratum+tcp://" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + + "-o stratum+ssl://" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + + _wallet + " " + _password + GetDevicesCommandString().Trim(); } else //dual { - string wallet = "-u [1]" + ConfigManager.GeneralConfig.Wallet + " -u [2]" + ConfigManager.GeneralConfig.Wallet; - string password = " -p [1]c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " " + - " -p [2]c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _wallet = "-u [1]" + wallet + " -u [2]" + wallet; + string _password = "-p [1]" + password + " " + + " -p [2]" + password + " "; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); var _algo2 = MiningSetup.CurrentSecondaryAlgorithmType.ToString().ToLower(); @@ -146,7 +143,7 @@ private string GetStartCommand(string url, string btcAddress, string worker) " " + $"--api-bind 127.0.0.1:{ApiPort} " + " " + GetServerDual(MiningSetup.CurrentAlgorithmType.ToString().ToLower(), MiningSetup.CurrentSecondaryAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + " " + + _wallet + " " + _password + " " + GetDevicesCommandString().Trim(); } return "Ooops"; @@ -157,6 +154,7 @@ public string GetServerDual(string algo, string algo2) string ret = ""; try { + algo = algo.Replace("-", "_"); var _a = Stats.Stats.MiningAlgorithmsList.FirstOrDefault(item => item.name.ToLower() == algo.ToLower()); var _a2 = Stats.Stats.MiningAlgorithmsList.FirstOrDefault(item => item.name.ToLower() == algo2.ToLower()); string serverUrl = Form_Main.regionList[ConfigManager.GeneralConfig.ServiceLocation].RegionLocation + @@ -345,7 +343,7 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti ret = " --no-colour -a " + _algo + " " + $"--api-bind 127.0.0.1:{ApiPort} " + " " + - "-o stratum+tcp://" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + + "-o stratum+ssl://" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + wallet + " " + password + " " + GetDevicesCommandString().Trim(); } diff --git a/ZergPoolMiner/Miners/SRBMiner.cs b/ZergPoolMiner/Miners/SRBMiner.cs index e7a852d..1105128 100644 --- a/ZergPoolMiner/Miners/SRBMiner.cs +++ b/ZergPoolMiner/Miners/SRBMiner.cs @@ -33,9 +33,9 @@ public SRBMiner() : base("SRBMiner") GPUPlatformNumber = ComputeDeviceManager.Available.AmdOpenCLPlatformNum; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { - LastCommandLine = GetStartCommand(btcAdress, worker); + LastCommandLine = GetStartCommand(wallet, password); ProcessHandle = _Start(); } private new string GetServer(string algo) @@ -43,12 +43,14 @@ public override void Start(string btcAdress, string worker) string ret = ""; try { - algo = algo.Replace("xelisv2_pepew", "xelisv2-pepew"); + algo = algo.Replace("-", "_"); var _a = Stats.Stats.MiningAlgorithmsList.FirstOrDefault(item => item.name.ToLower() == algo.ToLower()); string serverUrl = Form_Main.regionList[ConfigManager.GeneralConfig.ServiceLocation].RegionLocation + "mine.zergpool.com"; - ret = "--pool " + Links.CheckDNS(algo + serverUrl) + ":" + _a.port.ToString(); + + ret = "--pool " + Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "stratum+ssl://") + + ":" + _a.tls_port.ToString(); } catch (Exception ex) { Helpers.ConsolePrint("GetServer", "Error in " + algo + " " + ex.ToString()); @@ -58,7 +60,7 @@ public override void Start(string btcAdress, string worker) return ret + " "; } - private string GetStartCommand(string btcAddress, string worker) + private string GetStartCommand(string wallet, string password) { string ZilMining = ""; string disablePlatform = "--disable-gpu-nvidia "; @@ -88,7 +90,7 @@ private string GetStartCommand(string btcAddress, string worker) // ZilMining = " --zil-enable --zil-pool " + ConfigManager.GeneralConfig.ZIL_mining_pool + ":" + ConfigManager.GeneralConfig.ZIL_mining_port + " --zil-wallet " + - ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + worker + " --zil-esm 2 --disable-worker-watchdog "; + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + "worker" + " --zil-esm 2 --disable-worker-watchdog "; } if (devtype == DeviceType.CPU) @@ -111,9 +113,8 @@ private string GetStartCommand(string btcAddress, string worker) var extras = ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, devtype); try { - string wallet = "--wallet " + ConfigManager.GeneralConfig.Wallet; - string password = " --password c=" + ConfigManager.GeneralConfig.PayoutCurrency + - Form_Main._PayoutTreshold + ",ID=" + Stats.Stats.GetFullWorkerName(); + string _wallet = "--wallet " + wallet; + string _password = " --password " + password; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); _algo = _algo.Replace("sha512256d", "sha512_256d_radiant"); @@ -122,7 +123,7 @@ private string GetStartCommand(string btcAddress, string worker) return " --algorithm " + _algo + " " + disablePlatform + $"--api-enable --api-port {ApiPort} {extras} " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + + _wallet + " " + _password + " --gpu-id " + GetDevicesCommandString().Trim(); } else @@ -132,10 +133,10 @@ private string GetStartCommand(string btcAddress, string worker) return " --algorithm " + _algo + " " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + " " + + _wallet + " " + _password + " " + " --algorithm " + _algo2 + " " + GetServer(MiningSetup.CurrentSecondaryAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + + _wallet + " " + _password + " " + disablePlatform + $"--api-enable --api-port {ApiPort} {extras} " + " --gpu-id " + GetDevicesCommandString().Trim(); @@ -634,7 +635,7 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti { benchmarkTimeWait = time; _benchmarkTimeWait = time; - return GetStartBenchmarkCommand(Globals.GetBitcoinUser(), Stats.Stats.GetFullWorkerName()); + return GetStartBenchmarkCommand(Globals.DemoUser, Miner.GetFullWorkerName()); } protected override void BenchmarkOutputErrorDataReceivedImpl(string outdata) diff --git a/ZergPoolMiner/Miners/Xmrig.cs b/ZergPoolMiner/Miners/Xmrig.cs index 2687e95..ef61767 100644 --- a/ZergPoolMiner/Miners/Xmrig.cs +++ b/ZergPoolMiner/Miners/Xmrig.cs @@ -33,9 +33,9 @@ public class Xmrig : Miner double _powerUsage = 0; public Xmrig() : base("Xmrig") { } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { - LastCommandLine = GetStartCommand(btcAdress, worker); + LastCommandLine = GetStartCommand(wallet, password); ProcessHandle = _Start(); } @@ -53,7 +53,7 @@ protected override string GetDevicesCommandString() return deviceStringCommand; } - private string GetStartCommand(string btcAdress, string worker) + private string GetStartCommand(string wallet, string password) { var extras = ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.CPU); foreach (var pair in MiningSetup.MiningPairs) @@ -72,19 +72,18 @@ private string GetStartCommand(string btcAdress, string worker) } } - string wallet = "-u " + ConfigManager.GeneralConfig.Wallet.Trim() + "." + Stats.Stats.GetFullWorkerName() + - ":c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _wallet = "-u " + wallet + ".xmrig" + + ":" + password.Trim() + " "; if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.RandomX)) { - return " --algo=rx/0 " + GetServer("randomx") + wallet + extras + " --http-port " + ApiPort + + return " --algo=rx/0 " + GetServer("randomx") + _wallet + extras + " --http-port " + ApiPort + platform + " " + $"--http-port { ApiPort} " + GetDevicesCommandString().TrimStart(); } if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Ghostrider)) { - return " --algo=gr " + GetServer("ghostrider") + wallet + extras + " --http-port " + ApiPort + + return " --algo=gr " + GetServer("ghostrider") + _wallet + extras + " --http-port " + ApiPort + platform + " " + $"--http-port { ApiPort} "+ GetDevicesCommandString().TrimStart(); } @@ -95,11 +94,12 @@ private string GetServer(string algo) string ret = ""; try { + algo = algo.Replace("-", "_"); var _a = Stats.Stats.MiningAlgorithmsList.FirstOrDefault(item => item.name.ToLower() == algo.ToLower()); string serverUrl = Form_Main.regionList[ConfigManager.GeneralConfig.ServiceLocation].RegionLocation + "mine.zergpool.com"; - ret = "-o " + Links.CheckDNS(algo + serverUrl) + ":" + _a.port.ToString(); + ret = "-o " + Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "stratum+ssl://") + ":" + _a.tls_port.ToString(); } catch (Exception ex) { diff --git a/ZergPoolMiner/Miners/ZilClient.cs b/ZergPoolMiner/Miners/ZilClient.cs index 22db52e..200dfd3 100644 --- a/ZergPoolMiner/Miners/ZilClient.cs +++ b/ZergPoolMiner/Miners/ZilClient.cs @@ -375,7 +375,7 @@ public static void ReadFromServer(Stream serverStream, TcpClient tcpClient) //о string subscribe = "{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": [\"EthereumMiner/1.0.0\", \"EthereumStratum/1.0.0\"]}" + (char)10; string btcAdress = Configs.ConfigManager.GeneralConfig.Wallet; - string worker = Stats.Stats.GetFullWorkerName(); + string worker = "worker"; string username = btcAdress + "." + worker + "$" + ZergPoolMiner.Stats.Socket.RigID; string extranonce = "{\"id\":2, \"method\": \"mining.extranonce.subscribe\", \"params\": []}" + (char)10; string authorize = "{\"id\": 2, \"method\": \"mining.authorize\", \"params\": [\"" + username + "\", \"x\"]}" + (char)10; diff --git a/ZergPoolMiner/Miners/lolMiner.cs b/ZergPoolMiner/Miners/lolMiner.cs index f7314dd..f9618bb 100644 --- a/ZergPoolMiner/Miners/lolMiner.cs +++ b/ZergPoolMiner/Miners/lolMiner.cs @@ -99,10 +99,9 @@ private string GetServerDual(string algo, string algo2, string algo2pool, string } return ret; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { string url = ""; - worker = worker + "$" + ConfigManager.GeneralConfig.MachineGuid; if (!IsInit) { Helpers.ConsolePrint(MinerTag(), "MiningSetup is not initialized exiting Start()"); @@ -130,8 +129,7 @@ public override void Start(string btcAdress, string worker) IsApiReadException = false; - string password = " --pass=c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _password = " --pass=" + password + " "; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); _algo = _algo.Replace("equihash125", "-a FLUX"); _algo = _algo.Replace("equihash144", "--coin AUTO144_5"); @@ -148,20 +146,20 @@ public override void Start(string btcAdress, string worker) { LastCommandLine = _algo + - " -p " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + - " -u " + ConfigManager.GeneralConfig.Wallet + password + + " --tls on -p " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + + " -u " + wallet + password + " --apiport " + ApiPort + " --devices " + GetDevicesCommandString().Trim(); } else { LastCommandLine = _algo + - " -p " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + + " --tls on -p " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " -u " + ConfigManager.GeneralConfig.Wallet + password + "--dualmode PYRINV2DUAL " + " --dualpool " + GetServer(MiningSetup.CurrentSecondaryAlgorithmType.ToString().ToLower()) + " --dualuser " + ConfigManager.GeneralConfig.Wallet + " --dualpass c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + - ",ID=" + Stats.Stats.GetFullWorkerName() + + ",ID=" + Miner.GetFullWorkerName() + " --devices " + GetDevicesCommandString().Trim() + " --apiport " + ApiPort; } @@ -215,7 +213,7 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti if (MiningSetup.CurrentSecondaryAlgorithmType == AlgorithmType.NONE) { CommandLine = _algo + - " -p " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + + " --tls on -p " + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " -u " + Globals.DemoUser + " --pass c=LTC" + " --apiport " + ApiPort + diff --git a/ZergPoolMiner/Miners/miniZ.cs b/ZergPoolMiner/Miners/miniZ.cs index bebe11b..5e5401f 100644 --- a/ZergPoolMiner/Miners/miniZ.cs +++ b/ZergPoolMiner/Miners/miniZ.cs @@ -60,14 +60,14 @@ public miniZ() : base("miniZ") ConectionType = NhmConectionType.NONE; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { IsApiReadException = false; - LastCommandLine = GetStartCommand(btcAdress, worker); + LastCommandLine = GetStartCommand(wallet, password); ProcessHandle = _Start(); } - private string GetStartCommand(string btcAddress, string worker) + private string GetStartCommand(string wallet, string password) { string ZilMining = ""; DeviceType devtype = DeviceType.NVIDIA; @@ -107,7 +107,7 @@ private string GetStartCommand(string btcAddress, string worker) if (Form_additional_mining.isAlgoZIL(MiningSetup.AlgorithmName, MinerBaseType.miniZ, devtype) && ConfigManager.GeneralConfig.ZIL_mining_state == 2) { - ZilMining = " --url " + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + worker + "@" + + ZilMining = " --url " + ConfigManager.GeneralConfig.ZIL_mining_wallet + "." + wallet + "@" + ConfigManager.GeneralConfig.ZIL_mining_pool.Replace("stratum+tcp://", "") + ":" + ConfigManager.GeneralConfig.ZIL_mining_port; } @@ -117,9 +117,8 @@ private string GetStartCommand(string btcAddress, string worker) { sColor = " --nocolour"; } - string wallet = ConfigManager.GeneralConfig.Wallet; - string password = " --pass=c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + + string _password = " --pass=" + password.Trim() + " "; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); _algo = _algo.Replace("equihash125", "125,4"); _algo = _algo.Replace("equihash144", "144,5 --pers auto"); @@ -128,8 +127,8 @@ private string GetStartCommand(string btcAddress, string worker) return " --par=" + _algo + " " + ZilMining + " --telemetry=" + ApiPort + - " --url=" + wallet + "@" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + - password + + " --url=ssl://" + wallet + "@" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + + _password + GetDevicesCommandString().Trim(); } @@ -193,7 +192,7 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti _algo = _algo.Replace("evrprogpow", "progpow --pers auto"); ret = GetDevicesCommandString() + "--nocolour --par=" + _algo + - " --url=" + Globals.DemoUser + "@" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " --url=ssl://" + Globals.DemoUser + "@" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " --pass=c=LTC" + " --telemetry=" + ApiPort; _benchmarkTimeWait = time; diff --git a/ZergPoolMiner/Miners/teamredminer.cs b/ZergPoolMiner/Miners/teamredminer.cs index 5064536..94f2b25 100644 --- a/ZergPoolMiner/Miners/teamredminer.cs +++ b/ZergPoolMiner/Miners/teamredminer.cs @@ -84,7 +84,7 @@ private string GetServerDual(string algo, string algoDual, string algoDualPrefix } return ret; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { if (!IsInit) { @@ -110,40 +110,14 @@ public override void Start(string btcAdress, string worker) sc = variables.TRMiner_add1; } - - - /* - if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos) && - MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.IronFish)) - { - algo = "autolykos2"; - algo2 = "autolykos"; - port = "3390"; - LastCommandLine = sc + "" + - " -d " + GetDevicesCommandString() + - " -a " + algo + " " + - GetServerDual(algo2, "ironfish", "--iron", username, port, "3397") + - " --rig_id=" + username.Split('.')[1] + " --pool_force_ensub " + - apiBind + apiBind2 + - " " + - ExtraLaunchParametersParser.ParseForMiningSetup( - MiningSetup, - DeviceType.AMD); - - ProcessHandle = _Start(); - return; - } - */ - - string wallet = " -u " + ConfigManager.GeneralConfig.Wallet; - string password = " -p c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _wallet = " -u " + wallet; + string _password = " -p " + password + " "; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); _algo = _algo.Replace("karlsenhash", "karlsen"); LastCommandLine = sc + "" + "-a " + _algo + " " + - "-o stratum+tcp://" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + - wallet + " " + password + + "-o stratum+ssl://" + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + + _wallet + " " + _password + apiBind + apiBind2 + " " + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.AMD) + " -d " + GetDevicesCommandString(); diff --git a/ZergPoolMiner/Miners/trex.cs b/ZergPoolMiner/Miners/trex.cs index 31fd384..2d11bbb 100644 --- a/ZergPoolMiner/Miners/trex.cs +++ b/ZergPoolMiner/Miners/trex.cs @@ -33,11 +33,12 @@ private string GetServer(string algo) string ret = ""; try { + algo = algo.Replace("-", "_"); var _a = Stats.Stats.MiningAlgorithmsList.FirstOrDefault(item => item.name.ToLower() == algo.ToLower()); string serverUrl = Form_Main.regionList[ConfigManager.GeneralConfig.ServiceLocation].RegionLocation + "mine.zergpool.com"; - ret = " -o " + Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "stratum2+tcp://") + ":" + _a.port.ToString(); + ret = " -o " + Links.CheckDNS(algo + serverUrl).Replace("stratum+tcp://", "stratum2+ssl://") + ":" + _a.tls_port.ToString(); } catch (Exception ex) { @@ -46,7 +47,7 @@ private string GetServer(string algo) } return ret; } - public override void Start(string btcAdress, string worker) + public override void Start(string wallet, string password) { if (!IsInit) { @@ -56,15 +57,14 @@ public override void Start(string btcAdress, string worker) var apiBind = " --api-bind-http 0.0.0.0:" + ApiPort; - string wallet = "-u " + ConfigManager.GeneralConfig.Wallet; - string password = " -p c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + - Stats.Stats.GetFullWorkerName() + " "; + string _wallet = "-u " + wallet; + string _password = " -p " + password + " "; var _algo = MiningSetup.CurrentAlgorithmType.ToString().ToLower(); LastCommandLine = " --algo " + _algo + " " + apiBind + GetServer(MiningSetup.CurrentAlgorithmType.ToString().ToLower()) + " " + - wallet + " " + password + + _wallet + " " + _password + " -d " + GetDevicesCommandString() + " --no-watchdog " + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.NVIDIA) + " "; diff --git a/ZergPoolMiner/Program.cs b/ZergPoolMiner/Program.cs index 903e711..5cd0467 100644 --- a/ZergPoolMiner/Program.cs +++ b/ZergPoolMiner/Program.cs @@ -253,12 +253,13 @@ static void Main(string[] argv) Helpers.ConsolePrint("MinerLegacy", "Previous version: " + Configs.ConfigManager.GeneralConfig.ForkFixVersion.ToString()); ConfigManager.GeneralConfig.ForkFixVersion = 0.1; } - //0.2 + if (Configs.ConfigManager.GeneralConfig.ForkFixVersion < 0.2) { ConfigManager.GeneralConfig.ServiceLocation = 0; Helpers.ConsolePrint("MinerLegacy", "Previous version: " + Configs.ConfigManager.GeneralConfig.ForkFixVersion.ToString()); ConfigManager.GeneralConfig.ForkFixVersion = 0.2; + ConfigManager.GeneralConfig.InstallDateTime = DateTime.Now; try { if (File.Exists("configs\\wallets.json")) @@ -279,8 +280,13 @@ static void Main(string[] argv) Helpers.ConsolePrint("MinerLegacy", ex.ToString()); } } - + if (Configs.ConfigManager.GeneralConfig.ForkFixVersion < 0.3) + { + ConfigManager.GeneralConfig.ServiceLocation = 0; + Helpers.ConsolePrint("MinerLegacy", "Previous version: " + Configs.ConfigManager.GeneralConfig.ForkFixVersion.ToString()); + ConfigManager.GeneralConfig.ForkFixVersion = 0.3; + } if (ConfigManager.GeneralConfig.ZILMaxEpoch < 1) ConfigManager.GeneralConfig.ZILMaxEpoch = 1; diff --git a/ZergPoolMiner/Properties/AssemblyInfo.cs b/ZergPoolMiner/Properties/AssemblyInfo.cs index 0d9c46d..cb1e7bf 100644 --- a/ZergPoolMiner/Properties/AssemblyInfo.cs +++ b/ZergPoolMiner/Properties/AssemblyInfo.cs @@ -34,4 +34,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("0.2")] +[assembly: AssemblyFileVersion("0.3")] diff --git a/ZergPoolMiner/Stats/Stats.cs b/ZergPoolMiner/Stats/Stats.cs index ddb2723..652c912 100644 --- a/ZergPoolMiner/Stats/Stats.cs +++ b/ZergPoolMiner/Stats/Stats.cs @@ -45,6 +45,7 @@ public class MiningAlgorithms public bool FPGA { get; set; } public bool ASIC { get; set; } public bool tempDisabled { get; set; } + public bool tempDeleted { get; set; } } public static List CoinList = new(); @@ -69,7 +70,8 @@ public class Coin public bool GPU { get; set; } public bool FPGA { get; set; } public bool ASIC { get; set; } - public bool tempDisabled { get; set; } + public bool tempTTF_Disabled { get; set; } + public bool tempDeleted { get; set; } } public static string GetPoolApiData(string url) @@ -118,6 +120,15 @@ public static string GetPoolApiData(string url) public static List GetCoins() { Helpers.ConsolePrint("Stats", "Trying GetCoins"); + double correction = ConfigManager.GeneralConfig.ProfitabilityCorrection; + if (ConfigManager.GeneralConfig.ForkFixVersion == 0.3) + { + var days = (DateTime.Now - ConfigManager.GeneralConfig.updated_at).TotalDays; + // zergpool , + // 20-30. 0.8 10 + correction = Math.Max(ConfigManager.GeneralConfig.ProfitabilityCorrection, 1 - (days / 50)); + } + try { string ResponseFromAPI = GetPoolApiData(Links.Currencies); @@ -157,10 +168,11 @@ public static List GetCoins() _coin.port = port; _coin.tls_port = tls_port; _coin.hashrate = hashrate; - _coin.estimate = (estimate_current / mbtc_mh_factor * 1000);//mBTC/GH - _coin.estimate_current = (estimate_current / mbtc_mh_factor * 1000000);//mBTC/GH - _coin.estimate_last24h = (estimate_last24h / mbtc_mh_factor * 1000000); - _coin.actual_last24h = (actual_last24h / mbtc_mh_factor / 1000 * 1000000);//zergpool api bug + _coin.estimate = (estimate_current / mbtc_mh_factor * 1000) * correction;//mBTC/GH + _coin.estimate_current = (estimate_current / mbtc_mh_factor * 1000000) * correction;//mBTC/GH + _coin.estimate_last24h = (estimate_last24h / mbtc_mh_factor * 1000000) * correction; + _coin.actual_last24h = (actual_last24h / mbtc_mh_factor / 1000 * 1000000) * + correction;//zergpool api bug _coin.mbtc_mh_factor = mbtc_mh_factor;//multiplier, //value 1 represents Mh, //1000 represents GH, @@ -176,13 +188,37 @@ public static List GetCoins() _coin.GPU = b[2]; _coin.ASIC = b[1]; _coin.FPGA = b[0]; + + if (real_ttf > ConfigManager.GeneralConfig.maxTTF && (_coin.CPU || _coin.GPU)) + { + Helpers.ConsolePrint("Stats", _coin.name.ToString() + "(" + + _coin.algo.ToString() + ") TTF " + + GetTime((int)real_ttf) + ". Disabled"); + _coin.tempTTF_Disabled = true; + } + else + { + _coin.tempTTF_Disabled = false; + } + if (algo == "allium" || algo == "x16rv2" || algo == "x21s" || algo == "x25x") + { + _coin.estimate = _coin.estimate * 0.9; + _coin.estimate_current = _coin.estimate_current * 0.9; + _coin.estimate_last24h = _coin.estimate_last24h * 0.9; + _coin.actual_last24h = _coin.actual_last24h * 0.9; + } + + if (algo == "equihash125" || algo == "equihash192") + { + _coin.estimate = _coin.estimate * 0.95; + _coin.estimate_current = _coin.estimate_current * 0.95; + _coin.estimate_last24h = _coin.estimate_last24h * 0.95; + _coin.actual_last24h = _coin.actual_last24h * 0.95; + } + CoinList.Add(_coin); } - /* - var json = JsonConvert.SerializeObject(CoinList, Formatting.Indented); - Helpers.WriteAllTextWithBackup("configs\\CoinList.json", json); - */ } } catch (Exception ex) @@ -192,9 +228,11 @@ public static List GetCoins() return CoinList; } + public static List zergpoolAlgos = new(); public static List GetZergPoolAlgosListEx() { - List algosList = new(); + List progAlgosList = new(); + List poolAlgosList = new(); var coins = GetCoins(); try { @@ -204,32 +242,31 @@ public static List GetZergPoolAlgosListEx() _alg = _alg.Replace("xelisv2_pepew", "xelisv2-pepew"); _alg = _alg.Replace("neoscrypt_xaya", "neoscrypt-xaya"); Coin defcoin = new(); - int real_ttf = 0; - if ((int)alg >= 1 && !alg.ToString().Contains("UNUSED")) + if ((int)alg >= 1000 && !alg.ToString().Contains("unused")) { + progAlgosList.Add(_alg); foreach (var coin in coins) { + if (coin.CPU || coin.GPU) + { + poolAlgosList.Add(coin.algo.ToLower()); + } + if (!zergpoolAlgos.Contains(coin.algo.ToLower())) + { + zergpoolAlgos.Add(coin.algo.ToLower()); + } + if (coin.algo.ToLower().Equals(_alg)) { - if (coin.hashrate >= defcoin.hashrate) + if (coin.hashrate >= defcoin.hashrate && !coin.tempTTF_Disabled && !coin.tempDeleted) { - algosList.Add(_alg); defcoin = coin; defcoin.algo = _alg; - } + } } } } - if (defcoin.real_ttf > ConfigManager.GeneralConfig.maxTTF) - { - Helpers.ConsolePrint("Stats", alg.ToString() + " TTF " + - GetTime((int)defcoin.real_ttf) + ". Disabled"); - defcoin.tempDisabled = true; - } else - { - defcoin.tempDisabled = false; - } if (!string.IsNullOrEmpty(defcoin.algo)) { MiningAlgorithms miningAlgorithms = new(); @@ -265,32 +302,25 @@ public static List GetZergPoolAlgosListEx() MiningAlgorithmsList.Add(miningAlgorithms); } } - - //MiningAlgorithmsList.Add(miningAlgorithms); - //Helpers.ConsolePrint(miningAlgorithms.name, miningAlgorithms.estimate_current.ToString()); } } - var arr = MiningAlgorithmsList.ToList(); - foreach (var a in arr) + + foreach (var a in progAlgosList) { - a.tempDisabled = false; - string _alg = a.name.ToLower(); + string _alg = a.ToLower(); _alg = _alg.Replace("xelisv2_pepew", "xelisv2-pepew"); _alg = _alg.Replace("neoscrypt_xaya", "neoscrypt-xaya"); - if (!algosList.Contains(_alg)) + if (!poolAlgosList.Contains(_alg)) { - Helpers.ConsolePrint("Stats", "Deleted? - " + a.name); - a.tempDisabled = true; - //MiningAlgorithmsList.RemoveAll(x => x.name.ToLower() == a.name.ToLower()); - if (a.adaptive_factor == 0) - { - var itemToRemove = MiningAlgorithmsList.SingleOrDefault(r => r.name.ToLower() == a.name.ToLower()); - if (itemToRemove != null) - { - MiningAlgorithmsList.Remove(itemToRemove); - //break; - } - } + Helpers.ConsolePrint("Stats", "Deleted? - " + _alg); + //a.tempDeleted = true; + var itemToDelete = MiningAlgorithmsList.Find(r => r.name.ToLower() == _alg); + if (itemToDelete != null) itemToDelete.tempDeleted = true; + //MiningAlgorithmsList.RemoveAll(x => x.name.ToLower() == _alg); + } else + { + var itemToDelete = MiningAlgorithmsList.Find(r => r.name.ToLower() == _alg); + if (itemToDelete != null) itemToDelete.tempDeleted = false; } } @@ -324,10 +354,9 @@ public static string GetTime(int seconds) } return "?"; } - + /* public static List GetZergPoolAlgosList() { - return GetZergPoolAlgosListEx(); List algosList = new(); Helpers.ConsolePrint("Stats", "Trying GetZergPoolAlgosList"); try @@ -392,7 +421,8 @@ public static List GetZergPoolAlgosList() obj.actual_last24h = miningAlgorithms.actual_last24h; obj.mbtc_mh_factor = miningAlgorithms.mbtc_mh_factor; } - } else + } + else { MiningAlgorithmsList.Add(miningAlgorithms); } @@ -404,7 +434,7 @@ public static List GetZergPoolAlgosList() if (!algosList.Contains(a.name.ToLower())) { Helpers.ConsolePrint("Stats", "Deleted? - " + a.name); - a.tempDisabled = true; + a.tempDeleted = true; //MiningAlgorithmsList.RemoveAll(x => x.name.ToLower() == a.name.ToLower()); if (a.adaptive_factor == 0) { @@ -417,7 +447,6 @@ public static List GetZergPoolAlgosList() } } } - var json = JsonConvert.SerializeObject(MiningAlgorithmsList, Formatting.Indented); Helpers.WriteAllTextWithBackup("configs\\AlgoritmsList.json", json); } @@ -428,6 +457,7 @@ public static List GetZergPoolAlgosList() } return MiningAlgorithmsList; } + */ public static void ClearBalance() { Balance = 0; @@ -473,13 +503,48 @@ public class AlgoProperty public double localProfit; public double actualProfit; public double profitRatio = 1d; + public double adaptive_factor; + public double adaptive_profit; public int ticks; - public List ratioList = new(); + public List factorsList = new(); } - public static string GetFullWorkerName() + public static string GetFullWorkerName0() { - string w = WindowsMacUtils.GetMACAddress(); - return ConfigManager.GeneralConfig.WorkerName.Trim() + w; + string mac = WindowsMacUtils.GetMACAddress(); + string w = ""; + string u = ""; + string c = ""; + string pl = ""; + if (string.IsNullOrEmpty(ConfigManager.GeneralConfig.Wallet.Trim())) + { + u = Globals.DemoUser; + } + else + { + u = ConfigManager.GeneralConfig.Wallet.Trim(); + } + if (string.IsNullOrEmpty(ConfigManager.GeneralConfig.PayoutCurrency.Trim())) + { + c = "LTC"; + } + else + { + c = ConfigManager.GeneralConfig.PayoutCurrency.Trim(); + } + + pl = ConfigManager.GeneralConfig.PayoutCurrencyTreshold.ToString(); + + if (string.IsNullOrEmpty(ConfigManager.GeneralConfig.WorkerName.Trim())) + { + w = "demo"; + } else + { + w = ConfigManager.GeneralConfig.WorkerName.Trim(); + } + //string password = " --pass=c=" + ConfigManager.GeneralConfig.PayoutCurrency + Form_Main._PayoutTreshold + ",ID=" + + //Stats.Stats.GetFullWorkerName() + " "; + //ConfigManager.GeneralConfig.Wallet + return " -u " + u + " --pass=" + c + ",pl=" + pl + ",ID=" + w + mac + " "; } public static ConcurrentDictionary algosProperty = new(); public static void GetWalletBalanceEx(object sender, EventArgs e) @@ -499,7 +564,7 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) if (!string.IsNullOrEmpty(ResponseFromAPI)) { dynamic _data = JsonConvert.DeserializeObject(ResponseFromAPI); - var a = JsonConvert.SerializeObject(_data, Formatting.Indented); + //var a = JsonConvert.SerializeObject(_data, Formatting.Indented); //Helpers.ConsolePrint("<-", a); double overallBTC = 0; @@ -507,9 +572,11 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) double localProfit = 0d; double localProfitSecond = 0d; double actualProfit = 0d; - List miningAlgos = new(); + List currentminingAlgos = new(); foreach (var alg in MiningAlgorithmsList) { + if (alg.tempDeleted) continue; + if (alg.tempDisabled) continue; double actualHashrate = 0d; foreach (var cur in data.SelectToken("miners")) { @@ -518,7 +585,7 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) int _subscribe = cur.SelectToken("subscribe"); double _accepted = cur.SelectToken("accepted"); if (alg.name.ToLower().Equals(_algo.ToLower()) && - _ID.Equals(GetFullWorkerName())) + _ID.Equals(Miner.GetFullWorkerName())) { var _algoProperty = new AlgoProperty(); double localHashrate = 0d; @@ -533,13 +600,13 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) { localHashrate = localHashrate + miningDevice.Device.MiningHashrateSecond; } - if (!miningAlgos.Contains(((AlgorithmType)miningDevice.Device.AlgorithmID).ToString().ToLower())) + if (!currentminingAlgos.Contains(((AlgorithmType)miningDevice.Device.AlgorithmID).ToString().ToLower())) { - miningAlgos.Add(((AlgorithmType)miningDevice.Device.AlgorithmID).ToString().ToLower()); + currentminingAlgos.Add(((AlgorithmType)miningDevice.Device.AlgorithmID).ToString().ToLower()); } - if (!miningAlgos.Contains(((AlgorithmType)miningDevice.Device.SecondAlgorithmID).ToString().ToLower())) + if (!currentminingAlgos.Contains(((AlgorithmType)miningDevice.Device.SecondAlgorithmID).ToString().ToLower())) { - miningAlgos.Add(((AlgorithmType)miningDevice.Device.SecondAlgorithmID).ToString().ToLower()); + currentminingAlgos.Add(((AlgorithmType)miningDevice.Device.SecondAlgorithmID).ToString().ToLower()); } } @@ -556,13 +623,15 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) { _algoProperty.ticks = algosProperty.FirstOrDefault(x => x.Key.ToLower() == alg.name.ToLower()).Value.ticks; } - _algoProperty.ratioList = algosProperty.FirstOrDefault(x => x.Key.ToLower() == alg.name.ToLower()).Value.ratioList; + _algoProperty.factorsList = algosProperty.FirstOrDefault(x => x.Key.ToLower() == alg.name.ToLower()).Value.factorsList; } _algoProperty.localhashrate = localHashrate; _algoProperty.localProfit = (localProfit); _algoProperty.profitRatio = alg.profit; _algoProperty.actualhashrate = actualHashrate; _algoProperty.name = alg.name.ToLower(); + _algoProperty.adaptive_factor = alg.adaptive_factor; + _algoProperty.adaptive_profit = alg.adaptive_profit; algosProperty.AddOrUpdate(alg.name.ToLower(), _algoProperty, (k, v) => _algoProperty); } } @@ -573,7 +642,8 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) double average = 1; var _algoProperty = __algoProperty.Value; var alg = MiningAlgorithmsList.FirstOrDefault(x => x.name.ToLower() == __algoProperty.Key.ToLower()); - + //Helpers.ConsolePrint("Stats", alg.name); + //Helpers.ConsolePrint("Stats", alg.name + " _algoProperty.ticks: " + _algoProperty.ticks.ToString()); // actualProfit = actualProfit + (_algoProperty.actualhashrate * alg.profit); if (_algoProperty.localhashrate != 0) @@ -590,19 +660,36 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) Form_Main.adaptiveRunning = true; } + if (_algoProperty.factorsList.Count < 100 && _algoProperty.adaptive_factor != 0) + { + for (int i = 0; i < 100; i++) + { + _algoProperty.factorsList.Add(_algoProperty.adaptive_factor); + } + } + if (_algoProperty.ticks >= ConfigManager.GeneralConfig.ticksBeforeAdaptiveStart)//15 { - double profitNow = _algoProperty.actualProfit / _algoProperty.localProfit; - _algoProperty.ratioList.Add(profitNow); + double factorNow = _algoProperty.actualProfit / _algoProperty.localProfit; + _algoProperty.factorsList.Add(factorNow); if (ConfigManager.GeneralConfig.AdaptiveAlgo)// { - average = _algoProperty.ratioList.Sum() / _algoProperty.ratioList.Count; - Helpers.ConsolePrint("Stats", alg.name + " adaptive factor: " + average.ToString("F5")); - + average = _algoProperty.factorsList.Sum() / _algoProperty.factorsList.Count; + /* + Helpers.ConsolePrint("Stats", alg.name + " average: " + average.ToString("F5")); + Helpers.ConsolePrint("Stats", alg.name + " adaptive_profit: " + _algoProperty.adaptive_profit.ToString("F5")); + Helpers.ConsolePrint("Stats", alg.name + " adaptive_factor: " + _algoProperty.adaptive_factor.ToString("F5")); + Helpers.ConsolePrint("Stats", alg.name + " factorNow: " + factorNow.ToString("F5")); + //if (double.IsNaN(average)) + { + Helpers.ConsolePrint("Stats", alg.name + " _algoProperty.ratioList.Sum(): " + _algoProperty.factorsList.Sum().ToString("F5")); + Helpers.ConsolePrint("Stats", alg.name + " _algoProperty.ratioList.Count: " + _algoProperty.factorsList.Count.ToString("F5")); + } + */ if (_algoProperty.ticks > ConfigManager.GeneralConfig.ticksBeforeAdaptiveStart + - ConfigManager.GeneralConfig.ticksAdaptiveTuning) + ConfigManager.GeneralConfig.ticksAdaptiveTuning)//105 { if (!double.IsInfinity(average) && !double.IsNaN(average)) { @@ -621,8 +708,8 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) } else { - alg.adaptive_factor = 0; - alg.adaptive_profit = 0; + //alg.adaptive_factor = 0; + //alg.adaptive_profit = 0; } } } @@ -632,9 +719,27 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) { //algosProperty.TryRemove(_algoProperty.name, out var r); } - if (!miningAlgos.Contains(_algoProperty.name.ToLower())) + /* + foreach (var a in currentminingAlgos) + { + Helpers.ConsolePrint("Stats", "currentminingAlgos: " + _algoProperty.name); + } + */ + if (!currentminingAlgos.Contains(_algoProperty.name.ToLower())) { + Helpers.ConsolePrint("Stats", "Deleted current mining algo: " + _algoProperty.name); + /* + foreach (var a in algosProperty) + { + if (a.Key.ToLower().Equals(_algoProperty.name.ToLower())) + { + + } + } + */ algosProperty.TryRemove(_algoProperty.name, out var r); + + Form_Main.adaptiveRunning = false; } } overallBTC = actualProfit; @@ -657,7 +762,7 @@ public static void GetWalletBalanceEx(object sender, EventArgs e) [HandleProcessCorruptedStateExceptions] public static void GetAlgos() { - setAlgos(GetZergPoolAlgosList()); + setAlgos(GetZergPoolAlgosListEx()); } public static void LoadAlgoritmsList(bool onlyCached = false) @@ -686,7 +791,7 @@ public static void LoadAlgoritmsList(bool onlyCached = false) } setAlgos(algolist); if (onlyCached) return; - setAlgos(GetZergPoolAlgosList()); + setAlgos(GetZergPoolAlgosListEx()); } private static double getMin(double a, double b, double c) { @@ -708,13 +813,13 @@ private static double getMin(double a, double b, double c) private static bool checkAPIbug(MiningAlgorithms algo) { return false; - if (algo.apibug == true) return true; + //if (algo.apibug == true) return true; double a = algo.estimate_current; double b = algo.estimate_last24h; double c = algo.actual_last24h; - if (a > b * 150 || a > c * 150 || - b > a * 150 || b > c * 150 || - c > a * 150 || c > b * 150) + if (a > b * 15000 || a > c * 15000 || + b > a * 15000 || b > c * 15000 || + c > a * 15000 || c > b * 15000) { Helpers.ConsolePrint("Stats", algo.name + " API bug"); algo.apibug = true; @@ -729,10 +834,8 @@ private static void setAlgos(List algolist) try { delalgos.Clear(); - newalgolist.Clear(); if (algolist != null && algolist.Count > 0) { - newalgolist = algolist.ToList(); foreach (AlgorithmType alg in Enum.GetValues(typeof(AlgorithmType))) { if ((int)alg >= 1 && !alg.ToString().Contains("UNUSED")) @@ -758,12 +861,14 @@ private static void setAlgos(List algolist) double _profit = 0d; int profitsCount = 0; // - if (algo.estimate_current == 0 || algo.tempDisabled || algo.hashrate == 0) + if (algo.estimate_current == 0 || algo.tempDeleted || algo.tempDisabled || algo.hashrate == 0) { _profit = 0; if (algo.hashrate == 0) { + //algo.tempDeleted = true; zeroAlgos.Add(algo.name); + continue; } } else @@ -854,12 +959,16 @@ private static void setAlgos(List algolist) { if (!double.IsNaN(algo.adaptive_factor)) { + //Helpers.ConsolePrint("Stats", "algo: " + algo.name); + //Helpers.ConsolePrint("Stats", "adaptive_factor: " + algo.adaptive_factor.ToString()); + //Helpers.ConsolePrint("Stats", "profit: " + algo.profit.ToString()); algo.adaptive_profit = algo.adaptive_factor * algo.profit; + //Helpers.ConsolePrint("Stats", "algo.adaptive_profit: " + algo.adaptive_profit.ToString()); } else { - algo.adaptive_profit = 0; - algo.adaptive_factor = 0; + //algo.adaptive_profit = 0; + //algo.adaptive_factor = 0; } data.Add(_algo, algo.adaptive_profit); } else @@ -868,11 +977,6 @@ private static void setAlgos(List algolist) } } - if (newalgolist.Any(n => n.name.ToLower().Equals(algo.name.ToLower()))) - { - var itemToRemove = newalgolist.Single(r => r.name == algo.name); - newalgolist.Remove(itemToRemove); - } if (delalgos.Exists(e => e.Equals(algo.name.ToLower()))) delalgos.Remove(algo.name.ToLower()); break; } @@ -896,43 +1000,16 @@ private static void setAlgos(List algolist) public static void CheckNewAlgo() { - foreach (var algo in delalgos) - { - Helpers.ConsolePrint("Stats", "Zergpool deleted the algorithm: " + algo); - foreach (AlgorithmType alg in Enum.GetValues(typeof(AlgorithmType))) - { - if (alg.ToString().ToLower().Equals(algo.ToLower())) - { - AlgosProfitData.UpdatePayingForAlgo(alg, 0, false); - } - } - } - foreach (var algo in newalgolist) - { - if (algo.CPU && !algo.FPGA && !algo.GPU) - { - Helpers.ConsolePrint("Stats", "Zergpool added the CPU only algorithm: " + algo.name); - } - } - foreach (var algo in newalgolist) + List algolist = new(); + foreach (AlgorithmType alg in Enum.GetValues(typeof(AlgorithmType))) { - if (algo.GPU && !algo.CPU && !algo.FPGA && !algo.ASIC) - { - Helpers.ConsolePrint("Stats", "New GPU only algo: " + algo.name); - } - } - foreach (var algo in newalgolist) - { - if (algo.CPU && !algo.ASIC && !algo.FPGA) - { - Helpers.ConsolePrint("Stats", "New CPU algo: " + algo.name); - } + algolist.Add(alg.ToString().ToLower().Replace("_unused", "")); } - foreach (var algo in newalgolist) + foreach (var algo in zergpoolAlgos) { - if (algo.GPU && !algo.ASIC) + if (!algolist.Contains(algo.Replace("-", "_"))) { - Helpers.ConsolePrint("Stats", "New GPU algo: " + algo.name); + Helpers.ConsolePrint("Stats", "Zergpool added algorithm: " + algo); } } } diff --git a/ZergPoolMiner/Switching/AlgosProfitData.cs b/ZergPoolMiner/Switching/AlgosProfitData.cs index a401f74..3288759 100644 --- a/ZergPoolMiner/Switching/AlgosProfitData.cs +++ b/ZergPoolMiner/Switching/AlgosProfitData.cs @@ -122,7 +122,7 @@ public static void UpdatePayingForAlgo(AlgorithmType algo, double paying, bool a //if (paying != 0) { - if (_currentAlgosProfit[algo].Paying > 0 && paying > _currentAlgosProfit[algo].Paying * 100) + if (_currentAlgosProfit[algo].Paying > 0 && paying > _currentAlgosProfit[algo].Paying * 15000) { Helpers.ConsolePrint("AlgosProfitData", "AlgosProfitData API bug. " + algo.ToString() + ": " + "old value: " + _currentAlgosProfit[algo].Paying.ToString() + " new value: " + paying); diff --git a/ZergPoolMiner/Updater/Updater.cs b/ZergPoolMiner/Updater/Updater.cs index dcbad06..c8dc6af 100644 --- a/ZergPoolMiner/Updater/Updater.cs +++ b/ZergPoolMiner/Updater/Updater.cs @@ -464,6 +464,14 @@ public static double GetGITHUBVersion() Form_Main.progName = n; Form_Main.browser_download_url = gitassets[i].browser_download_url; DateTime build = gitassets[i].updated_at; + /* + //"2024-11-29T07:30:42Z" + DateTime _published_at = DateTime.ParseExact(published_at, "yyyy-MM-dd HH:mm:ss", + System.Globalization.CultureInfo.InvariantCulture); + Helpers.ConsolePrint("_published_at", _published_at.ToString()); + */ + ConfigManager.GeneralConfig.updated_at = build; + string buildDate = build.ToString("u").Replace("-", "").Replace(":", "").Replace("Z", "").Replace(" ", "."); Double.TryParse(buildDate.ToString(), out Form_Main.githubBuild); } diff --git a/ZergPoolMiner/Utils/BINS_CODEGEN.cs b/ZergPoolMiner/Utils/BINS_CODEGEN.cs index 2c8cd79..2cf5a9d 100644 --- a/ZergPoolMiner/Utils/BINS_CODEGEN.cs +++ b/ZergPoolMiner/Utils/BINS_CODEGEN.cs @@ -14,7 +14,7 @@ public static class MinersBins @"/lolMiner/lolMiner.exe", @"/miniZ/miniZ.exe", @"/Rigel/rigel.exe", - @"/Fork_Fix_0.2.txt" + @"/Fork_Fix_0.3.txt" }; } } diff --git a/ZergPoolMinerLegacy.Common/Enums/AlgorithmType.cs b/ZergPoolMinerLegacy.Common/Enums/AlgorithmType.cs index ff0f274..4e75d88 100644 --- a/ZergPoolMinerLegacy.Common/Enums/AlgorithmType.cs +++ b/ZergPoolMinerLegacy.Common/Enums/AlgorithmType.cs @@ -22,6 +22,24 @@ public enum AlgorithmType Empty = 0, + sha256_UNUSED = 100, + lyra2z_UNUSED = 101, + equihash_UNUSED = 102, + qubit_UNUSED = 103, + myr_gr_UNUSED = 104, + scrypt_UNUSED = 105, + skein_UNUSED = 106, + token_UNUSED = 107, + x11_UNUSED = 108, + quark_UNUSED = 109, + groestl_UNUSED = 110, + sib_UNUSED = 111, + kheavyhash_UNUSED = 112, + lbry_UNUSED = 113, + lyra2v2_UNUSED = 114, + x13_UNUSED = 115, + blake2s_UNUSED = 116, + Allium = 1000,//_UNUSED BMW512 = 1010,//_UNUSED CPUPower = 1020, @@ -56,6 +74,7 @@ public enum AlgorithmType NexaPow = 1280,//2gb //NxlHash = 1287, Panthera = 1290, + //Phi = 1293, Power2b = 1295, //PyrinHashV2 = 1300, RandomX = 1310,