Example #1
0
        /// <summary>
        /// Signs the given transaction with the given private key.
        /// The result signature will be assigned to all inputs of the transaction.
        /// </summary>
        private static void signTransation(Transaction tx, EllipticCurve.PrivateKey privateKey)
        {
            var sig    = EllipticCurve.Ecdsa.sign(tx.Id, privateKey);
            var sigStr = AddressUtils.TxInSignatureFromSignatureAndPublicKey(sig, privateKey.publicKey());

            for (int i = 0, c = tx.Inputs.Count; i < c; ++i)
            {
                tx.Inputs[i].Signature = sigStr;
            }
        }