private void PrintUTXO(QBitNinjaClient client, WalletClient wallet) { // list of all unspend transaction List <BalanceOperation> unspend_operations = new List <BalanceOperation>(); // for each bitcoin address of the wallet we take the list of unspend transactions foreach (WalletAddress address in wallet.GetAddresses().Result) { BitcoinAddress me = BitcoinAddress.Create(address.Address.ToString()); unspend_operations.AddRange(client.GetBalance(me, true).Result.Operations); } // print transactions id and amount Console.WriteLine("=============================="); Console.WriteLine("Unspend transactions from wallet"); Console.WriteLine("------------------------------"); foreach (BalanceOperation balance in unspend_operations) { Decimal amout = balance.Amount.ToDecimal(MoneyUnit.BTC); Console.Write("Transaction ID : "); Console.WriteLine(balance.TransactionId); Console.Write("Amount : "); Console.WriteLine(amout); } Console.WriteLine("=============================="); }
private List <string> GetOutOfSyncAddresses() { var qbitAddresses = _qBitNinjaWalletClient.GetAddresses().Result.Select(x => x.Address.ToWif()).ToList(); var safeAddresses = new HashSet <string>(); for (var i = 0; i < AddressCount; i++) { safeAddresses.Add(Safe.GetAddress(i)); } if (qbitAddresses.Any(qbitAddress => !safeAddresses.Contains(qbitAddress))) { throw new Exception("QBitNinja wallet and HTTPSafeMonitor is out of sync."); } return(safeAddresses.Where(safeAddress => !qbitAddresses.Contains(safeAddress)).ToList()); }
private async Task <List <string> > GetOutOfSyncAddressesAsync() { var qbitResult = await _qBitNinjaWalletClient.GetAddresses(); var qbitAddresses = qbitResult.Select(x => x.Address.ToString()).ToList(); var safeAddresses = new HashSet <string>(); for (var i = 0; i < AddressCount; i++) { safeAddresses.Add(KeyRing.GetAddress(i)); } if (qbitAddresses.Any(qbitAddress => !safeAddresses.Contains(qbitAddress))) { throw new Exception("QBitNinja wallet and HTTPKeyRingMonitor is out of sync."); } return(safeAddresses.Where(safeAddress => !qbitAddresses.Contains(safeAddress)).ToList()); }
public void GetAddressesTest() { var result = client.GetAddresses().Result; Debug.WriteLine($"First address: {result[0]}"); }