Tag: 区块链

使用C#.NET查询本地比特币区块链

我试图通过仅使用本地存储的区块链(通过比特币核心下载)来检查给定比特币地址的“余额”。 类似的东西(通过使用NBitCoin和/或QBitNinja),但不需要访问networking: 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)); } return balance; } 上面的例子需要访问networking。 我需要离线做同样的事情。 […]