override public void Submit(Device aDevice, EthashStratum.Job job, UInt64 output) { if (Stopped) { return; } mMutex.WaitOne(); RegisterDeviceWithShare(aDevice); try { String stringNonce = ((PoolExtranonce.Length == 0) ? (String.Format("{7:x2}{6:x2}{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff), ((output >> 48) & 0xff), ((output >> 56) & 0xff))) : (PoolExtranonce.Length == 2) ? (String.Format("{6:x2}{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff), ((output >> 48) & 0xff))) : (PoolExtranonce.Length == 4) ? (String.Format("{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff))) : (String.Format("{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff)))); String message = JsonConvert.SerializeObject(new Dictionary <string, Object> { { "id", mJsonRPCMessageID++ }, { "method", "mining.submit" }, { "params", new List <string> { Username, job.ID, stringNonce } } }); WriteLine(message); MainForm.Logger("Device #" + aDevice.DeviceIndex + " submitted a share."); } catch (Exception ex) { MainForm.Logger("Failed to submit share: " + ex.Message); } mMutex.ReleaseMutex(); }
override public void Submit(OpenCLDevice aDevice, EthashStratum.Job job, UInt64 output) { if (Stopped) { return; } try { mMutex.WaitOne(5000); } catch (Exception) { } RegisterDeviceWithShare(aDevice); try { String stringNonce = String.Format("{7:x2}{6:x2}{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff), ((output >> 48) & 0xff), ((output >> 56) & 0xff)); mShareIDs.Add(mJsonRPCMessageID.ToString()); String message = JsonConvert.SerializeObject(new Dictionary <string, Object> { { "id", mJsonRPCMessageID++ }, { "jsonrpc", "2.0" }, { "method", "eth_submitWork" }, { "params", new List <string> { "0x" + stringNonce, "0x" + job.Headerhash, // The header's pow-hash (256 bits) "0x" + job.GetMixHash(output) // mix digest } } }); WriteLine(message); MainForm.Logger("Device #" + aDevice.DeviceIndex + " submitted a share."); } catch (Exception ex) { MainForm.Logger("Failed to submit share: " + ex.Message + ex.StackTrace); try { mMutex.ReleaseMutex(); } catch (Exception) { } Reconnect(); } try { mMutex.ReleaseMutex(); } catch (Exception) { } }
public override void Submit(EthashStratum.Job job, UInt64 output) { if (Stopped) { return; } mMutex.WaitOne(); try { String stringNonce = String.Format("{7:x2}{6:x2}{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff), ((output >> 48) & 0xff), ((output >> 56) & 0xff)); String message = JsonConvert.SerializeObject(new Dictionary <string, Object> { { "id", mJsonRPCMessageID++ }, { "jsonrpc", "2.0" }, { "method", "eth_submitWork" }, { "params", new List <string> { "0x" + stringNonce, "0x" + job.Headerhash, // The header's pow-hash (256 bits) "0x" + job.GetMixHash(output) // mix digest } } }); mStreamWriter.Write(message + "\n"); mStreamWriter.Flush(); } catch (Exception ex) { MainForm.Logger("Failed to submit share: " + ex.Message + ex.StackTrace); } mMutex.ReleaseMutex(); }
public override void Submit(EthashStratum.Job job, UInt64 output) { if (Stopped) { return; } mMutex.WaitOne(); try { String stringNonce = ((PoolExtranonce.Length == 0) ? (String.Format("{7:x2}{6:x2}{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff), ((output >> 48) & 0xff), ((output >> 56) & 0xff))) : (PoolExtranonce.Length == 2) ? (String.Format("{6:x2}{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff), ((output >> 48) & 0xff))) : (PoolExtranonce.Length == 4) ? (String.Format("{5:x2}{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff))) : (String.Format("{4:x2}{3:x2}{2:x2}{1:x2}{0:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff)))); // = ((Extranonce.Length == 2) ? (String.Format("{0:x2}{1:x2}{2:x2}{3:x2}{4:x2}{5:x2}{6:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff), ((output >> 48) & 0xff))) : // (Extranonce.Length == 4) ? (String.Format("{0:x2}{1:x2}{2:x2}{3:x2}{4:x2}{5:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff), ((output >> 40) & 0xff))) : // (String.Format("{0:x2}{1:x2}{2:x2}{3:x2}{4:x2}", ((output >> 0) & 0xff), ((output >> 8) & 0xff), ((output >> 16) & 0xff), ((output >> 24) & 0xff), ((output >> 32) & 0xff)))); String message = JsonConvert.SerializeObject(new Dictionary <string, Object> { { "id", mJsonRPCMessageID++ }, { "method", "mining.submit" }, { "params", new List <string> { Username, job.ID, stringNonce } } }); mStreamWriter.Write(message + "\n"); mStreamWriter.Flush(); //MainForm.Logger("message: " + message); } catch (Exception ex) { MainForm.Logger("Failed to submit share: " + ex.Message); } mMutex.ReleaseMutex(); }