Permalink
Browse files

Add HamsterPool support.

  • Loading branch information...
1 parent a267afc commit 4c8d5957d15a3d6d5de8743cd0de8b8ec5cabf80 @StuffOfInterest StuffOfInterest committed Dec 9, 2014
@@ -177,7 +177,7 @@ private void InitializeComponent()
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(102, 13);
this.label13.TabIndex = 10;
- this.label13.Text = "Miner Control v1.5.5";
+ this.label13.Text = "Miner Control v1.5.6";
//
// notifyIcon
//
@@ -28,6 +28,7 @@
{ "name": "scrypt", "hashrate": 540, "power": 60, "aparam1": "c:\\windows\\system32", "aparam2": "cmd.exe", "aparam3": "/c test-run.bat -a scrypt -batch" },
{ "name": "scryptn", "hashrate": 253, "power": 60, "aparam1": "c:\\windows\\system32", "aparam2": "cmd.exe", "aparam3": "/c test-run.bat -a scryptn -batch" },
{ "name": "keccak", "hashrate": 34000, "power": 50, "aparam1": "", "aparam2": "TestMiner.exe", "aparam3": "-a keccak" },
+ { "name": "qubit", "hashrate": 7500, "power": 50, "aparam1": "", "aparam2": "TestMiner.exe", "aparam3": "-a qubit" },
{ "name": "sha256", "hashrate": 10000, "power": 50, "aparam1": "c:\\windows\\system32", "aparam2": "cmd.exe", "aparam3": "/c test-run.bat -a sha256 -batch" }
],
"nicehash": {
@@ -128,6 +129,23 @@
{ "algo": "nist5", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_ -u _ACCOUNT___WORKER_ _SPARAM2_" }
]
},
+ "hamsterpool": {
+ "apikey": "mykey",
+ "donation": 1.0,
+ "account": "MinerControl",
+ "worker": "1",
+ "sparam1": "-o stratum+tcp://eu.hamsterpool.com",
+ "sparam2": "-p x",
+ "algos": [
+ { "algo": "scrypt", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_:7771 -u _ACCOUNT_._WORKER_ _SPARAM2_" },
+ { "algo": "scryptn", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_:7772 _ACCOUNT_._WORKER_ _SPARAM2_" },
+ { "algo": "sha256", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_:7774 _ACCOUNT_._WORKER_ _SPARAM2_" },
+ { "algo": "x11", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_:3508 _ACCOUNT_._WORKER_ _SPARAM2_" },
+ { "algo": "qubit", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_:7776 _ACCOUNT_._WORKER_ _SPARAM2_" },
+ { "algo": "x13", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_:7773 _ACCOUNT_._WORKER_ _SPARAM2_" },
+ { "algo": "neoscrypt", "folder": "_APARAM1_", "command": "_APARAM2_", "arguments": "_APARAM3_ _SPARAM1_:3650 _ACCOUNT_._WORKER_ _SPARAM2_" }
+ ]
+ },
"manual": {
"account": "myaccount",
"algos": [
@@ -51,8 +51,10 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AlgorithmEntry.cs" />
+ <Compile Include="PriceEntries\HamsterPoolPriceEntry.cs" />
<Compile Include="PriceEntries\LtcRabbitPriceEntry.cs" />
<Compile Include="PriceEntries\WePayBtcPriceEntry.cs" />
+ <Compile Include="Services\HamsterPoolService.cs" />
<Compile Include="Services\LtcRabbitService.cs" />
<Compile Include="Services\WePayBtcService.cs" />
<Compile Include="Utility\ErrorLogger.cs" />
@@ -239,6 +239,7 @@ public bool LoadConfig()
LoadService(new WafflePoolService(), data, "wafflepool");
LoadService(new LtcRabbitService(), data, "ltcrabbit");
LoadService(new WePayBtcService(), data, "wepaybtc");
+ LoadService(new HamsterPoolService(), data, "hamsterpool");
LoadService(new ManualService(), data, "manual");
// Set Id for each entry
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MinerControl.PriceEntries
+{
+ public class HamsterPoolPriceEntry : PriceEntryBase
+ {
+ public override decimal Fees
+ {
+ get { return Earn * (0.015m + Donation); }
+ set { base.Fees = value; }
+ }
+
+ public decimal Donation { get; set; }
+ }
+}
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.5.5.0")]
-[assembly: AssemblyFileVersion("1.5.5.0")]
+[assembly: AssemblyVersion("1.5.6.0")]
+[assembly: AssemblyFileVersion("1.5.6.0")]
@@ -14,6 +14,7 @@ public enum ServiceEnum
WafflePool,
LTCRabbit,
WePayBTC,
+ HamsterPool,
Manual
}
}
@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MinerControl.PriceEntries;
+using MinerControl.Utility;
+
+namespace MinerControl.Services
+{
+ public class HamsterPoolService : ServiceBase<HamsterPoolPriceEntry>
+ {
+ // https://hamsterpool.com/index.php?page=api&action=algorithm_btc_per_mh
+ // {"scrypt":"0.00015374509140941","nscrypt":"0.0012163696966358","sha256":"1.2994452372168E-8","x11":"0.00012615553588975","qubit":"0.00034249512834947","x13":"0.00019299647643157","neoscrypt":"0.0080657456143128"}
+
+ // https://hamsterpool.com/index.php?page=api&action=user_algorithm_balance_btc&api_key=[apikey]
+ // {"scrypt":0,"nscrypt":0,"x11":8.074500888863218e-8,"x13":0,"sha256":0,"qubit":0,"neoscrypt":0}
+
+ private string _apikey;
+ private decimal _donation;
+
+ public HamsterPoolService()
+ {
+ ServiceEnum = ServiceEnum.HamsterPool;
+ //DonationAccount = "MinerControl"; //Too hard to configure donation for this one.
+ //DonationWorker = "1";
+
+ AlgoTranslations = new Dictionary<string, string>
+ {
+ {"nscrypt", "scryptn"}
+ };
+ }
+
+ public override void Initialize(IDictionary<string, object> data)
+ {
+ ExtractCommon(data);
+ _apikey = data.GetString("apikey");
+ _donation = data["donation"].ExtractDecimal() / 100;
+
+ var items = data["algos"] as object[];
+ foreach (var rawitem in items)
+ {
+ var item = rawitem as Dictionary<string, object>;
+ var entry = GetEntry(item);
+ entry.Donation = _donation;
+
+ Add(entry);
+ }
+ }
+
+ public override void CheckPrices()
+ {
+ ClearStalePrices();
+ WebUtil.DownloadJson(string.Format("https://hamsterpool.com/index.php?page=api&action=algorithm_btc_per_mh", _apikey), ProcessPrices);
+ WebUtil.DownloadJson(string.Format("https://hamsterpool.com/index.php?page=api&action=user_algorithm_balance_btc&api_key={0}", _apikey), ProcessBalances);
+ }
+
+ private void ProcessPrices(object jsonData)
+ {
+ var data = jsonData as Dictionary<string, object>;
+ lock (MiningEngine)
+ {
+ foreach (var key in data.Keys)
+ {
+ var algo = key.ToLower();
+ var price = data[key].ExtractDecimal();
+
+ var entry = PriceEntries.FirstOrDefault(o => o.AlgoName == GetAlgoName(algo));
+ if (entry == null) continue;
+
+ entry.Price = price * 1000;
+ }
+
+ MiningEngine.PricesUpdated = true;
+ MiningEngine.HasPrices = true;
+
+ LastUpdated = DateTime.Now;
+ }
+ }
+
+ private void ProcessBalances(object jsonData)
+ {
+ var data = jsonData as Dictionary<string, object>;
+ lock (MiningEngine)
+ {
+ foreach (var key in data.Keys)
+ {
+ var algo = key.ToLower();
+ var balance = data[key].ExtractDecimal();
+
+ var entry = PriceEntries.FirstOrDefault(o => o.AlgoName == GetAlgoName(algo));
+ if (entry == null) continue;
+
+ entry.Balance = balance;
+ }
+
+ MiningEngine.PricesUpdated = true;
+ MiningEngine.HasPrices = true;
+
+ LastUpdated = DateTime.Now;
+ }
+ }
+ }
+}

0 comments on commit 4c8d595

Please sign in to comment.