Example #1
0
        private void AddCoinConfiguration(CryptoCoin cryptoCoin)
        {
            CoinConfiguration configuration = configurations.SingleOrDefault(c => c.Coin.Symbol.Equals(cryptoCoin.Symbol));
            if (configuration != null)
            {
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }
            else
            {
                configuration = new CoinConfiguration();

                configuration.Coin = knownCoins.SingleOrDefault(c => c.Symbol.Equals(cryptoCoin.Symbol, StringComparison.OrdinalIgnoreCase));

                //user may have manually entered a coin
                if (configuration.Coin == null)
                {
                    configuration.Coin = new CryptoCoin();
                    configuration.Coin.Name = cryptoCoin.Name;
                    configuration.Coin.Symbol = cryptoCoin.Symbol;
                    configuration.Coin.Algorithm = cryptoCoin.Algorithm;
                }

                configuration.Pools.Add(new MiningPool());

                configurations.Add(configuration);

                coinListBox.Items.Add(configuration.Coin.Name);
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }

            hostEdit.Focus();
        }
Example #2
0
        private void SetAllDevicesToCoin(CoinConfiguration coinConfiguration)
        {
            engineConfiguration.DeviceConfigurations.Clear();

            for (int i = 0; i < devices.Count; i++)
            {
                ListViewItem listViewItem = deviceListView.Items[i];

                Device device = devices[i];
                CryptoCoin currentCoin = knownCoins.SingleOrDefault(c => c.Name.Equals(listViewItem.SubItems["Coin"].Text));

                DeviceConfiguration deviceConfiguration = new DeviceConfiguration();

                deviceConfiguration.Assign(device);

                if (coinConfiguration.Coin.Algorithm == CoinAlgorithm.Scrypt)
                {
                    if (device.Kind == DeviceKind.GPU)
                        deviceConfiguration.CoinSymbol = coinConfiguration.Coin.Symbol;
                    else
                        deviceConfiguration.CoinSymbol = currentCoin == null ? String.Empty : currentCoin.Symbol;
                }
                else
                {
                    deviceConfiguration.CoinSymbol = coinConfiguration.Coin.Symbol;
                }

                deviceConfiguration.Enabled = listViewItem.Checked;

                engineConfiguration.DeviceConfigurations.Add(deviceConfiguration);
            }
        }
Example #3
0
        public static void Seed(List<CoinConfiguration> configurations)
        {
            //BTC
            CoinConfiguration donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "BTC";

            MiningPool donationPool = new MiningPool()
            {
                Host = "stratum+tcp://stratum.mining.eligius.st",
                Port = 3334,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://mint.bitminter.com",
                Port = 3333,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://stratum.bitcoin.cz",
                Port = 3333,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //LTC
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "LTC";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://world.wemineltc.com",
                Port = 3333,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://primary.coinhuntr.com",
                Port = 3333,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //BQC
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "BQC";

            donationPool = new MiningPool()
            {
                Host = "http://de1.bigbbq.cc",
                Port = 8446,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //FTC
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "FTC";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://stratum.wemineftc.com",
                Port = 4444,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            donationPool = new MiningPool()
            {
                Host = "http://feathercoin.is-a-geek.com",
                Port = 8341,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //MEC
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "MEC";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://us.miningpool.co",
                Port = 9002,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://au1.miningpool.co",
                Port = 9001,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //PPC
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "PPC";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://stratum.d7.lt",
                Port = 3333,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            //NVC
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "NVC";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://stratum.khore.org",
                Port = 3334,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //CAP
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "CAP";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://cap.coinmine.pl",
                Port = 8102,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //ZET
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "ZET";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://mine1.coinmine.pl",
                Port = 6000,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);

            //UNO
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "UNO";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://de1.miningpool.co",
                Port = 10701,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            //DOGE
            donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = "DOGE";

            donationPool = new MiningPool()
            {
                Host = "stratum+tcp://stratum.dogehouse.org",
                Port = 3333,
                Username = "******",
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            configurations.Add(donationConfiguration);
        }
Example #4
0
        private EngineConfiguration CreateEngineConfiguration()
        {
            EngineConfiguration engineConfiguration;
            engineConfiguration = new EngineConfiguration();

            CoinConfiguration coinConfiguration = new CoinConfiguration();

            CryptoCoin coin = coins.Single(c => c.Name.Equals(coinComboBox.Text));

            coinConfiguration.Coin = coin;
            coinConfiguration.Enabled = true;

            MiningPool miningPool = new MiningPool();

            miningPool.Host = hostEdit.Text;
            miningPool.Port = Int32.Parse(portEdit.Text);
            miningPool.Username = usernameEdit.Text;
            miningPool.Password = passwordEdit.Text;

            coinConfiguration.Pools.Add(miningPool);

            engineConfiguration.CoinConfigurations.Add(coinConfiguration);
            return engineConfiguration;
        }
Example #5
0
        private void HandleCoinButtonClick(object sender, EventArgs e)
        {
            string clickedSymbol = (string)((ToolStripButton)sender).Tag;
            CoinConfiguration configuration = configurations.SingleOrDefault(c => c.Coin.Symbol.Equals(clickedSymbol));
            if (configuration != null)
            {
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }
            else
            {
                configuration = new CoinConfiguration();

                configuration.Coin = knownCoins.Single(c => c.Symbol.Equals(clickedSymbol));
                configuration.Pools.Add(new MiningPool());

                configurations.Add(configuration);

                coinListBox.Items.Add(configuration.Coin.Name);
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }

            hostEdit.Focus();
        }
Example #6
0
        public void InspectDetails(Device device, CoinConfiguration coinConfiguration, CoinInformation coinInformation,
            List<DeviceInformationResponse> deviceInformation, PoolInformationResponse poolInformation,
            List<DeviceDetailsResponse> deviceDetails, bool showWorkUtility)
        {
            this.deviceDetails = deviceDetails;
            this.deviceInformation = deviceInformation;

            noDetailsPanel.Visible = false;
            double hashrate = deviceInformation.Sum(di => di.AverageHashrate);
            double currentRate = deviceInformation.Sum(di => di.CurrentHashrate);

            hashrateLabel.Text = hashrate.ToHashrateString();
            currentRateLabel.Text = currentRate.ToHashrateString();

            workersGridView.Visible = (device.Kind == DeviceKind.PXY) &&
                (deviceInformation.Count > 0);
            workersTitleLabel.Visible = workersGridView.Visible;

            //Internet or Coin API could be down
            if (coinInformation != null)
            {
            }

            //device may not be configured
            if (coinConfiguration != null)
                cryptoCoinBindingSource.DataSource = coinConfiguration.Coin;
            else
                cryptoCoinBindingSource.DataSource = new CryptoCoin();

            deviceInformationResponseBindingSource.DataSource = deviceInformation;

            //may not be hashing yet
            if (deviceDetails != null)
                deviceDetailsResponseBindingSource.DataSource = deviceDetails;
            else
                deviceDetailsResponseBindingSource.DataSource = new DeviceDetailsResponse();

            deviceBindingSource.DataSource = device;

            switch (device.Kind)
            {
                case DeviceKind.CPU:
                    pictureBox1.Image = imageList1.Images[3];
                    break;
                case DeviceKind.GPU:
                    pictureBox1.Image = imageList1.Images[0];
                    break;
                case DeviceKind.USB:
                    pictureBox1.Image = imageList1.Images[1];
                    break;
                case DeviceKind.PXY:
                    pictureBox1.Image = imageList1.Images[2];
                    break;
            }

            nameLabel.Width = this.Width - nameLabel.Left - closeDetailsButton.Width;

            acceptedLabel.Text = deviceInformation.Sum(d => d.AcceptedShares).ToString();
            rejectedLabel.Text = deviceInformation.Sum(d => d.RejectedShares).ToString();
            errorsLabel.Text = deviceInformation.Sum(d => d.HardwareErrors).ToString();

            if (showWorkUtility)
            {
                utilityLabel.Text = deviceInformation.Sum(d => d.WorkUtility).ToString();
                utilityDataGridViewTextBoxColumn.DataPropertyName = "WorkUtility";
            }
            else
            {
                utilityLabel.Text = deviceInformation.Sum(d => d.Utility).ToString();
                utilityDataGridViewTextBoxColumn.DataPropertyName = "Utility";
            }
            utilityPrefixLabel.Text = showWorkUtility ? "Work utility:" : "Utility:";

            DeviceInformationResponse deviceInfo = (DeviceInformationResponse)deviceInformationResponseBindingSource.Current;
            if (deviceInfo != null)
            {
                if (deviceInfo.Temperature > 0)
                    tempLabel.Text = deviceInfo.Temperature + "°";
                else
                    tempLabel.Text = String.Empty;

                if (deviceInfo.FanPercent > 0)
                    fanLabel.Text = deviceInfo.FanPercent + "%";
                else
                    fanLabel.Text = String.Empty;
            }
            else
            {
                tempLabel.Text = String.Empty;
                fanLabel.Text = String.Empty;
            }

            UpdateColumnVisibility();

            //may not be hashing yet
            if (poolInformation != null)
                poolInformationResponseBindingSource.DataSource = poolInformation;
            else
                poolInformationResponseBindingSource.DataSource = new PoolInformationResponse();
        }
Example #7
0
        private string GetPoolNameByIndex(CoinConfiguration coinConfiguration, int poolIndex)
        {
            string result = String.Empty;

            if (poolIndex >= 0)
            {
                if (coinConfiguration != null)
                {
                    //the poolIndex may be greater than the Pools count if donating
                    if (poolIndex < coinConfiguration.Pools.Count)
                    {
                        result = coinConfiguration.Pools[poolIndex].Host;
                    }
                }
            }

            return result;
        }
Example #8
0
        private string GetPoolNameByIndex(CoinConfiguration coinConfiguration, int poolIndex)
        {
            string result = String.Empty;

            if (poolIndex >= 0)
            {
                if (coinConfiguration != null)
                {
                    //the poolIndex may be greater than the Pools count if the user edits
                    //their pools while mining
                    if (poolIndex < coinConfiguration.Pools.Count)
                    {
                        result = coinConfiguration.Pools[poolIndex].Host;
                    }
                    else
                    {
                        //check .Mining to allow perks for Remoting when local PC is not mining
                        if (miningEngine.Donating || !miningEngine.Mining)
                            result = "donation"; //donation pool won't be in list
                    }
                }
            }

            return result;
        }
Example #9
0
        private static CoinConfiguration CreateCoinConfiguration(string coinSymbol, string host, int port, string username = "******")
        {
            CoinConfiguration donationConfiguration = new CoinConfiguration();
            donationConfiguration.Coin.Symbol = coinSymbol;

            MiningPool donationPool = new MiningPool()
            {
                Host = host,
                Port = port,
                Username = username,
                Password = "******"
            };
            donationConfiguration.Pools.Add(donationPool);

            return donationConfiguration;
        }
Example #10
0
        private void SetAllDevicesToCoin(CoinConfiguration coinConfiguration)
        {
            engineConfiguration.DeviceConfigurations.Clear();

            for (int i = 0; i < devices.Count; i++)
            {
                DataGridViewRow gridRow = deviceGridView.Rows[i];
                Device device = devices[i];
                CryptoCoin currentCoin = knownCoins.SingleOrDefault(c => c.Name.Equals(gridRow.Cells[coinColumn.Index].Value));

                DeviceConfiguration deviceConfiguration = new DeviceConfiguration();

                deviceConfiguration.DeviceIndex = device.DeviceIndex;

                if (coinConfiguration.Coin.Algorithm == CoinAlgorithm.Scrypt)
                {
                    if (device.Kind == DeviceKind.GPU)
                        deviceConfiguration.CoinSymbol = coinConfiguration.Coin.Symbol;
                    else
                        deviceConfiguration.CoinSymbol = currentCoin == null ? String.Empty : currentCoin.Symbol;
                }
                else
                {
                    deviceConfiguration.CoinSymbol = coinConfiguration.Coin.Symbol;
                }

                object cellValue = gridRow.Cells[enabledColumn.Index].Value;
                deviceConfiguration.Enabled = cellValue == null ? true : (bool)cellValue;

                engineConfiguration.DeviceConfigurations.Add(deviceConfiguration);
            }
        }
Example #11
0
        private void SetupConfigurationPools(MinerConfiguration minerConfiguration, CoinConfiguration coinConfiguration)
        {
            //minerConfiguration.Pools = coinConfiguration.Pools;
            foreach (MiningPool pool in coinConfiguration.Pools)
            {
                pool.Quota = 0;
                minerConfiguration.Pools.Add(pool);
            }

            //using bfgminer quotas for failover, that way we can augment for donations
            minerConfiguration.Pools.First().Quota = 100 - donationPercent;
            if (donationPercent > 0)
                AddDonationPool(coinConfiguration.Coin.Symbol, minerConfiguration);

            foreach (MiningPool pool in minerConfiguration.Pools)
                pool.QuotaEnabled = donationPercent > 0;
        }
Example #12
0
        private void SetupConfigurationArguments(MinerConfiguration minerConfiguration, CoinConfiguration coinConfiguration)
        {
            string arguments = string.Empty;

            //apply algorithm-specific parameters
            if (engineConfiguration.XgminerConfiguration.AlgorithmFlags.ContainsKey(coinConfiguration.Coin.Algorithm))
                arguments = String.Format("{0} {1}", arguments,
                    engineConfiguration.XgminerConfiguration.AlgorithmFlags[coinConfiguration.Coin.Algorithm]);

            //apply coin-specific parameters
            if (!string.IsNullOrEmpty(coinConfiguration.MinerFlags))
                arguments = string.Format("{0} {1}", arguments, coinConfiguration.MinerFlags);

            if (engineConfiguration.XgminerConfiguration.DesktopMode)
                arguments = arguments + " -I D";

            if (donationPercent > 0)
                arguments = arguments + " --load-balance";

            minerConfiguration.LaunchArguments = arguments;
        }