private EngineConfiguration CreateEngineConfiguration() { EngineConfiguration engineConfiguration; engineConfiguration = new EngineConfiguration(); engineConfiguration.XgminerConfiguration.MinerBackend = MinerBackend.Cgminer; if (minerComboBox.SelectedIndex == 1) { engineConfiguration.XgminerConfiguration.MinerBackend = MinerBackend.Bfgminer; } 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); }
private void userNameCombo_SelectedIndexChanged(object sender, EventArgs e) { MiningPool currentPool = (MiningPool)miningPoolBindingSource.Current; if (currentPool == null) { return; } //if the password is blank if (String.IsNullOrEmpty(currentPool.Password)) { //and a workername is selected if (userNameCombo.SelectedItem != null) { string workerName = (string)userNameCombo.SelectedItem; LiquidHash.Engine.Data.Configuration.Coin configuration = configurations .FirstOrDefault(c => c.Pools.Any(p => p.Username.Equals(workerName))); //default to the password used for the same worker on another config if (configuration != null) { currentPool.Password = configuration.Pools.First(p => p.Username.Equals(workerName)).Password; } } } }
public MainWindow() { InitializeComponent(); ViewWorkerTextBlock.Visibility = Visibility.Collapsed; wnd = this; //Initialize all the of the lists. pools = new List <MiningPool>(); procs = new List <Process>(); AmdGPUs = new List <GraphicsCard>(); NvidiaGPUs = new List <GraphicsCard>(); pools = MiningPool.Get(); interrogateCards(); //Load the Drop Down Menu. cbItems = new ObservableCollection <ComboBoxItem>(); foreach (var p in pools.OrderBy(x => x.ID)) { Ping myPing = new Ping(); PingReply reply = myPing.Send(p.uri, 1000); if (reply.Status != IPStatus.TimedOut) { cbItems.Add(new ComboBoxItem { Content = p.Name + ", Ping: " + reply.RoundtripTime + ", Pool Fee: " + p.fee }); } } SelectPoolComboBox.ItemsSource = cbItems; //Get the users default settings. walletAddressTextBox.Text = Properties.Settings.Default.WalletAddress; SelectPoolComboBox.SelectedIndex = Properties.Settings.Default.PoolSelection; }
public MiningPool SelectMiningPoolByPublicKey(string publicKey) { const string SQL_STATEMENT = "SELECT * " + "FROM MiningPool " + "WHERE PublicKey = @PublicKey LIMIT 1"; MiningPool miningPool = null; using (SqliteConnection con = new SqliteConnection(base.CacheConnectionString)) using (SqliteCommand cmd = new SqliteCommand(SQL_STATEMENT, con)) { cmd.Parameters.AddWithValue("@PublicKey", publicKey); cmd.Connection.Open(); using (SqliteDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { miningPool = new MiningPool(); miningPool.Id = GetDataValue <long>(dr, "Id"); miningPool.Name = GetDataValue <string>(dr, "NAME"); miningPool.PublicKey = GetDataValue <string>(dr, "PublicKey"); miningPool.Signature = GetDataValue <string>(dr, "Signature"); } } } return(miningPool); }
public List <MiningPool> GetAllMiningPools() { const string SQL_STATEMENT = "SELECT * " + "FROM MiningPool "; var result = new List <MiningPool>(); using (SqliteConnection con = new SqliteConnection(base.CacheConnectionString)) using (SqliteCommand cmd = new SqliteCommand(SQL_STATEMENT, con)) { cmd.Connection.Open(); using (SqliteDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { var miningPool = new MiningPool(); miningPool.Id = GetDataValue <long>(dr, "Id"); miningPool.Name = GetDataValue <string>(dr, "NAME"); miningPool.PublicKey = GetDataValue <string>(dr, "PublicKey"); miningPool.Signature = GetDataValue <string>(dr, "Signature"); result.Add(miningPool); } } } return(result); }
private MiningPool ConvertToMiningPool(MiningMsg msg) { MiningPool miningPool = new MiningPool() { Name = msg.Name, PublicKey = msg.PublicKey, Signature = msg.Signature }; return(miningPool); }
private Engine.Data.Configuration.Coin AddCoinConfiguration(PoolGroup poolGroup) { //don't allow two configurations for the same coin symbol Engine.Data.Configuration.Coin configuration = configurations.SingleOrDefault(c => c.PoolGroup.Id.Equals(poolGroup.Id, StringComparison.OrdinalIgnoreCase)); if (configuration == null) { //don't allow two configurations for the same coin name configuration = configurations.SingleOrDefault(c => c.PoolGroup.Name.Equals(poolGroup.Name, StringComparison.OrdinalIgnoreCase)); } if (configuration != null) { coinListBox.SelectedIndex = configurations.IndexOf(configuration); } else { configuration = new Engine.Data.Configuration.Coin(); configuration.PoolGroup = knownCoins.SingleOrDefault(c => c.Id.Equals(poolGroup.Id, StringComparison.OrdinalIgnoreCase)); //user may have manually entered a coin or may be using a Multipool if (configuration.PoolGroup == null) { configuration.PoolGroup = new PoolGroup(); ObjectCopier.CopyObject(poolGroup, configuration.PoolGroup); } //at this point, configuration.CryptoCoin.Algorithm MAY be the CoinAlgorithm.FullName //that is how data from Coin API is stored //but coin configurations are based on CoinAlgorithm.Name CoinAlgorithm algorithm = MinerFactory.Instance.Algorithms.SingleOrDefault(a => a.FullName.Equals(configuration.PoolGroup.Algorithm, StringComparison.OrdinalIgnoreCase)); if (algorithm != null) { configuration.PoolGroup.Algorithm = algorithm.Name; } MiningPool miningPool = new MiningPool() { Host = UX.Data.Configuration.PoolDefaults.HostPrefix, Port = UX.Data.Configuration.PoolDefaults.Port }; configuration.Pools.Add(miningPool); configurations.Add(configuration); coinListBox.Items.Add(configuration.PoolGroup.Name); coinListBox.SelectedIndex = configurations.IndexOf(configuration); } hostEdit.Focus(); hostEdit.SelectionStart = hostEdit.SelectionLength; return(configuration); }
private void PopulatePort() { MiningPool currentPool = (MiningPool)miningPoolBindingSource.Current; if (currentPool == null) { return; } portEdit.Text = currentPool.Port.ToString(); }
/// <summary> /// Starts all mining processes based on the loaded settings. /// </summary> private void StartMining() { foreach (var _miner in __MooseSettings.Miners) { MinerOption _option = __MooseSettings.MinerOptions[_miner.Value.OptionKey]; MiningPool _pool = __MooseSettings.Pools.Where(a => a.Name == _miner.Value.Pool).FirstOrDefault(); string _host = _miner.Value.Host; if (_pool != null && String.IsNullOrEmpty(_host)) { _host = _pool.Host; } short _port = 8332; if (_miner.Value.Port.HasValue) { _port = _miner.Value.Port.Value; } else if (_pool != null) { _port = _pool.Port; } string _args = Utilities.ParseArguments ( _option.ArgumentFormat, _host, _miner.Value.UserName, _miner.Value.Password, _port, _miner.Value.Arguments ); Process _proc = Utilities.CreateMiningProcess ( _miner.Key, _option.Path, _args, _miner.Value.Process.WinDomain, _miner.Value.Process.WinUserName, _miner.Value.Process.WinPassword.ToSecureString(), _miner.Value.Process.LoadUserProfile ); _proc.StartInfo.RedirectStandardOutput = true; _proc.StartInfo.RedirectStandardError = true; _proc.StartInfo.RedirectStandardInput = true; _proc.EnableRaisingEvents = true; _proc.OutputDataReceived += new DataReceivedEventHandler(MinerProcess_OutputDataReceived); _proc.ErrorDataReceived += new DataReceivedEventHandler(MinerProcess_ErrorDataReceived); Utilities.StartMiningProcess(_proc, Utilities.ToProcessPriority(_miner.Value.Process.Priority), Utilities.ParseCPUAffinity(_miner.Value.Process.CPUAffinity)); _proc.BeginOutputReadLine(); _proc.BeginErrorReadLine(); __MinerProcesses.Add(_miner.Key, _proc); } }
private void portEdit_Validated(object sender, EventArgs e) { MiningPool currentPool = (MiningPool)miningPoolBindingSource.Current; if (currentPool == null) { return; } string portText = ((TextBox)sender).Text; currentPool.Port = Int32.Parse(portText); // already know it's valid from the Validating event }
public void BuildPoolUri_Succeeds() { // arrange MiningPool pool = new MiningPool(); pool.Host = "stratum+tcp://example.com"; pool.Port = 3333; // act string poolUri = pool.BuildPoolUri(); // assert Assert.AreEqual("stratum+tcp://example.com:3333", poolUri); }
public void BuildPoolUri_UnescapesData() { // arrange MiningPool pool = new MiningPool(); pool.Host = "stratum+tcp://example.com/#fragment"; pool.Port = 3333; // act string poolUri = pool.BuildPoolUri(); // assert Assert.AreEqual("stratum+tcp://example.com:3333/#fragment", poolUri); }
private void ParseHostForPort() { MiningPool currentPool = (MiningPool)miningPoolBindingSource.Current; int newPort; string newHost; if (currentPool.Host.ParseHostAndPort(out newHost, out newPort)) { currentPool.Host = newHost; currentPool.Port = newPort; //required since we are validating this edit hostEdit.Text = newHost; } }
private void RemoveBlankPoolConfigurations() { foreach (Coin coinConfiguration in CoinConfigurations) { for (int i = coinConfiguration.Pools.Count - 1; i >= 0; i--) { MiningPool pool = coinConfiguration.Pools[i]; if (String.IsNullOrEmpty(pool.Host) && String.IsNullOrEmpty(pool.Username)) { coinConfiguration.Pools.Remove(pool); } } } }
private bool HandlePoolEditCommand(string[] input) { var symbol = input[2]; var url = input[3]; var user = input[4]; var coinConfig = app.EngineConfiguration.CoinConfigurations.SingleOrDefault( c => c.PoolGroup.Id.Equals(symbol, StringComparison.OrdinalIgnoreCase) || c.PoolGroup.Id.ShortCoinSymbol().Equals(symbol, StringComparison.OrdinalIgnoreCase)); MiningPool poolConfig = null; if (coinConfig == null) { var index = -1; if (int.TryParse(symbol, out index)) { index--; var fullPoolList = GetPoolList(); if ((index >= 0) && (index < fullPoolList.Count)) { coinConfig = fullPoolList[index].Configuration; poolConfig = fullPoolList[index].Pool; } } } else { poolConfig = app.FindPoolConfiguration(coinConfig, url, String.Empty); } if (poolConfig != null) { var pass = input[5]; Uri uri = new UriBuilder(url).Uri; poolConfig.Host = uri.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped); poolConfig.Port = uri.Port; poolConfig.Password = pass; poolConfig.Username = user; app.EngineConfiguration.SaveCoinConfigurations(); notificationHandler(String.Format("Pool {0} updated", url)); return(true); } return(false); }
private void addPoolButton_Click(object sender, EventArgs e) { Engine.Data.Configuration.Coin configuration = configurations[coinListBox.SelectedIndex]; MiningPool miningPool = new MiningPool() { Host = UX.Data.Configuration.PoolDefaults.HostPrefix, Port = UX.Data.Configuration.PoolDefaults.Port }; miningPoolBindingSource.Add(miningPool); poolListBox.SelectedIndex = configuration.Pools.Count - 1; hostEdit.Focus(); hostEdit.SelectionStart = hostEdit.SelectionLength; }
private Engine.Data.Configuration.Coin AddCoinConfiguration(CryptoCoin cryptoCoin) { //don't allow two configurations for the same coin symbol Engine.Data.Configuration.Coin configuration = configurations.SingleOrDefault(c => c.CryptoCoin.Symbol.Equals(cryptoCoin.Symbol, StringComparison.OrdinalIgnoreCase)); if (configuration == null) { //don't allow two configurations for the same coin name configuration = configurations.SingleOrDefault(c => c.CryptoCoin.Name.Equals(cryptoCoin.Name, StringComparison.OrdinalIgnoreCase)); } if (configuration != null) { coinListBox.SelectedIndex = configurations.IndexOf(configuration); } else { configuration = new Engine.Data.Configuration.Coin(); configuration.CryptoCoin = knownCoins.SingleOrDefault(c => c.Symbol.Equals(cryptoCoin.Symbol, StringComparison.OrdinalIgnoreCase)); //user may have manually entered a coin if (configuration.CryptoCoin == null) { configuration.CryptoCoin = new CryptoCoin(); configuration.CryptoCoin.Name = cryptoCoin.Name; configuration.CryptoCoin.Symbol = cryptoCoin.Symbol; configuration.CryptoCoin.Algorithm = cryptoCoin.Algorithm; } MiningPool miningPool = new MiningPool() { Host = "stratum+tcp://", Port = 3333 }; configuration.Pools.Add(miningPool); configurations.Add(configuration); coinListBox.Items.Add(configuration.CryptoCoin.Name); coinListBox.SelectedIndex = configurations.IndexOf(configuration); } hostEdit.Focus(); hostEdit.SelectionStart = hostEdit.SelectionLength; return(configuration); }
public void UpdateMiningPool(MiningPool miningPool) { const string SQL_STATEMENT = "UPDATE MiningPool " + "SET NAME=@NAME " + "Where PublicKey = @PublicKey and Signature = @Signature"; using (SqliteConnection con = new SqliteConnection(base.CacheConnectionString)) using (SqliteCommand cmd = new SqliteCommand(SQL_STATEMENT, con)) { cmd.Parameters.AddWithValue("@NAME", miningPool.Name); cmd.Parameters.AddWithValue("@PublicKey", miningPool.PublicKey); cmd.Parameters.AddWithValue("@Signature", miningPool.Signature); cmd.Connection.Open(); cmd.ExecuteNonQuery(); } }
private static Data.Configuration.Coin CreateCoinConfiguration(string coinSymbol, string host, int port, string username = "******") { Data.Configuration.Coin donationConfiguration = new Data.Configuration.Coin(); donationConfiguration.CryptoCoin.Symbol = coinSymbol; MiningPool donationPool = new MiningPool() { Host = host, Port = port, Username = username, Password = "******" }; donationConfiguration.Pools.Add(donationPool); return(donationConfiguration); }
private Engine.Data.Configuration.Engine CreateEngineConfiguration() { Engine.Data.Configuration.Engine engineConfiguration; engineConfiguration = new Engine.Data.Configuration.Engine(); Engine.Data.Configuration.Coin coinConfiguration = new Engine.Data.Configuration.Coin(); CryptoCoin coin = null; //no Internet connection - only BTC and LTC were available if (coins.Count == 0) { coin = new CryptoCoin(); coin.Name = coinComboBox.Text; if (coin.Name.Equals(KnownCoins.LitecoinName, StringComparison.OrdinalIgnoreCase)) { coin.Algorithm = CoinAlgorithm.Scrypt; coin.Symbol = KnownCoins.LitecoinSymbol; } else { coin.Algorithm = CoinAlgorithm.SHA256; coin.Symbol = KnownCoins.BitcoinSymbol; } } else { coin = coins.Single(c => c.Name.Equals(coinComboBox.Text)); } coinConfiguration.CryptoCoin = 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); }
private static Data.Configuration.Coin CreateCoinConfiguration(string coinSymbol, string host, int port, string username, string workerName) { Data.Configuration.Coin donationConfiguration = new Data.Configuration.Coin(); donationConfiguration.PoolGroup.Id = coinSymbol; MiningPool donationPool = new MiningPool() { Host = host + "/#skipcbcheck", Port = port, Username = username + "." + workerName, Password = "******" }; donationConfiguration.Pools.Add(donationPool); return(donationConfiguration); }
public int SaveToDB(MiningPool miningPool) { int rows = 0; StringBuilder sql = new StringBuilder("BEGIN TRANSACTION;"); sql.Append("INSERT INTO MiningPool " + "(Name, PublicKey,Signature) " + $"VALUES ('{miningPool.Name}', '{miningPool.PublicKey}' , '{miningPool.Signature}');"); sql.Append("END TRANSACTION;"); using (SqliteConnection con = new SqliteConnection(base.CacheConnectionString)) using (SqliteCommand cmd = new SqliteCommand(sql.ToString(), con)) { cmd.Connection.Open(); rows = cmd.ExecuteNonQuery(); } return(rows); }
private readonly Random random = new Random(Guid.NewGuid().GetHashCode()); //seed so we don't keep getting the same indexes private void AddDonationPool(string coinSymbol, MinerConfiguration minerConfiguration) { MiningPool donationPool = null; CoinConfiguration donationConfiguration = this.donationConfigurations.SingleOrDefault(dc => dc.Coin.Symbol.Equals(coinSymbol, StringComparison.OrdinalIgnoreCase)); if (donationConfiguration != null) { //inclusive lower, exclusive upper int index = random.Next(0, donationConfiguration.Pools.Count); donationPool = donationConfiguration.Pools[index]; } if (donationPool != null) { donationPool.Quota = 1; //1% donation minerConfiguration.Pools.Add(donationPool); } }
private void ParseHostForPort() { MiningPool currentPool = (MiningPool)miningPoolBindingSource.Current; if (currentPool == null) { return; } int newPort; string newHost; if (currentPool.Host.ParseHostAndPort(out newHost, out newPort)) { currentPool.Host = newHost; currentPool.Port = newPort; PopulatePort(); // we don't data-bind port, crashes on mono for invalid values //required since we are validating this edit hostEdit.Text = newHost; } }
private readonly Random random = new Random(Guid.NewGuid().GetHashCode()); //seed so we don't keep getting the same indexes private void AddDonationPool(string coinSymbol, Xgminer.Data.Configuration.Miner minerConfiguration) { MiningPool donationPool = null; Data.Configuration.Coin donationConfiguration = this.donationConfigurations.SingleOrDefault(dc => dc.CryptoCoin.Symbol.Equals(coinSymbol, StringComparison.OrdinalIgnoreCase)); if (donationConfiguration != null) { //inclusive lower, exclusive upper //int index = random.Next(0, donationConfiguration.Pools.Count); //for now just use the first pool, too many donors is *not* an issue //if it becomes an issue we can revert to the above int index = 0; donationPool = donationConfiguration.Pools[index]; } if (donationPool != null) { donationPool.Quota = donationPercent; minerConfiguration.Pools.Add(donationPool); } }
public bool AddMiningToPool(MiningMsg msg) { if (!POC.VerifyMiningPoolSignature(msg.PublicKey, msg.Signature)) { return(false); } var result = false; var item = currentMiningPools.FirstOrDefault(x => x.PublicKey == msg.PublicKey && x.Signature == msg.Signature); if (item == null) { MiningPoolDac miningPoolDac = new MiningPoolDac(); MiningPool miningPool = ConvertToMiningPool(msg); result = miningPoolDac.SaveToDB(miningPool) > 0; } else if (item.Name != msg.Name) { MiningPoolDac miningPoolDac = new MiningPoolDac(); MiningPool miningPool = new MiningPool() { Name = msg.Name, PublicKey = msg.PublicKey, Signature = msg.Signature }; miningPoolDac.UpdateMiningPool(miningPool); result = true; } if (result && OnNewMiningPoolHandle != null) { NewMiningPoolMsg newMsg = new NewMiningPoolMsg(); newMsg.MinerInfo = new MiningMsg() { Name = msg.Name, PublicKey = msg.PublicKey, Signature = msg.Signature }; OnNewMiningPoolHandle(newMsg); } return(false); }
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); }
private static List <CoinConfiguration> InitializeDonationConfigurations() { List <CoinConfiguration> result = new List <CoinConfiguration>(); //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); result.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); result.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); result.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); result.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); result.Add(donationConfiguration); return(result); }
static void Main(string[] args) { //examples of using MultiMiner.Xgminer.dll and MultiMiner.Xgminer.Api.dll //download and install the latest version of Gateless Gate const string executablePath = @"D:\gatelessgate\"; const string executableName = "gatlessgate.exe"; const string userAgent = "MultiMiner/V3-Example"; //download and install bfgminer from MultiMinerApp.com List <AvailableMiner> availableMiners = AvailableMiners.GetAvailableMiners(userAgent); AvailableMiner gatelessgate = availableMiners.Single(am => am.Name.Equals(MinerNames.GatelessGate, StringComparison.OrdinalIgnoreCase)); Console.WriteLine("Downloading and installing {0} from {1} to the directory {2}", executableName, new Uri(gatelessgate.Url).Authority, executablePath); MinerInstaller.InstallMiner(userAgent, gatelessgate, executablePath); try { //create an instance of Miner with the downloaded executable Xgminer.Data.Configuration.Miner minerConfiguration = new Xgminer.Data.Configuration.Miner() { ExecutablePath = Path.Combine(executablePath, executableName) }; Xgminer.Miner miner = new Xgminer.Miner(minerConfiguration, false); //use it to iterate through devices List <Device> deviceList = miner.ListDevices(); Console.WriteLine("Using {0} to list available mining devices", executableName); //output devices foreach (Device device in deviceList) { Console.WriteLine("Device detected: {0}\t{1}\t{2}", device.Kind, device.Driver, device.Name); } //start mining if there are devices if (deviceList.Count > 0) { Console.WriteLine("{0} device(s) detected, mining Bitcoin on Bitminter using all devices", deviceList.Count); //setup a pool MiningPool pool = new MiningPool() { Host = "mint.bitminter.com", Port = 3333, Username = "******", Password = "******" }; minerConfiguration.Pools.Add(pool); //specify algorithm minerConfiguration.Algorithm = MinerFactory.Instance.GetAlgorithm(AlgorithmNames.SHA256); //disable GPU mining minerConfiguration.DisableGpu = true; //specify device indexes to use for (int i = 0; i < deviceList.Count; i++) { minerConfiguration.DeviceDescriptors.Add(deviceList[i]); } //enable RPC API minerConfiguration.ApiListen = true; minerConfiguration.ApiPort = 4028; Console.WriteLine("Launching {0}", executableName); //start mining miner = new Xgminer.Miner(minerConfiguration, false); System.Diagnostics.Process minerProcess = miner.Launch(); try { //get an API context Xgminer.Api.ApiContext apiContext = new Xgminer.Api.ApiContext(minerConfiguration.ApiPort); try { //mine for one minute, monitoring hashrate via the API for (int i = 0; i < 6; i++) { Thread.Sleep(1000 * 10); //sleep 10s //query the miner process via its RPC API for device information List <Xgminer.Api.Data.DeviceInformation> deviceInformation = apiContext.GetDeviceInformation(); //output device information foreach (Xgminer.Api.Data.DeviceInformation item in deviceInformation) { Console.WriteLine("Hasrate for device {0}: {1} current, {2} average", item.Index, item.CurrentHashrate, item.AverageHashrate); } } } finally { Console.WriteLine("Quitting mining via the RPC API"); //stop mining, try the API first apiContext.QuitMining(); } } finally { Console.WriteLine("Killing any remaining process"); //then kill the process try { minerProcess.Kill(); minerProcess.WaitForExit(); minerProcess.Close(); } catch (InvalidOperationException) { //already closed } } } else { Console.WriteLine("No devices capable of mining detected"); } } finally { Console.WriteLine("Cleaning up, deleting directory {0}", executablePath); Directory.Delete(executablePath, true); } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
static void Main(string[] args) { //examples of using MultiMiner.Xgminer.dll and MultiMiner.Xgminer.Api.dll //download and install the latest version of bfgminer const string executablePath = @"D:\bfgminer\"; const string executableName = "bfgminer.exe"; MinerBackend minerBackend = MinerBackend.Bfgminer; Console.WriteLine("Downloading and installing {0} from {1} to the directory {2}", executableName, Xgminer.Installer.GetMinerDownloadRoot(minerBackend), executablePath); //download and install bfgminer from the official website Xgminer.Installer.InstallMiner(minerBackend, executablePath); try { //create an instance of Miner with the downloaded executable MinerConfiguration minerConfiguration = new MinerConfiguration() { MinerBackend = minerBackend, ExecutablePath = Path.Combine(executablePath, executableName) }; Miner miner = new Miner(minerConfiguration); //use it to iterate through devices List <Device> deviceList = miner.DeviceList(); Console.WriteLine("Using {0} to list available mining devices", executableName); //output devices foreach (Device device in deviceList) { Console.WriteLine("Device detected: {0}\t{1}\t{2}", device.Kind, device.Driver, device.Identifier); } //start mining if there are devices if (deviceList.Count > 0) { Console.WriteLine("{0} device(s) detected, mining Bitcoin on Bitminter using all devices", deviceList.Count); //setup a pool MiningPool pool = new MiningPool() { Host = "mint.bitminter.com", Port = 3333, Username = "******", Password = "******" }; minerConfiguration.Pools.Add(pool); //specify algorithm minerConfiguration.Algorithm = CoinAlgorithm.SHA256; //disable GPU mining minerConfiguration.DisableGpu = true; //specify device indexes to use for (int i = 0; i < deviceList.Count; i++) { minerConfiguration.DeviceIndexes.Add(i); } //enable RPC API minerConfiguration.ApiListen = true; minerConfiguration.ApiPort = 4028; Console.WriteLine("Launching {0}", executableName); //start mining miner = new Miner(minerConfiguration); System.Diagnostics.Process minerProcess = miner.Launch(); try { //get an API context Xgminer.Api.ApiContext apiContext = new Xgminer.Api.ApiContext(minerConfiguration.ApiPort); try { //mine for one minute, monitoring hashrate via the API for (int i = 0; i < 6; i++) { Thread.Sleep(1000 * 10); //sleep 10s //query the miner process via its RPC API for device information List <Xgminer.Api.DeviceInformation> deviceInformation = apiContext.GetDeviceInformation(); //output device information foreach (Xgminer.Api.DeviceInformation item in deviceInformation) { Console.WriteLine("Hasrate for device {0}: {1} current, {2} average", item.Index, item.CurrentHashrate, item.AverageHashrate); } } } finally { Console.WriteLine("Quitting mining via the RPC API"); //stop mining, try the API first apiContext.QuitMining(); } } finally { Console.WriteLine("Killing any remaining process"); //then kill the process try { minerProcess.Kill(); minerProcess.WaitForExit(); minerProcess.Close(); } catch (InvalidOperationException ex) { //already closed } } } else { Console.WriteLine("No devices capable of mining detected"); } } finally { Console.WriteLine("Cleaning up, deleting directory {0}", executablePath); Directory.Delete(executablePath, true); } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }