Sweep Funds

Overview

Once your client, aka the end-user, deposits into an intermediary vault account, most customers will want to perform a sweeping operation. This operation consolidates all deposited funds from the intermediary vault accounts into a single treasury management vault account for various business purposes.

Sweeping funds involves moving assets from address A to address B. It is important to note that this is an on-chain operation and includes transaction fee payments.


Trigger the Sweeping Operation

The trigger for the sweeping operation varies from customer to customer, depending on specific strategies, business needs, and regulatory requirements.

For instance, some customers may choose to sweep the funds immediately after the deposit is completed. In contrast, others may trigger the sweeping mechanism only after a certain amount of deposits (either by total balance or number of deposits). Since sweeping is an on-chain operation that incurs transaction fees, some customers opt to execute the sweeping operation only when the current network fee is below a predefined acceptable threshold. Fireblocks enables customers to monitor current network fees/gas prices using the GET /estimate_network_fee endpoint.

There is no right or wrong approach; customers should determine what works best for their business needs.

Sweep timing strategies

You can sweep deposits from deposit accounts immediately after each deposit, or batch them over time. As deposits accumulate or network fees change, you can use logic-based triggers based on time, balance, or fee conditions.

For example, to minimize fees, you may choose to sweep when the network is less congested or when gas prices fall below a defined threshold. If you want to sweep promptly, sweeping can occur immediately after a deposit or once Gas Station fueling is complete.

Gas Station

The Gas Station feature allows you to maintain a wallet fueled with relevant base tokens. When a deposit account receives tokens, this wallet can fuel (transfer) base tokens to the deposit account to cover fees and enable sweeping. You can configure this behavior, including when the transfer occurs and how much is transferred.


Automate Sweeping

To create sweeping transactions, Fireblocks customers can use the POST /transactions endpoint. First, identify the vault account from which you want to initiate the sweeping operation and then send the sweeping transaction request to the Fireblocks API. This process should be executed for every vault account from which sweeping is desired.

Automating sweeping transactions involves not only creating the transactions in a fully automated manner but also automating the entire signing process. We recommend using an API Co-Signer to automatically sweep funds according to your organization's logic and fee prices.

When sweeping funds, you also pay a fee in the base asset of the deposited token's blockchain. To ensure you always have enough funds for the sweeping transaction, we introduced the Fireblocks Gas Station feature, which automatically identifies incoming transactions to your predefined vault accounts and deposits enough of the base asset to cover fees for sweeping funds to your main treasury.

Automation rules

Fireblocks is rolling out an automation feature that allows you to define rules to trigger transactions. In the future, this will include automatic sweeping and reconciliation rules across groups of wallets. Currently, rules can only be applied to specific vault accounts as the source.

For more information, see About Automation.


Reconciliation Processes

Because memo-based wallets function as omnibus wallets, funds can be reconciled to withdrawal wallets or to cold and treasury management workspaces as needed.

UTXO-based wallets also operate as omnibus wallets, allowing multiple deposited UTXOs to be reconciled to target destinations. However, transaction size limits and MPC restrictions apply:

  • For Bitcoin-based wallets, a single transaction is limited to 250 UTXOs.
  • For Cardano transactions, the overall size is capped at 16 KB.

To determine the maximum spendable amount before initiating a sweep, call the Get max spendable amount in a transaction endpoint.

UTXO-based chains support multiple destinations, allowing funds to be moved to different targets (for example, cold storage and withdrawal wallets) within a single transaction. For account-based chains, sweeping is done per deposit wallet.


Fees

Because sweeping is normally less time-sensitive, transaction fees can be set lower than the prevailing network fees required for immediate confirmation.


Sweeping Tokens

When sweeping tokens, the wallet should have enough native asset balance to cover the transaction fees. However, some chains support models where another account can pay the fee:

  • EVM chains: Gasless transactions (currently in development and supported for a limited set of tokens)
  • Universal: Gasless transactions once EIP-7702 support is obtained
  • Solana: Fee payer model