Esempio n. 1
0
        public Block GenerateNextBlock(string blockData)
        {
            var previousBlock = GetLatestBlock();
            var nextIndex     = previousBlock.Index + 1;
            var nextTimestamp = DateTime.Now;
            var nextHash      = BlockHash.Calculate(nextIndex, previousBlock.Hash, nextTimestamp, blockData);

            return(new Block(nextIndex, previousBlock.Hash, nextTimestamp, blockData, nextHash));
        }
Esempio n. 2
0
 public string CalculateHash()
 {
     return(BlockHash.Calculate(Index, PreviousHash, TimeStamp, Data));
 }