<p>You can use the <a href="https://blockfrost.io/" rel="nofollow noreferrer">Blockfrost.io</a> API to get information about the address. I'd recommend using the <a href="https://github.com/blockfrost/blockfrost-dotnet" rel="nofollow noreferrer">blockfrost-dotnet</a> package for this.</p>

CC BY-SA 4.0
2021-10-12T05:23:53.413Z
I have tried it but i am getting content not found exception which means this Address doesnot exist on test net. Isnt it? What can be the reason?
Malik Mehmood
CC BY-SA 4.0
2021-10-12T06:31:40.443Z
I think this happens if the address has never been used.
eddex
CC BY-SA 4.0
2021-10-13T07:32:08.870Z
agreed. as address is never used. Any idea what can be done to activate the address on testnet?
Malik Mehmood
CC BY-SA 4.0
2021-10-13T12:19:06.423Z
Send some tADA to that address: https://testnets.cardano.org/en/testnets/cardano/tools/faucet/
eddex
CC BY-SA 4.0
2021-10-06T12:07:52.403Z
2021-10-15T11:47:47.530Z
2021-10-15T11:47:47.530Z
eddex
<p>I am trying to develop a simple program where I am able to generate an address successfully using a public key and a stake key. The network type is <code>TestNet</code>.</p>
<p>How can I check the balance of the generated address?</p>
<p>Code snippet is as follow:</p>
<pre><code>var existingaddresses = _Addresses.Find(x =&gt; x.WalletId == wallet.Id).ToList().Count;
            var user = _users.Find(x =&gt; x.Id == wallet.UserId).FirstOrDefault();
            NetworkType net;
            if (IsMainNet)
            {
                net = NetworkType.Mainnet;
            }
            else
            {
                net = NetworkType.Testnet;
            }
            Mnemonic mnc = keyService.Restore(wallet.Words, WordLists.English);
            PrivateKey masterKey = mnc.GetRootKey(user.Password);
            string PaymentPath = $&quot;m/1852'/1815'/0'/0/&quot;+ existingaddresses;
            PrivateKey paymentPrv = masterKey.Derive(PaymentPath);
            PublicKey paymentPub = paymentPrv.GetPublicKey(false);
            string stakePath = $&quot;m/1852'/1815'/0'/2/&quot;+existingaddresses;
            PrivateKey stakePrv = masterKey.Derive(stakePath);
            PublicKey stakePub = stakePrv.GetPublicKey(false);

            Address address = addressService.GetAddress(paymentPub, stakePub, net, AddressType.Base);
</code></pre>
<p>Now I want to check the balance of the generated address.</p>

<c#>
How to get balance of an address using Cardanosharp
# How to get balance of an address using Cardanosharp

(Asked by: username_0 on 2021-10-05)

I am trying to develop a simple program where I am able to generate an address successfully using a public key and a stake key. The network type is TestNet.
How can I check the balance of the generated address?
Code snippet is as follow:
var existingaddresses = _Addresses.Find(x => x.WalletId == wallet.Id).ToList().Count;
            var user = _users.Find(x => x.Id == wallet.UserId).FirstOrDefault();
            NetworkType net;
            if (IsMainNet)
            {
                net = NetworkType.Mainnet;
            }
            else
            {
                net = NetworkType.Testnet;
            }
            Mnemonic mnc = keyService.Restore(wallet.Words, WordLists.English);
            PrivateKey masterKey = mnc.GetRootKey(user.Password);
            string PaymentPath = $"m/1852'/1815'/0'/0/"+ existingaddresses;
            PrivateKey paymentPrv = masterKey.Derive(PaymentPath);
            PublicKey paymentPub = paymentPrv.GetPublicKey(false);
            string stakePath = $"m/1852'/1815'/0'/2/"+existingaddresses;
            PrivateKey stakePrv = masterKey.Derive(stakePath);
            PublicKey stakePub = stakePrv.GetPublicKey(false);

            Address address = addressService.GetAddress(paymentPub, stakePub, net, AddressType.Base);

Now I want to check the balance of the generated address.

**Tags:** c#

---

## 1 answers

### Answer by username_1 on 2021-10-06. Score: 1 | Accepted answer

You can use the [Blockfrost.io](https://blockfrost.io/) API to get information about the address. I'd recommend using the [blockfrost-dotnet](https://github.com/blockfrost/blockfrost-dotnet) package for this.

> **Comments:**
> **username_0**: I have tried it but i am getting content not found exception which means this Address doesnot exist on test net. Isnt it? What can be the reason?  
> **username_1**: I think this happens if the address has never been used.  
> **username_0**: agreed. as address is never used. Any idea what can be done to activate the address on testnet?  
> **username_1**: Send some tADA to that address: https://testnets.cardano.org/en/testnets/cardano/tools/faucet/  

---

