private void FindPoolZAddress() { try { var o = JObject.Parse(_daemonClient.MakeRawRequest("z_listaddresses")); _poolZAddress = o["result"][0].ToString(); } catch (RpcException e) { _logger.Error("Error getting z address for pool central wallet: {0:l} - {1:l}", _poolConfig.Wallet.Adress, e.Message); } }
private bool DeterminePrecision() { var json = string.Empty; try { json = _daemonClient.MakeRawRequest("getbalance", DaemonClient.EmptyString); // we want a raw request var satoshis = json.Split(new[] { "result\":" }, StringSplitOptions.None)[1].Split(',')[0].Split('.')[1]; _precision = satoshis.Length; _magnitude = 1; for (int i = 1; i <= _precision; i++) { _magnitude *= 10; } return(true); } catch (RpcException e) { _logger.Error("Halted as getbalance call failed: {0}.", e.Message); return(false); } catch (Exception) { _logger.Error("Halted as we can not determine satoshis in a coin - failed parsing: {0}", json); return(false); } }
private void DetectProofOfStakeCoin() { // use getdifficulty() to determine if it's POS coin. try { /* By default proof-of-work coins return a floating point as difficulty (https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_lis). * Though proof-of-stake coins returns a json-object; * { "proof-of-work" : 41867.16992903, "proof-of-stake" : 0.00390625, "search-interval" : 0 } * So basically we can use this info to determine if assigned coin is a proof-of-stake one. */ var response = _daemonClient.MakeRawRequest("getdifficulty"); if (response.Contains("proof-of-stake")) // if response contains proof-of-stake field { _poolConfig.Coin.Options.IsProofOfStakeHybrid = true; // then automatically set coin-config.IsPOS to true. } } catch (RpcException e) { _logger.Error("Can not read getdifficulty(): {0:l}", e.Message); } }