Web Interstitial Ad Example

Error send Bitcoin in testnet using Nbitcoin and QBitNinjaClient C#


I try too much to send bitcoin in testnet. I tried to find somes questions here and to old.

my question is:

QBitNinjaClient its ready work yeat ? because i saw the parametrs to getbalance end always give a error:

Newtonsoft.Json.JsonReaderException: ‘Unexpected character encountered
while parsing value: <. Path ”, line 0, position 0.’

  var fpk = new BitcoinSecret("cVDNzGDRPxQ6vkQ9VJcJpLKhuvFRQMYEaMegEw9hK5z5ZttkSut2", Network.TestNet);
            var fspk = fpk.GetAddress(ScriptPubKeyType.Legacy);
            var api = new QBitNinjaClient("http://tapi.qbit.ninja/", fpk.Network);
            var fbal = await api.GetBalance(fspk, true);
            var fcoin = new List<ICoin>();
            foreach (var o in fbal.Operations)
                if (o.Confirmations < 2) continue; // 2 confirmations

            var builder = fpk.Network.CreateTransactionBuilder();
            var tx = builder
                .AddKeys(new ISecret[] { fpk })
                .Send(new BitcoinPubKeyAddress("myUo9SDsAZKVfnYdJgbVvXcmCFVL7Adxi9", fpk.Network), Money.Coins(0.001m))

            var r = await api.Broadcast(tx);


Source link