C# parse bitcoin blockchain to get balance of an address Is there a way to scan the Bitcoin blockchain in C# without using an external API? I am looking for the amount of spendable money of a Bitcoin address.

I am using NBitcoin. 

// create new key pair based on private key
NBitcoin.Key key = new NBitcoin.Key(privateKey, privateKey.Length, false);

// parse blk*.dat
// get balance for address key.PubKey.Hash
// How to do that?
How about running a QBitNinja server locally?  

var client = new QBitNinjaClient(baseAddress:"specify host here, you probably want localhost", Network.TestNet);
var balanceModel = client.GetBalance(dest: [Add any IDestination here, like new BitcoinAddress("mivD5GHroixrzgjv6Ww73pV5R55PcL8JdM", Network.TestNet)], unspentOnly: true).Result;
if (balanceModel.Operations.Count == 0) 
    throw new Exception("No coins to spend");
var unspentCoins = new List&lt;Coin&gt;();
foreach (var operation in balanceModel.Operations)
            unspentCoins.AddRange(operation.ReceivedCoins.Select(coin =&gt; coin as Coin)); 
var balance = unspentCoins.Sum(x =&gt; x.Amount.ToDecimal(MoneyUnit.BTC));