Esempio n. 1
0
 public Block(int index, string previousHash, string data)
 {
     Index        = index;
     TimeStamp    = DateTime.Now.ToString("g");
     PreviousHash = previousHash;
     Data         = data;
     Nonce        = 0;
     Hash         = BlockHasher.calculateHash(this);
 }
Esempio n. 2
0
        public static void MineBlock(int difficulty, Block block)
        {
            block.Nonce = 0;

            while (!block.Hash.Substring(0, difficulty).Equals(Zeros(difficulty)))
            {
                block.Nonce++;
                block.Hash = BlockHasher.calculateHash(block);
            }
        }