public bool Authenticate(IMiner miner)
        {
            try
            {
                if (!IsEnabled)
                    return false;

                using (var connection = new MySqlConnection(_mySqlProvider.ConnectionString))
                {
                    // query the username against mpos pool_worker table.
                    var result = connection.Query<string>(
                        "SELECT password FROM pool_worker WHERE username = @username",
                        new {username = miner.Username}).FirstOrDefault();

                    // if matching record exists for given miner username, then authenticate the miner.
                    // note: we don't check for password on purpose.
                    return result != null;
                }
            }
            catch (Exception e)
            {
                _logger.Error("An exception occured while reading pool_worker table; {0:l}", e.Message);
                return false;
            }
        }
        public MinerAuthenticationEventArgs(IMiner miner)
        {
            if (miner == null)
                throw new ArgumentNullException("miner");

            this.Miner = miner;
        }
 public bool Authenticate(IMiner miner)
 {
     // within current implementation of hybrid storage layer, we don't have users registered to a pool but they
     // just mine with supplying a valid coin wallet address as username. So we just need to make sure the username
     // is valid address against the coin network.
     try
     {
         return _daemonClient.ValidateAddress(miner.Username).IsValid; // if so validate it against coin daemon as an address.
     }
     catch (RpcException)
     {
         return false;
     }
 }
Beispiel #4
0
 public SocketServiceContext(IMiner miner)
 {
     Miner = miner;
 }
Beispiel #5
0
 public MinerEventArgs(IMiner miner)
 {
     Miner = miner;
 }
Beispiel #6
0
 public bool SubmitWork(IMiner miner, Work work, string comment)
 {
     return onWork(miner, work);
 }
Beispiel #7
0
 public MinerInfoLogs(IMiner miner, MinerInfo parent)
 {
     Miner    = miner;
     m_Parent = parent;
     InitializeComponent();
 }
Beispiel #8
0
        public MinerProgramBase(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner)
        {
            MinerState = MinerProgramState.Stopped;

            MainCoin           = mainCoin;
            MainCoinConfigurer = mainCoin.SettingsScreen;
            DualCoin           = dualCoin;
            if (DualCoin != null)
            {
                DualCoinConfigurer = DualCoin.SettingsScreen;
            }
            DualMining = dualMining;
            Name       = minerName;
            Miner      = miner;
            AutomaticScriptGeneration = true;
            m_downloader = new MinerDownloader(MINERURL, EXENAME, Miner);
            Enabled      = false;
            GenerateScript(false);
        }
Beispiel #9
0
 /// <summary>
 /// Creates a <see cref="HttpWebRequest"/> for JSON-RPC.
 /// </summary>
 /// <param name="miner"></param>
 /// <param name="comment"></param>
 /// <returns></returns>
 HttpWebRequest OpenRpc(IMiner miner, string comment)
 {
     return Open(url, "POST", miner, comment);
 }
Beispiel #10
0
        /// <summary>
        /// Invokes the 'getwork' JSON method, submitting the proposed work. Returns <c>true</c> if the service accepts
        /// the proposed work.
        /// </summary>
        /// <param name="work"></param>
        /// <returns></returns>
        public bool SubmitWorkRpc(IMiner miner, Work work, string comment)
        {
            var req = OpenRpc(miner, comment);
            if (req == null)
                return false;

            // header needs to have SHA-256 padding appended
            var data = Sha256.AllocateInputBuffer(80);

            // prepare header buffer with SHA-256
            Sha256.Prepare(data, 80, 0);
            Sha256.Prepare(data, 80, 1);

            // dump header data on top of padding
            Array.Copy(work.Header, data, 80);

            // encode in proper format
            var solution = Memory.Encode(data);

            Console.WriteLine();
            Console.WriteLine("SOLUTION: {0,10} {1}", miner.GetType().Name, Memory.Encode(work.Header));
            Console.WriteLine();
            Console.WriteLine();

            using (var txt = new StreamWriter(req.GetRequestStream()))
            using (var wrt = new JsonTextWriter(txt))
            {
                wrt.WriteStartObject();
                wrt.WriteMember("id");
                wrt.WriteString("json");
                wrt.WriteMember("method");
                wrt.WriteString("getwork");
                wrt.WriteMember("params");
                wrt.WriteStartArray();
                wrt.WriteString(solution);
                wrt.WriteEndArray();
                wrt.WriteEndObject();
                wrt.Flush();
            }

            using (var txt = new StreamReader(req.GetResponse().GetResponseStream()))
            using (var rdr = new JsonTextReader(txt))
            {
                if (!rdr.MoveToContent() && rdr.Read())
                    throw new JsonException("Unexpected content from 'getwork <data>'.");

                var response = JsonConvert.Import<JsonSubmitWork>(rdr);
                if (response == null)
                    throw new JsonException("No response returned.");

                if (response.Error != null)
                    Console.WriteLine("JSON-RPC: {0}", response.Error);

                Console.WriteLine();
                Console.WriteLine("{0}: {1,10} {2}", response.Result ? "ACCEPTED" : "REJECTED", miner.GetType().Name, Memory.Encode(work.Header));
                Console.WriteLine();
                Console.WriteLine();

                return response.Result;
            }
        }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="miner"></param>
 /// <param name="resource"></param>
 internal MinerEntry(IMiner miner, MinerDevice resource)
 {
     Miner = miner;
     Resource = resource;
 }
 public HttpServiceContext(IMiner miner, HttpServiceRequest request)
 {
     Miner = miner;
     Request = request;
 }
Beispiel #13
0
 public CCMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
     base(mainCoin, dualMining, dualCoin, minerName, miner)
 {
     Type                = "Nvidia";
     GPUType             = CardMake.Nvidia;
     OutputReader        = new CCReader(STATS_LINK, STATS_LINK_PORT);
     MiningIntensityLow  = 6;
     MiningIntensityHigh = 35;
     MiningIntensity     = 23;
     MinerExehash        = "9A8F7207D520B82ED98FF31EC4B539E2";
 }
Beispiel #14
0
 public CGMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
     base(mainCoin, dualMining, dualCoin, minerName, miner)
 {
     Type                = "AMD";
     GPUType             = CardMake.Amd;
     OutputReader        = new CGReader(STATS_LINK, STATS_LINK_PORT);
     MiningIntensityLow  = 2;
     MiningIntensityHigh = 19;
     MiningIntensity     = 13;
 }
 public MinerEventArgs(IMiner miner)
 {
     Miner = miner;
 }
 public FandangoFutureViewModel(IMinerModel minerModel, IMiner futureMiner)
     : this()
 {
     _fmlMiner = minerModel.Miners[MinerModel.FML_INDEX];
     Miner     = futureMiner;
 }
Beispiel #17
0
        public bool AddMiner(IMiner miner)
        {
            bool toSave = false;

            ICoinConfigurer mainCoinConfigurer = miner.MainCoin.SettingsScreen;
            ICoinConfigurer dualCoinConfigurer = null;

            if (miner.DualMining)
            {
                dualCoinConfigurer = miner.DualCoin.SettingsScreen;
            }

            MinerData newMiner = new MinerData();

            newMiner.Id        = miner.Id;
            newMiner.Name      = miner.Name;
            newMiner.Algorithm = miner.MainCoin.Algorithm.Name;
            //newMiner.BATFileName ="";
            newMiner.MainCoin            = miner.MainCoin.Name;
            newMiner.MainCoinPool        = mainCoinConfigurer.Pool;
            newMiner.MainCoinWallet      = mainCoinConfigurer.Wallet;
            newMiner.MainCoinPassword    = mainCoinConfigurer.Password;
            newMiner.MainCoinPoolAccount = mainCoinConfigurer.PoolAccount;
            newMiner.DualMining          = miner.DualMining;
            newMiner.MinerGpuType        = miner.MinerGpuType;
            newMiner.HashRate            = miner.HashRate;

            if (miner.DualMining)
            {
                newMiner.DualCoin            = miner.DualCoin.Name;
                newMiner.DualCoinPool        = dualCoinConfigurer.Pool;
                newMiner.DualCoinWallet      = dualCoinConfigurer.Wallet;
                newMiner.DualCoinPoolAccount = dualCoinConfigurer.PoolAccount;
            }
            //minerprograms
            foreach (IMinerProgram item in miner.MinerPrograms)
            {
                MinerScript script = new MinerScript();
                script.BATfile     = item.BATFILE;
                script.ProgramType = item.Type;
                script.AutomaticScriptGeneration = item.AutomaticScriptGeneration;
                script.MiningIntensity           = item.MiningIntensity;

                newMiner.MinerScripts.Add(script);
            }

            //if a similar type is alredy present, them remove it
            List <int> removeIds = new List <int>();
            int        i         = 0;

            foreach (MinerData item in Miners)
            {
                if (item.Id == miner.Id)
                {
                    removeIds.Add(i);
                }
                i++;
            }
            foreach (int j in removeIds)
            {
                Miners.RemoveAt(j);
            }
            Miners.Add(newMiner);
            toSave = true;

            return(toSave);
        }
Beispiel #18
0
 public CCMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
     base(mainCoin, dualMining, dualCoin, minerName, miner)
 {
     Type                = "Nvidia";
     GPUType             = CardMake.Nvidia;
     OutputReader        = new CCReader(STATS_LINK, STATS_LINK_PORT);
     MiningIntensityLow  = 6;
     MiningIntensityHigh = 35;
     MiningIntensity     = 23;
 }
Beispiel #19
0
        /// <summary>
        /// Opens a web request.
        /// </summary>
        /// <param name="url"></param>
        /// <param name="method"></param>
        /// <param name="miner"></param>
        /// <param name="comment"></param>
        /// <returns></returns>
        HttpWebRequest Open(Uri url, string method, IMiner miner, string comment)
        {
            // method requires an absolute url to function
            if (!url.IsAbsoluteUri)
                return null;

            // extract user information from url
            var user = url.UserInfo
                .Split(':')
                .Select(i => HttpUtility.UrlDecode(i))
                .ToArray();

            // create request, authenticating using information in the url
            var req = (HttpWebRequest)HttpWebRequest.Create(url);
            req.Timeout = (int)TimeSpan.FromSeconds(60).TotalMilliseconds;
            req.Credentials = new NetworkCredential(user[0], user[1]);
            req.PreAuthenticate = true;
            req.Method = method;
            req.Pipelined = true;
            req.UserAgent = "BitMaker";
            req.Headers["X-BitMaker-MachineName"] = Environment.MachineName;

            if (miner != null)
                req.Headers["X-BitMaker-Miner"] = miner.GetType().Name;

            if (!string.IsNullOrWhiteSpace(comment))
                req.Headers["X-BitMaker-Comment"] = comment;

            return req;
        }
Beispiel #20
0
 public void SelectMiningView(IMiner miner)
 {
     ShowMiningInfo(miner);
 }
Beispiel #21
0
 public void StartMining()
 {
     m_keepMining = true;
     ActiveMiner  = SelectedMiner;
     SelectedMiner.StartMining();
 }
 public SocketServiceContext(IMiner miner, SocketServiceRequest request)
 {
     Miner = miner;
     Request = request;
 }
Beispiel #23
0
 public void StartMiningDefaultMiner()
 {
     ActiveMiner = SelectedMiner;
     StartMining(ActiveMiner);
 }
Beispiel #24
0
 public MinerStateHandler(IMiner miner)
 {
     _miner = miner ?? throw new ArgumentNullException(nameof(miner));
 }
Beispiel #25
0
 public Work GetWork(IMiner miner, string comment)
 {
     return Utils.Work;
 }
Beispiel #26
0
 public CollierHub(IApplicationCancellationTokenFactory cancellationTokenFactory, IMiner miner, IEnumerable <IMiningInfoNotifier> miningInfoBroadcasters)
 {
     _cancellationTokenFactory = cancellationTokenFactory ??
                                 throw new ArgumentNullException(nameof(cancellationTokenFactory));
     _miner = miner ?? throw new ArgumentNullException(nameof(miner));
     _miningInfoNotifiers = miningInfoBroadcasters ?? throw new ArgumentNullException(nameof(miningInfoBroadcasters));
 }
Beispiel #27
0
        private bool SendJobToMiner(IMiner miner, IJob job)
        {
            if (!miner.Authenticated)
                return false;

            if (!miner.Subscribed)
                return false;

            if (!miner.SupportsJobNotifications)
                return false;

            miner.SendDifficulty();
            miner.SendJob(job);

            return true;
        }
Beispiel #28
0
 public bool Authenticate(IMiner miner)
 {
     // empty storage layer is only used when no valid storage-layer configuration is available.
     // just authenticate all requests as basically we can't validate nor pay miners actually.
     return(true);
 }
Beispiel #29
0
        public ClaymoreMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
            base(mainCoin, dualMining, dualCoin, minerName, miner)

        {
            Type         = "Claymore";
            GPUType      = CardMake.Amd;//Dont change this to common. it creates problem while we switch miner on/off in checkbox
            OutputReader = new ClayMoreEthReader(STATS_LINK);
        }
Beispiel #30
0
 public HttpRpcContext(IMiner miner, HttpRpcResponse response)
 {
     this.Miner = miner;
     this.Response = response;
 }
Beispiel #31
0
 public CGMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
     base(mainCoin, dualMining, dualCoin, minerName, miner)
 {
     Type                = "AMD";
     GPUType             = CardMake.Amd;
     OutputReader        = new CGReader(STATS_LINK, STATS_LINK_PORT);
     MiningIntensityLow  = 2;
     MiningIntensityHigh = 19;
     MiningIntensity     = 13;
     MinerExehash        = "557C6D2E68679C65898A5CBF8F188087";
 }
Beispiel #32
0
        private void Ban(IMiner miner)
        {
            // TODO: add vanilla miners to banlist too.
            if (miner is IGetworkMiner) // as vanilla miners doesn't use persistent connections, we don't need to disconect him
                return; // but just blacklist his ip.

            var client = (IClient) miner;
            var ip = client.Connection.RemoteEndPoint.Address;

            if(!_bannedIps.ContainsKey(ip))
                _bannedIps.Add(ip, TimeHelpers.NowInUnixTimestamp());

            client.Connection.Disconnect();
        }
        public ClaymoreCNCpu(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
            base(mainCoin, dualMining, dualCoin, minerName, miner)
        {
            Type    = "CPU";
            GPUType = CardMake.CPU;

            OutputReader = new ClayMoreCNCpuReader(STATS_LINK);
        }
Beispiel #34
0
 public MainchainNodeService(IStateStore stateStore, ITxHub hub, IChainCreationService chainCreationService,
                             IBlockSynchronizer blockSynchronizer, IChainService chainService, IMiner miner, ILogger logger)
 {
     _stateStore           = stateStore;
     _chainCreationService = chainCreationService;
     _chainService         = chainService;
     _txHub             = hub;
     _logger            = logger;
     _miner             = miner;
     _blockSynchronizer = blockSynchronizer;
 }
Beispiel #35
0
 public MinerFromPlugin(string pluginUUID, List <MiningPair> miningPairs, string groupKey) : base(pluginUUID, miningPairs, groupKey)
 {
     _plugin = MinerPluginsManager.GetPluginWithUuid(pluginUUID);
     _miner  = _plugin.CreateMiner();
 }
        private static void CheckSwitching()
        {
            try
            {
                WriteInfo(" Check switching..");
                IProfitSwitchingStrategy profitSwitchingStrategy = ProfitSwitchingStrategyFactory.GetProfitSwitchingStrategy(_profitSwitchingStrategy ?? ProfitSwitchingStrategy.MaximizeFiat);
                // Find optimal configs
                Dictionary <string, MiningConfig> optimalMiningConfigs = new Dictionary <string, MiningConfig>();
                if (_manualMode)
                {
                    foreach (var manualMininigConfig in _manualMininigConfigs)
                    {
                        MiningConfig miningConfig = new MiningConfig(manualMininigConfig.Value.DeviceConfig, manualMininigConfig.Value.Pool);
                        optimalMiningConfigs.Add(manualMininigConfig.Key, miningConfig);
                    }
                }
                else
                {
                    foreach (Algorithm algorithm in Config.Algorithms)
                    {
                        if (algorithm.Enabled)
                        {
                            foreach (DeviceConfig algorithmDeviceConfig in algorithm.DeviceConfigs)
                            {
                                if (algorithmDeviceConfig.Enabled)
                                {
                                    foreach (Pool algorithmPool in algorithm.Pools.Where(p => p.Enabled))
                                    {
                                        Profit?profit = GetAdjustedProfit(algorithmPool, algorithmDeviceConfig.ExpectedHashrate, true);
                                        if (profit.HasValue)
                                        {
                                            if (!optimalMiningConfigs.ContainsKey(algorithmDeviceConfig.FullDeviceId))
                                            {
                                                SetOptimalMiningConfigWithThreshold(profit.Value, profitSwitchingStrategy, algorithmDeviceConfig, algorithmPool, optimalMiningConfigs);
                                            }
                                            else
                                            {
                                                MiningConfig bestMiningConfig = optimalMiningConfigs[algorithmDeviceConfig.FullDeviceId];
                                                Profit?      bestProfit       = GetAdjustedProfit(bestMiningConfig.Pool, bestMiningConfig.DeviceConfig.ExpectedHashrate, true);
                                                if (!bestProfit.HasValue || profitSwitchingStrategy.IsProfitABetterThanB(profit.Value, algorithmPool.ProfitTimeframe, bestProfit.Value, bestMiningConfig.Pool.ProfitTimeframe, 0))
                                                {
                                                    SetOptimalMiningConfigWithThreshold(profit.Value, profitSwitchingStrategy, algorithmDeviceConfig, algorithmPool, optimalMiningConfigs);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                // Merge miners and get list of optimal miners
                List <IMiner> optimalMiners = new List <IMiner>();
                foreach (var optimalMiningConfigKeyValue in optimalMiningConfigs)
                {
                    MiningConfig miningConfig = optimalMiningConfigKeyValue.Value;
                    IMiner       miner        = MinerFactory.GetMiner(new HashSet <DeviceConfig>()
                    {
                        miningConfig.DeviceConfig
                    }, miningConfig.Pool);
                    IMiner existingMiner = optimalMiners.FirstOrDefault(m => m.Name == miner.Name && m.Pool.Equals(miner.Pool));
                    if (existingMiner != null)
                    {
                        existingMiner.DeviceConfigs.Add(miningConfig.DeviceConfig);
                        miningConfig.Miner = existingMiner;
                    }
                    else
                    {
                        miningConfig.Miner = miner;
                        optimalMiners.Add(miner);
                    }
                }

                bool displayNeedsUpdate = false;
                // Get list of current miners
                List <IMiner> currentMiners = GetCurrentMiners();

                //Check if existing miner will be kept
                foreach (IMiner currentMiner in currentMiners)
                {
                    if (optimalMiners.Any(om => om.Pool.Equals(currentMiner.Pool) && om.DeviceConfigs.SetEquals(currentMiner.DeviceConfigs)))
                    {
                        foreach (DeviceConfig currentMinerDeviceConfig in currentMiner.DeviceConfigs)
                        {
                            optimalMiningConfigs[currentMinerDeviceConfig.FullDeviceId].Miner = currentMiner;
                        }
                    }
                }

                //Check if existing miner has to be closed
                foreach (IMiner currentMiner in currentMiners.ToArray())
                {
                    if (!optimalMiners.Any(om => om.Pool.Equals(currentMiner.Pool) && om.DeviceConfigs.SetEquals(currentMiner.DeviceConfigs)))
                    {
                        displayNeedsUpdate = true;
                        currentMiner.StopMiner();
                        currentMiners.Remove(currentMiner);
                    }
                }

                //Check if new miner has to start
                foreach (IMiner optimalMiner in optimalMiners)
                {
                    if (!currentMiners.Any(cm => cm.Pool.Equals(optimalMiner.Pool) && cm.DeviceConfigs.SetEquals(optimalMiner.DeviceConfigs)))
                    {
                        displayNeedsUpdate = true;
                        foreach (DeviceConfig deviceConfig in optimalMiner.DeviceConfigs)
                        {
                            if (!string.IsNullOrEmpty(deviceConfig.PrepareScript))
                            {
                                Helpers.ExecuteScript(deviceConfig.MinerPath, AppFolderPath);
                            }
                        }
                        Task.Delay(TimeSpan.FromSeconds(Config.MinerStartDelay)).Wait();
                        optimalMiner.StartMiner(Config.StartMinerMinimized);
                    }
                }

                _currentMininigConfigs = optimalMiningConfigs;

                if (displayNeedsUpdate)
                {
                    _displayUpdaterCts?.Cancel();
                }
            }
            catch (Exception e)
            {
                Log.Debug("Check switching failed: " + e);
            }
        }
Beispiel #37
0
        /// <summary>
        /// Initiates a long-poll request for work.
        /// </summary>
        /// <param name="miner"></param>
        /// <param name="comment"></param>
        /// <returns></returns>
        Work GetWorkLp(IMiner miner, string comment)
        {
            var req = OpenLp(miner, comment);
            if (req == null)
                return null;

            var asy = req.BeginGetResponse(null, null);

            // wait until we're told to shutdown, or we run out of time
            var elapsed = 0;
            while (run && elapsed < TimeSpan.FromSeconds(60).TotalMilliseconds)
            {
                asy.AsyncWaitHandle.WaitOne(1000);
                elapsed += 1000;
            }

            if (!asy.IsCompleted)
            {
                // if it never completed, abort it
                req.Abort();
                return null;
            }
            else
                // otherwise parse the result
                return ParseGetWork(req.EndGetResponse(asy));
        }
        public void StartMiner(Mineable mineable, Settings settings, string appRoot, DirectoryInfo appRootFolder)
        {
            _mineable = mineable;
            _process  = new Process();
            string minerPath       = Helpers.ResolveToFullPath(mineable.CastXmrPath, appRoot);
            string minerFolderPath = Path.GetDirectoryName(minerPath);

            _process.StartInfo.FileName = "cmd";

            List <string> userDefindedArgs = new List <string>();

            if (!String.IsNullOrEmpty(mineable.CastXmrExtraArguments))
            {
                userDefindedArgs.AddRange(mineable.CastXmrExtraArguments.Split(" "));
            }

            string args  = "";
            string space = "";

            if (!userDefindedArgs.Contains("-S"))
            {
                args  = $"{space}-S {mineable.PoolAddress}";
                space = " ";
            }
            if (!userDefindedArgs.Contains("-u"))
            {
                args += $"{space}-u {mineable.PoolWalletAddress}";
                space = " ";
            }
            if (!userDefindedArgs.Contains("-p"))
            {
                args += $"{space}-p {mineable.PoolPassword}";
                space = " ";
            }
            if (!userDefindedArgs.Any(a => a.Contains("--algo=")))
            {
                switch (mineable.Algorithm)
                {
                case Algorithm.CryptonightV7:
                    args += $"{space}--algo=1";
                    break;

                case Algorithm.CryptonightHeavy:
                    args += $"{space}--algo=2";
                    break;

                case Algorithm.CryptonightLite:
                    args += $"{space}--algo=4";
                    break;

                case Algorithm.CryptonightBittube:
                    args += $"{space}--algo=5";
                    break;

                case Algorithm.CryptonightStellite:
                    args += $"{space}--algo=6";
                    break;

                case Algorithm.CryptonightHaven:
                    args += $"{space}--algo=7";
                    break;

                case Algorithm.CryptonightMasari:
                    args += $"{space}--algo=8";
                    break;

                default:
                    throw new NotImplementedException("Couldn't start CastXmr, unknown algo: {mineable.Algorithm}\n" +
                                                      "You can set --algo yourself in the extra arguments.");
                }
                space = " ";
            }
            if (!userDefindedArgs.Contains("--remoteaccess"))
            {
                args += $"{space}--remoteaccess";
                space = " ";
            }
            if (!String.IsNullOrEmpty(mineable.CastXmrExtraArguments))
            {
                args += space + mineable.CastXmrExtraArguments;
            }
            _process.StartInfo.Arguments              = $"/c \"{Path.GetFileName(minerPath)} {args}\"";
            _process.StartInfo.UseShellExecute        = true;
            _process.StartInfo.CreateNoWindow         = false;
            _process.StartInfo.RedirectStandardOutput = false;
            _process.StartInfo.WorkingDirectory       = minerFolderPath;
            _process.StartInfo.WindowStyle            = settings.StartMinerMinimized ? ProcessWindowStyle.Minimized : ProcessWindowStyle.Normal;

            Thread.Sleep(TimeSpan.FromSeconds(settings.MinerStartDelay));
            _process.Start();

            if (mineable.CastXmrUseXmrStakCPUMining)
            {
                _cpuMiner = new XmrStakMiner(true);
                _cpuMiner.StartMiner(mineable, settings, appRoot, appRootFolder);
            }
        }
Beispiel #39
0
 /// <summary>
 /// Creates a <see cref="HttpWebRequest"/> for long-polling.
 /// </summary>
 /// <param name="miner"></param>
 /// <param name="comment"></param>
 /// <returns></returns>
 HttpWebRequest OpenLp(IMiner miner, string comment)
 {
     return Open(longPollUrl, "GET", miner, comment);
 }
Beispiel #40
0
 public SocketsRpcContext(IMiner miner, SocketsRpcRequest request)
 {
     this.Miner = miner;
     this.Request = request;
 }
Beispiel #41
0
        /// <summary>
        /// Invokes the 'getwork' JSON method and parses the result into a new <see cref="T:Work"/> instance.
        /// </summary>
        /// <returns></returns>
        public Work GetWorkRpc(IMiner miner, string comment)
        {
            var req = OpenRpc(miner, comment);
            if (req == null)
                return null;

            // submit method invocation
            using (var txt = new StreamWriter(req.GetRequestStream()))
            using (var wrt = new JsonTextWriter(txt))
            {
                wrt.WriteStartObject();
                wrt.WriteMember("id");
                wrt.WriteString("json");
                wrt.WriteMember("method");
                wrt.WriteString("getwork");
                wrt.WriteMember("params");
                wrt.WriteStartArray();
                wrt.WriteEndArray();
                wrt.WriteEndObject();
                wrt.Flush();
            }

            return ParseGetWork(req.GetResponse());
        }
        public void Init()
        {
            IMiner miner = Factory.Instance.CoreObject.SelectedMiner;

            ((MinerBase)miner).InitProfitability();
        }
Beispiel #43
0
 public Account(IMiner miner)
     : this(-1, miner.Username, miner.Username)
 {
 }
Beispiel #44
0
 public CCMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
     base(mainCoin, dualMining, dualCoin, minerName, miner)
 {
     Type         = "Nvidia";
     GPUType      = CardMake.Nvidia;
     OutputReader = new CCReader(STATS_LINK);
 }
Beispiel #45
0
 public void SelectMiner(IMiner miner)
 {
     SelectedMiner = miner;
     Factory.Instance.Model.MakeSelectedMiner(miner);
     Factory.Instance.ViewObject.UpdateMinerList();
 }
 public NBAAnalizer(IMiner<ShortMatchResult> shortMatchResultsMiner, IMiner<CityPopulation> cityMiner, IJoiner joiner)
 {
     _shortMatchResultsMiner = shortMatchResultsMiner;
     _cityMiner = cityMiner;
     _joiner = joiner;
 }
Beispiel #47
0
        public IMiner CreateMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName)
        {
            IMiner miner = CreateMiner(GenerateUniqueID(), mainCoin, dualMining, dualCoin, minerName, null);

            return(miner);
        }
Beispiel #48
0
        public MinerFromPlugin(string pluginUUID) : base(pluginUUID)
        {
            var plugin = MinerPluginsManager.GetPluginWithUuid(pluginUUID);

            _miner = plugin.CreateMiner();
        }
Beispiel #49
0
 public bool Authenticate(IMiner miner)
 {
     // empty storage layer is only used when no valid storage-layer configuration is available.
     // just authenticate all requests as basically we can't validate nor pay miners actually.
     return true;
 }
Beispiel #50
0
 public CCMiner(ICoin mainCoin, bool dualMining, ICoin dualCoin, string minerName, IMiner miner) :
     base(mainCoin, dualMining, dualCoin, minerName, miner)
 {
     Type                = "Nvidia";
     GPUType             = CardMake.Nvidia;
     OutputReader        = new CCReader(STATS_LINK, STATS_LINK_PORT);
     MiningIntensityLow  = 6;
     MiningIntensityHigh = 35;
     MiningIntensity     = 23;
     MinerExehash        = "84CFA420A3C210535FF991900B9E191F";
 }
Beispiel #51
0
 public void ReportHashes(IMiner plugin, long count)
 {
 }
Beispiel #52
0
 public SocketsRpcContext(IMiner miner, SocketsRpcRequest request)
 {
     this.Miner   = miner;
     this.Request = request;
 }
Beispiel #53
0
        private bool SendJobToMiner(IMiner miner, IJob job)
        {
            if (miner is IGetworkMiner) // only stratum miners needs to be submitted new jobs.
                return false;

            var stratumMiner = (IStratumMiner) miner;

            if (!stratumMiner.Authenticated)
                return false;

            if (!stratumMiner.Subscribed)
                return false;

            stratumMiner.SendJob(job);

            return true;
        }
Beispiel #54
0
 public Account(IMiner miner)
     :this(-1, miner.Username, miner.Username)
 { }