Example #1
0
        private void calculatePow_v3(byte[] hash_ceil)
        {
            // PoW = Argon2id( BlockChecksum + SolverAddress, Nonce)
            byte[] nonce_bytes = randomNonce(64);
            byte[] fullnonce   = expandNonce(nonce_bytes, 234236);

            byte[] hash = Argon2id.getHash(activeBlockChallenge, fullnonce, 2, 2048, 2);

            if (hash.Length < 1)
            {
                Console.WriteLine("Stopping miner due to invalid hash.");
                stop();
                return;
            }

            hashesPerSecond++;

            // We have a valid hash, update the corresponding block
            if (Miner.validateHashInternal_v2(hash, hash_ceil) == true)
            {
                Console.WriteLine("SHARE FOUND FOR BLOCK {0}", currentBlockNum);

                // Broadcast the nonce to the network
                sendSolution(nonce_bytes);
                hasBlock = false;
                foundShares++;
            }
        }