1
使用C#.NET查询本地比特币区块链
我正在尝试仅使用本地存储的区块链(通过Bitcoin Core下载)来检查给定比特币地址的余额。与此类似(通过使用NBitCoin和/或QBitNinja),但是不需要访问网络: private static readonly QBitNinjaClient client = new QBitNinjaClient(Network.Main); public decimal CheckBalance(BitcoinPubKeyAddress address) { var balanceModel = client.GetBalance(address, true).Result; decimal balance = 0; if (balanceModel.Operations.Count > 0) { var unspentCoins = new List<Coin>(); foreach (var operation in balanceModel.Operations) unspentCoins.AddRange(operation.ReceivedCoins.Select(coin => coin as Coin)); balance = unspentCoins.Sum(x => x.Amount.ToDecimal(MoneyUnit.BTC)); } …
175
c#
.net
bitcoin
blockchain