I can't get Transaction Result with QBitNinjaClient

951 Views Asked by At

I'm a beginner of C# and blockchain.

I'm studying blockchain with "Programming The Blockchain in C#". I tried to run this source code following the book:

using NBitcoin;
using QBitNinja.Client;
using QBitNinja.Client.Models;

namespace NBitcoinTest1
{
    class Program
    {
        static void Main(string[] args)
        {
        // Create a client
        QBitNinjaClient client = new QBitNinjaClient(Network.Main);
        // Parse transaction id to NBitcoin.uint256 so the client can eat it
        var transactionId = uint256.Parse("f13dc48fb035bbf0a6e989a26b3ecb57b84f85e0836e777d6edf60d87a4a2d94");
        // Query the transaction
        GetTransactionResponse transactionResponse = client.GetTransaction(transactionId).Result;
        }
    }
}

But it doesn't work because of exception. It says "Method 'System.Net.Logging.get_On' not found.", so I tried to find "System.Net.Logging", but I couldn't find any package named "System.Net.Logging" in nuget.org.

How can I solve this problem?

Environment: macOS Sierra 10.12.6, Visual Studio for Mac[Community] 7.2(Build 636)

1

There are 1 best solutions below

0
On

Your problem relies in the conflicting types of NBitcoin dependencies, as you installed NBitcoin first then installed QBitNinja which is installed with NBitcoin also and to my surprise a more up to date version! So delete the first dependency version which was v3. Everything should work then, don't worry i've only started to read it yesterday myself :) It is a community built book so i can expect some errors.