# Estimate Fees

Source: https://developers.bitgo.com/docs/withdraw-estimate-fees

## Overview

You can estimate the blockchain fee at the time you initiate a transaction. However, BitGo assesses the actual fee upon receiving the final signature that approves the transaction. Therefore, the sooner your wallet users sign the transaction, the more accurate the fee estimation is.

UTXO-based coins return a fee per kB. Account-based coins return a flat fee.

`feeByBlockTarget` is a JSON object whose property names are block-count targets (for example, `"1"` means the next block, `"6"` means within 6 blocks). These are not cryptographic keys.

> 📘 **Note**
>
> The fee estimate provided by BitGo is higher than the usual network fee. This additional fee is not charged by BitGo but is used to ensure that the transactions process faster and don't fail on the blockchain network.

## Prerequisites

* [Get Started](/docs/get-started-intro)
* [Create Wallets](/docs/wallets-create-wallets)
* Build an unsigned transaction

## Cookbook

Need just the steps? Expand the cookbook below to get started:

<Cookbook slug="estimate-fees" title="Estimate Fees" />

## Steps

```js SDK
const BitGoJS = require('../../../src/index.js');
const bitgo = new BitGoJS.BitGo({ env: 'test' });
const Promise = require('bluebird');

// Set your access token here
const accessToken = 'v2xcbe8617bd58947a9ec41cc7a92e0a9a9d81dc2780669faa59eab3016ad5792ae';
// Set your coin of choice here
const coin = process.env.ASSET_ID;

Promise.coroutine(function *() {
  bitgo.authenticateWithAccessToken({ accessToken });
  bitgo.coin(coin).feeEstimate({ numBlocks: 2 }, function callback(err, res) {
     console.dir(res);
  });
})();
```
```json API
GET /api/v2/{coin}/tx/fee

{
  "duration": 0
}
```

#### Step Result

```json
{
  "feePerKb": 1000,
  "cpfpFeePerKb": 1000,
  "numBlocks": 2,
  "feeByBlockTarget": {
    "1": 1000,
    "2": 1000,
    "3": 1000,
    "4": 1000,
    "5": 1000,
    "6": 1000,
    "10": 1000,
    "20": 1000,
    "50": 1000,
    "100": 1000,
    "144": 1000
  }
}
```

## Checking Gas Tank Balance

All tokens on the Ethereum network require a gas tank. If you have an Ethereum-based wallet, you must maintain enough ETH to cover gas fees. BitGo holds this balance in a separate address from the rest of your wallet balance.

## Steps

```json API

GET /api/v2/{coin}/enterprise/{enterpriseId}/feeAddressBalance

{
  "duration": 0
}

```

## Step Result

```json
{
  "balance": "0",
  "address": "0x3a8c19d7e04b52f9a1c6e83d71f2b0a5c94e7d8"
}
```

## Next

Sign the transaction.

## See Also

* [API Reference: Get Fee Estimate](/reference/v2txgetfeeestimate)
* [API Reference: Get Gas Tank Balance](/reference/v2enterprisefeeaddressbalance)
* [Guides: Fund Gas Tanks](/docs/get-started-gas-tanks)
