/// <summary>
        /// Miner indítása
        /// </summary>
        /// <returns></returns>
        public bool StartMiner()
        {
            bool success = false;

            if (_pools != null && _pools.Count > 0)
            {
                if (MinerType == MinerType.GPU)
                {
                    switch (Algorithm)
                    {
                    case (int)SupportedAlgos.CryptoNight:
                    default:
                        Stratum.Stratum mainPool = createStratumFromPoolSettings(_pools, (int)SupportedAlgos.CryptoNight);
                        if (mainPool != null && mainPool is CryptoNightStratum)
                        {
                            foreach (var device in Devices.Where(x => x.IsEnabled))
                            {
                                for (int i = 0; i < device.Threads; ++i)
                                {
                                    OpenCLCryptoNightMiner miner = null;
                                    try
                                    {
                                        miner = new OpenCLCryptoNightMiner(device);
                                        miner.Start(mainPool as CryptoNightStratum, device.Intensity, device.WorkSize, true);
                                        Miners.Add(miner);
                                    }
                                    catch (Exception ex)
                                    {
                                        Messenger.Default.Send <MinerOutputMessage>(new MinerOutputMessage()
                                        {
                                            OutputText = $"Faild to start GPU miner on Device# {device.ADLAdapterIndex} Thread# {i+1}", Exception = ex, IsError = true
                                        });
                                    }
                                }
                            }
                            success = true;
                        }
                        break;
                    }
                }
                else if (MinerType == MinerType.CPU)
                {
                    exeMinerManager = new ExeManager(ApplicationPath, ExeFileName);
                    string minerParameter = generateMinerCall();
                    MinerThread = new Thread(() => exeMinerManager.ExecuteResource(minerParameter));
                    MinerThread.Start();
                    success = true;
                }
            }
            else
            {
                Messenger.Default.Send <MinerOutputMessage>(new MinerOutputMessage()
                {
                    OutputText = "WARNING: No main pool selected."
                });
            }

            return(success);
        }
Exemple #2
0
 public Job(Stratum aStratum)
 {
     Stratum = aStratum;
     try { _mutex.WaitOne(5000); } catch (Exception) { }
     nextLocalExtranonce = 0;
     for (int i = 0; i < Stratum.LocalExtranonceSize; ++i)
     {
         nextLocalExtranonce |= (UInt64)r.Next(32, 255) << (i * 8); // TODO
     }
     try { _mutex.ReleaseMutex(); } catch (Exception) { }
 }
 private Stratum.Stratum createStratumFromPoolSettings(List <PoolSettingsXmlUI> pPoolSettings, int pAlgorithm)
 {
     Stratum.Stratum result = null;
     switch (pAlgorithm)
     {
     case (int)SupportedAlgos.CryptoNight:
     default:
         result = new CryptoNightStratum(pPoolSettings);
         break;
     }
     return(result);
 }
 private Stratum.Stratum createStratumFromPoolSettings(List <PoolSettingsXml> pPoolSettings, Algorithm pAlgorithm)
 {
     Stratum.Stratum result = null;
     switch (pAlgorithm)
     {
     case Algorithm.CryptoNight:
     default:
         result = new CryptoNightStratum(pPoolSettings);
         break;
     }
     return(result);
 }
Exemple #5
0
            public Job(Stratum pStratum, string pID, string pBlob, string pTarget, string pVariant)
                : base(pStratum)
            {
#if TEST
                //ETN
                _strBlob = "0606e7e2c1d80568587b00009621506f8b1b4cb0d18ad825d24c51cc44340550a86aab031f313f00000000d137ad05594fc9770631e5d6e08a1c60ba4bd12468f3543323ae456e2916e2dccf01";
                SetBlob(_strBlob);
                SetTarget("8b4f0100");
                SetVariant("1");
                ID = "272014441993087";
#else
                ID       = pID;
                _strBlob = pBlob;
                SetBlob(pBlob);
                SetTarget(pTarget);
                SetVariant(pVariant);
#endif
            }