Estimate Fees

Overview

You can estimate the blockchain fee at the time you initiate a transaction. However, the actual fee is reassessed when BitGo receives 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.

Prerequisites

Steps

  • SDK
  • API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 = 'tbtc'; Promise.coroutine(function *() { bitgo.authenticateWithAccessToken({ accessToken }); bitgo.coin(coin).feeEstimate({ numBlocks: 2 }, function callback(err, res) { console.dir(res); }); })();

Step Result

1 2 3 4 5 6 7 8 9 10 11 12 { "feePerKb": 15902, "cpfpFeePerKb": 0, "numBlocks": 2, "confidence": 80, "multiplier": 0, "feeByBlockTarget": { "1": 50536, "2": 15902, "3": 1579 } }

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. This is stored in a separate address from the rest of your wallet balance.

Steps

  • API
1 2 3 4 5 6 GET /api/v2/{coin}/enterprise/{enterpriseId}/feeAddressBalance { "duration": 0 }

Step Result

1 2 3 { "balance": "string" }

Next

Sign Transactions

See Also

API Reference: Get Fee Estimate

API Reference: Get Gas Tank Balance

Guides: Gas Tank