# Using the Sweep Function

**The Sweep Function is used to “sweep” all BTC, XCP assets, and Token Ownerships from one address to a new one.**&#x20;

<mark style="color:red;">**This action is entirely irreversible, make sure you verify everything a few times over before initiating this function.**</mark><br>

This feature was originally implemented with [this CIP](https://github.com/CounterpartyXCP/cips/blob/cip21/cip-0020.md) by John Villar who stated:&#x20;

`"there's one specific case where a whole address needs to move all its assets and ownerships to another address, be it due to migration of technology, wallet compromise or [Over The Counter] selling of its contents."`

In the past the XCP fee for a sweep was a flat rate fee of 0.5, but <mark style="color:yellow;">in recent upgrades the XCP fee is more dynamic</mark> to how many Assets and Token Ownerships you are sweeping.

* The process will require BTC for the transaction fee as well as some XCP to complete this function.
* You will need access to the address you are sweeping from to do this function.&#x20;
* <mark style="color:yellow;">You will also need access to the address you are sweeping to in the event this is simply moving balances and issuances to a new address.</mark>
* When initiating the sweep, the XCP will be deducted and any remaining XCP will be swept to the new address.

<mark style="color:red;">The best advice for users is to have at least 4 XCP on the address you are looking to sweep which covers 1000 balances and 1000 issuances.</mark>

<mark style="color:yellow;">To understand the specifics for how much XCP you may need for your address and all of its contents, please review the</mark> [current sweep protocol specifications](https://github.com/CounterpartyXCP/counterparty-core/issues/1220#issuecomment-1747037727) <mark style="color:yellow;">or see the example below to estimate what your fee might be.</mark>

<figure><img src="https://3285406617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIHOAdveIkUtULHe7q3v2%2Fuploads%2FdbbxqM0wlqgy5HD9enCu%2Fsweepdynamics.png?alt=media&#x26;token=623807f1-3cfd-4f40-bc57-6633e6644960" alt=""><figcaption><p>Four separate examples for an XCP Sweep fee (USD price is assuming price of XCP is $3 per token).</p></figcaption></figure>

To access the Sweep feature, navigate to the “Actions” tab in the upper right. The click the “Sweep Address” function.

<figure><img src="https://3285406617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIHOAdveIkUtULHe7q3v2%2Fuploads%2FlkS0PEUpCWBnrdbvpueB%2Fsweep1.png?alt=media&#x26;token=1bc98e0d-dfb3-44b9-8aa6-21259189a5f2" alt=""><figcaption></figcaption></figure>

This feature shows these options within a new pop-up window:

<figure><img src="https://3285406617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIHOAdveIkUtULHe7q3v2%2Fuploads%2FoKuFXrTZK7M5DIsY0imV%2Fsweep2.png?alt=media&#x26;token=1b09b53d-99de-498f-b618-8e6817549e61" alt=""><figcaption></figcaption></figure>

* Source is the Address you will be Sweeping from.
* Destination is the Address you will be Sweeping to. This is address that will receive all tokens and/or asset ownerships on that address.
* Balances gives you the option to Transfer all token balances.
* Ownerships gives you the option to Transfer all token ownerships.
* You have the option to include a public Memo with this Sweep that <mark style="color:yellow;">can include text or data that will be publicly viewable</mark> on the Bitcoin blockchain.
* The Fee input is the last choice you have here and it is best to review the section titles [What BTC Fee should I use?](https://app.gitbook.com/o/hhkra761ccJQPV4LgzfZ/s/IHOAdveIkUtULHe7q3v2/)

Freewallet allows both Balances and Ownerships to be swept or just one or the other. <mark style="color:yellow;">Just remember to have at least 4 XCP in your Source address</mark> The Destination address does not require anything to be owned on it (BTC, XCP or any other tokens included).

Freewallet will then pop up a confirmation window to confirm your address and settings you have chosen for your destination address.&#x20;

<mark style="color:red;">**Please review all of this information with extreme care and verify it is exactly correct.**</mark>

<mark style="color:yellow;">Take note if you are doing this in a situation you feel your private keys or passphrase may have been compromised, use a fee number even higher than the "High" setting that Freewallet recommends. It would not be unwise to use three to five times (or more!) the recommended High fee in this scenario.</mark>

This ensures the Sweep function happens as fast as possible and is confirmed as fast as possible.

With this in mind, <mark style="color:yellow;">it may also always be a good reason to keep some XCP on addresses you hold many tokens or token ownerships</mark> to ensure you can do this process quickly if need be.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://davestaxcp.gitbook.io/freewallet.io-user-manual/freewallet-functions/using-the-sweep-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
