Beispiel #1
0
        /// <summary>
        /// Creates new batch.
        /// </summary>
        /// <returns>The batch.</returns>
        /// <param name="transactions">Transactions.</param>
        public Batch CreateBatch(IEnumerable <Transaction> transactions)
        {
            var batchHeader = new BatchHeader();

            batchHeader.TransactionIds.AddRange(transactions.Select(x => x.HeaderSignature));
            batchHeader.SignerPublicKey = signer.GetPublicKey().ToHexString();

            var batch = new Batch();

            batch.Transactions.AddRange(transactions.Select(x => x.Clone()));
            batch.Header          = batchHeader.ToByteString();
            batch.HeaderSignature = signer.Sign(batchHeader.ToByteArray().ToSha256()).ToHexString();

            return(batch);
        }