> For the complete documentation index, see [llms.txt](https://koii-network.gitbook.io/getting-started/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://koii-network.gitbook.io/getting-started/koii-software-toolkit-sdk/basic-utility-functions/koii-state/getkoibalance.md).

# getKoiBalance

{% hint style="danger" %}
This function is based on K1. Know more about K2 and generate a K2 Koii wallet [here](/getting-started/settlement-layer/k2-tick-tock-fast-blocks.md)
{% endhint %}

This function returns the KOII balance of a given address.

{% hint style="info" %}
This wallet's private key needs to be loaded to retrieve the balance. This function does not take the address as a parameter and return the balance.
{% endhint %}

### Example Code

{% hint style="warning" %}
In the below code example, replace `<walletKeyLocation>` on line 4 with the local path to your wallet key file.
{% endhint %}

```javascript
const knode = require("@_koi/sdk/node");
const ktools = new knode.Node();
async function testGetKoiiBalance() {
    const jwk = await ktools.loadFile(<walletKeyLocation>);
    await ktools.loadWallet(jwk);
    const koiibalance = await ktools.getKoiBalance();
    console.log("KOII balance of given address is ", koiibalance);
}

testGetKoiiBalance();
```

### Example Code Output

```
Initialized Koii Tools for true ownership and direct communication using version QA7AIFVx1KBBmzC7WUNhJbDsHlSJArUT0jWrhZMZPS8
KOII balance of the given address is  7459.149283222933
```

### Returns

**Promise \<Number>** - Koii balance of a given address as a number.
