Exemplo n.º 1
0
 public static string CalculateHash(Bloock block)
 {
     if (block != null)
     {
         return(sha256(block.str()));
     }
     return(null);
 }
Exemplo n.º 2
0
 public Bloock(int index, long timestamp, string previoushash, string data)
 {
     this.index        = index;
     this.timestamp    = timestamp;
     this.previoushash = previoushash;
     this.data         = data;
     this.nonce        = 0;
     hash = Bloock.CalculateHash(this);
 }
Exemplo n.º 3
0
        public void mineBlock(int diffifulty)
        {
            nonce = 0;
            int num = 0;

            while (!hash.Substring(0, diffifulty).Equals(num.ToString().PadLeft(diffifulty, '0')))
            {
                nonce++;
                hash = Bloock.CalculateHash(this);
            }
        }