public HashValue Sign(IUser user, HashValue previousHash, UserMessage message)
        {
            using (var stream = _streamFactory.Create())
            {
                stream.Write("Client {0} after {1} ask for ", user, previousHash);
                _messageStreamWriter.Write(stream, message);

                var hash = _hashProvider.GetHashOfStream(stream);
                return(hash);
            }
        }
Exemple #2
0
 public HashValue Sign(long index, INode node, string rnd, HashValue previousHash, IReadOnlyList <Transaction> transactions)
 {
     using (var stream = _streamFactory.Create())
     {
         stream.Write("Block {0} signed by {1} after {2}, Based on {3} and contains next transactions: ", index, node, previousHash, rnd);
         var first = true;
         foreach (var transaction in transactions)
         {
             if (first)
             {
                 first = false;
             }
             else
             {
                 stream.Write(", ");
             }
             stream.Write(transaction.Signature.ToString());
         }
         stream.Write(".");
         var hash = _hashProvider.GetHashOfStream(stream);
         return(hash);
     }
 }