NBitcoin how one can ship a transaction?

0
17


The verification handed. However nothing occur after that. The stability in each accounts stay the identical.

Something flawed in the way in which that I construct my transaction?

var fpk = new BitcoinSecret("<my non-public key>", Community.TestNet);
var fspk = fpk.GetAddress(ScriptPubKeyType.Legacy);
var api = new QBitNinjaClient("http://tapi.qbit.ninja/", fpk.Community);
var fbal = await api.GetBalance(fspk, true);
var fcoin = new Checklist<ICoin>();
foreach (var o in fbal.Operations)
{
    if (o.Confirmations < 2) proceed; // 2 confirmations
    fcoin.AddRange(o.ReceivedCoins);
}

var builder = fpk.Community.CreateTransactionBuilder();
var tx = builder
    .AddCoins(fcoin)
    .AddKeys(fpk)
    .Ship(new BitcoinPubKeyAddress("<To deal with>", fpk.Community), Cash.Cash(0.001))
    .SubtractFees()
    .SendFees(Cash.Cash(0.00001))
    .SetChange(fpk)
    .BuildTransaction(true);

Debug.Assert(builder.Confirm(tx));



Supply hyperlink

Leave a reply