Skip to content

Instantly share code, notes, and snippets.

@donma
Created February 8, 2019 06:11
Show Gist options
  • Save donma/858dcb42b4289c7a549d0aa419064656 to your computer and use it in GitHub Desktop.
Save donma/858dcb42b4289c7a549d0aa419064656 to your computer and use it in GitHub Desktop.
Check Wallet All Receive Coin
private static void CheckWalletAllReceiveCoin(string walletAddress)
{
QBitNinja.Client.QBitNinjaClient client = new QBitNinja.Client.QBitNinjaClient(NBitcoin.Network.TestNet);
var balance = client.GetBalance(new NBitcoin.BitcoinPubKeyAddress(walletAddress), false).Result;
Console.WriteLine("");
Console.WriteLine("TransactionId : BitCoin , Index");
Console.WriteLine("-------------------------------------------");
foreach (var operation in balance.Operations)
{
Console.Write(operation.TransactionId + " : " + operation.ReceivedCoins.Select(coin => coin as NBitcoin.Coin).Sum(x => x.Amount.ToDecimal(NBitcoin.MoneyUnit.BTC)) + ",");
//To highline INDEX so chnage color .
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(string.Join(";", operation.ReceivedCoins.Select(coin => coin as NBitcoin.Coin).Select(x => x.Outpoint.N)));
Console.ForegroundColor = ConsoleColor.White;
}
}
@donma
Copy link
Author

donma commented Feb 8, 2019

CheckWalletAllReceiveCoin("mvJh993ZpnVFgX4Bs9jacjFLsKPhXj3nkj");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment