using QBitNinja.Client.Models;
protected static QBitNinjaClient QbitClient { get; private set; }
public static void Main()
BitcoinSecret secret = new BitcoinSecret("KyJTjvFpPF6DDX4fnT56d2eATPfxjdUPXFFUb85psnCdh34iyXRQ");
BitcoinSecret receiverAddress = new BitcoinSecret("cVm1fKZSSJvyQZai2vumiquzRWERPjTSGPe4XKq2hDUbSVeNvga4");
Transaction aliceFunding = new Transaction()
new TxOut("0.45", secret.GetAddress()),
new TxOut("0.8", secret.PubKey)
Coin[] userCoins = aliceFunding
.Select((o, i) => new Coin(new OutPoint(aliceFunding.GetHash(), i), o))
long amountToSpend = 190L;
TransactionPolicyError[] errors;
var txBuilder = new TransactionnbitcoiBuilder();
var transactionToSpend = txBuilder
.AddKeys(secret.PrivateKey)
.Send(receiverAddress, Money.FromUnit(amountToSpend, MoneyUnit.Satoshi))
.SendFees(Money.FromUnit(minerFees, MoneyUnit.Satoshi))
.SetChange(secret.GetAddress())
Console.WriteLine(txBuilder.Verify(transactionToSpend, out errors));
Console.WriteLine(transactionToSpend.ToHex());
if (txBuilder.Verify(transactionToSpend, out errors))