submitWork method

Future<bool> submitWork (BigInt nonce, BigInt powHash, BigInt digest)

Submit work Used for submitting a proof-of-work solution. The nonce found The header's pow-hash The mix digest Returns true if the provided solution is valid, otherwise false.

Implementation

Future<bool> submitWork(BigInt nonce, BigInt powHash, BigInt digest) async {
  if (nonce == null) {
    throw ArgumentError.notNull("Moac::submitWork - nonce");
  }
  if (powHash == null) {
    throw ArgumentError.notNull("Moac::submitWork - powHash");
  }
  if (digest == null) {
    throw ArgumentError.notNull("Moac::submitWork - digest");
  }
  final List params = [
    MoacUtilities.bigIntegerToHex(nonce),
    MoacUtilities.bigIntegerToHex(powHash),
    MoacUtilities.bigIntegerToHex(digest)
  ];
  final String method = MoacRpcMethods.submitWork;
  final res = await rpcClient.request(method, params);
  if (res != null && res.containsKey(moacResultKey)) {
    return res[moacResultKey];
  }
  _processError(method, res);
  return null;
}