public static bool SubmitWork(Uri uri, string nonce, string headerhash, string mixhash, out bool result) { RPCrequest submitwork = new RPCrequest("eth_submitWork"); submitwork.parameters = new string[3]; ((string[])submitwork.parameters)[0] = "0x" + nonce; ((string[])submitwork.parameters)[1] = "0x" + headerhash; ((string[])submitwork.parameters)[2] = "0x" + mixhash; result = false; try { string resp = GetResponse(uri, submitwork); if (resp == null) { return(false); } RPCresponse <bool> response = JsonConvert.DeserializeObject <RPCresponse <bool> >(resp); result = response.result; return(true); } catch (Exception ex) { Logging.Log(2, "SubmitWork error: " + ex.Message); return(false); } }
public static string[] GetWork(Uri uri) { RPCrequest getwork = new RPCrequest("eth_getWork"); getwork.parameters = new object[0]; try { string resp = GetResponse(uri, getwork); if (resp == null) { return(null); } RPCresponse <string[]> response = JsonConvert.DeserializeObject <RPCresponse <string[]> >(resp); if (response.result != null && response.result.Length == 3) { response.result[0] = FixString(response.result[0]); response.result[1] = FixString(response.result[1]); response.result[2] = FixString(response.result[2]); } return(response.result); } catch (Exception ex) { Logging.Log(2, "GetWork error: " + ex.Message); return(null); } }