Consolidate Account Balance

Overview

For account-based assets, the spendable balance of a wallet is the balance of the funds in the root address. In order to enable the maximum withdrawal from a wallet with multiple receive addresses, you must consolidate the balance by sweeping assets to the root address. The confirmed balance of a wallet is the balance of the root address plus all the receive addresses.

Some blockchains require a minimum balance in a receive address. When you consolidate a wallet, the minimum balance remains in the receive addresses. This results in your spendable balance being slightly less than your confirmed balance.

Consolidating is a transaction from your receive address to your root address. You can consolidate a maximum of 750 addresses per transaction, except for Solana, which has a limit of 500 addresses. Consolidation transactions follow the normal transaction flow, requiring signatures, approvals, and sending, as outlined in Wallets Overview.

Prerequisites

Steps

  • SDK
  • API
  • Express
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 const BitGoJS = require('bitgo'); const Promise = require('bluebird'); const bitgo = new BitGoJS.BitGo({ env: 'test' }); const coin = 'talgo'; // Set your wallet id const walletId = ''; // Set your wallet passphrase const walletPassphrase = ''; // Set OTP code const otp = '000000'; // Set your access token here bitgo.authenticateWithAccessToken({ accessToken }); const wallet = await bitgo.coin(coin).wallets().get({ id: walletId }); // Wallet's base address - only address in the wallet that can send funds to other accounts console.log('Base Address:', wallet.coinSpecific().baseAddress); // Confirmed balance - sum of the balance of all the wallet's addresses console.log('Confirmed Balance:', wallet.confirmedBalanceString()); // Spendable balance - balance of the base address console.log('Spendable Balance:', wallet.spendableBalanceString()); // unlock the session for sending funds const unlock = await bitgo.unlock({ otp, duration: 3600 }); if (!unlock) { throw new Error('error unlocking session'); } const consolidationTxes = await wallet.buildAccountConsolidations(); try { for (const unsignedConsolidation of consolidationTxes) { const res = await wallet.sendAccountConsolidation({ walletPassphrase, prebuildTx: unsignedConsolidation }); console.dir(res, { depth: 6 }); } } catch (e) { console.error(e); } );

Step Result

  • Custodial
  • Self-Managed

You receive a calendar invitation by email to schedule video verification with a BitGo operator.

Next

  • Custodial
  • Self-Managed
  1. If the transaction requires admin approval, it remains in a pending approval status until receiving final approval.
  2. Open the email from BitGo and select a date and time for video verification with a BitGo operator.

After verification, BitGo signs and broadcasts the transaction to the network for confirmation.

See Also