예제 #1
0
        public Transaction BuildTransaction(IDestination receiverAddress, Money amount = null)
        {
            var transaction = new Transaction();

            transaction.AddOutput(new TxOut(amount ?? TestingValues.GetMoney(), receiverAddress));
            return(transaction);
        }
예제 #2
0
        protected Transaction GetTransactionWithInputs(
            Network network,
            Key[] senderSecrets,
            Script senderScript,
            Script receiverScript,
            byte[] opReturnBytes = null,
            Money amount         = null,
            bool withChange      = true)
        {
            var txBuilder = new TransactionBuilder(network);

            amount = amount ?? TestingValues.GetMoney();
            Money change        = withChange ? TestingValues.GetMoney() : Money.Zero;
            var   multisigCoins = new ICoin[] { RandomCoin(amount + change, senderScript, true) };

            txBuilder
            .AddCoins(multisigCoins)
            .Send(receiverScript, amount)
            .SetChange(senderScript)
            .BuildTransaction(false);

            txBuilder.AddKeys(senderSecrets);

            Transaction signed = txBuilder.BuildTransaction(true);

            if (opReturnBytes != null)
            {
                signed.AddOpReturn(opReturnBytes);
            }

            return(signed);
        }
예제 #3
0
 private OutPoint RandomOutpoint()
 {
     return(new OutPoint(TestingValues.GetUint256(), 0));
 }