# Swaps

You can transfer bitcoin between your Alby Hub on-chain balance and your Alby Hub lightning balance through a swap, using its existing channels and receiving capacity. ⚡🔄

## Overview:

1. [Swap In](#swap-in): Transfer funds from your on-chain balance to your lightning balance.
2. [Swap Out:](#swap-out) Transfer funds from your lightning balance to your on-chain balance.
3. [Set up Auto Swaps](#set-up-auto-swaps)

## Swap In

Transfer funds from your on-chain balance to your lightning balance.

### 1. Navigate to "Wallet" and click on "Swap"

<figure><img src="/files/ezmrivhOZO8eQzYhsvPf" alt=""><figcaption></figcaption></figure>

### 2. Enter a Swap Amount and click "Swap In"

<figure><img src="/files/Db5a8FeTTKchxDvnzdzA" alt=""><figcaption></figcaption></figure>

### 3. Scan the QR using an external bitcoin wallet or use your Alby Hub funds

{% hint style="warning" %}
If you're sending from an external wallet make sure you send the **exact** amount specified, failing to do so will result in a swap failure followed by an immediate refund.
{% endhint %}

<figure><img src="/files/TI82WHMjFsOX7yshKaQR" alt=""><figcaption></figcaption></figure>

### 4. Wait for 1 on-chain confirmation

The swap is now initiated, and you'll see a **"Waiting for confirmation"** loading screen ⏳\
Swap In needs **1 on‑chain confirmation** (\~10 minutes); once that's done, you'll receive an incoming payment notification! 🎉

<figure><img src="/files/ugERxbRT2tKTmEkpp1a2" alt=""><figcaption></figcaption></figure>

### 5. Congrats. You successfully made a Swap In 🎉

<figure><img src="/files/7wir9O5LrKqBL5UaBaJ2" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If a **Swap In** fails or doesn't arrive in time, don't worry, your bitcoin are safe. Go to **Debug Tools > List Swaps**, note the Failed Swap ID, and then **Debug Tools > Refund Swap**, enter the ID, and click **Done**.
{% endhint %}

***

## Swap Out

Transfer funds from your lightning balance to your on-chain balance.

### 1. Navigate to "Wallet" and click on "Swap"

<figure><img src="/files/ezmrivhOZO8eQzYhsvPf" alt=""><figcaption></figcaption></figure>

### 2. Enter a Swap Amount and click "Swap Out"

You can also select an external on-chain wallet. However, please double check the wallet address before proceeding to avoid loss of funds.

<figure><img src="/files/M18CNgf2Qi5EyC8W6VmD" alt=""><figcaption></figcaption></figure>

### 3. Wait for deposit and 2 on-chain confirmations

The swap is now initiated, and you'll see a **"Paying lightning invoice"** loading screen ⏳\
In just a few seconds, the state should change to **"Waiting for 2 on-chain confirmations".**

This is because Swap Out is a two step process. First our swap provider locks up the funds, and as soon as the lightning invoice is paid, we broadcast another transaction to claim it. Once that's done, you should be receiving bitcoin to your on-chain wallet! 🎉

<details>

<summary>Swap Out screen step 1: Waiting for deposit</summary>

<figure><img src="/files/MxNcCvSCHVNcxgKUDGoj" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Swap Out screen step 2a: Waiting for 2 on-chain confirmations</summary>

<figure><img src="/files/CrmWBVD6akWEHJ4YebTO" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Swap Out screen step 2b: Waiting for another on-chain confirmation</summary>

<figure><img src="/files/ToburV0uq3Jpb7K3QNua" alt=""><figcaption></figcaption></figure>

</details>

### 4. Congrats. You successfully made a Swap Out 🎉

<figure><img src="/files/pCB4JDaWrCKFW5rxWE7f" alt=""><figcaption></figcaption></figure>

***

{% hint style="info" %}
If a **Swap Out** fails or doesn't arrive in time, your lightning invoice payment will be canceled and your bitcoin will be returned automatically, no manual refund needed.
{% endhint %}

## Set up Auto-Swaps

If manual swap-outs proof useful to you, you can automate them to **maintain receiving capacity without manual intervention.**

{% content-ref url="/pages/508bYTJp3o00y5k0b3l6" %}
[Auto-Swaps](/user-guide/alby-hub/node/auto-swaps.md)
{% endcontent-ref %}

{% hint style="success" %}
For swap in and swap out, there will be a short waiting period while the transaction confirms on-chain ⏳. This usually takes a few minutes, depending on block confirmations. Sit tight, and your bitcoin will arrive soon! 😊
{% endhint %}

#### Also Checkout:

{% content-ref url="/pages/WzeL6NhhOAdMgrw1c1dH" %}
[What happens if I lose access to my Hub while a swap is in progress?](/user-guide/alby-hub/faq/what-happens-if-i-lose-access-to-my-hub-while-a-swap-is-in-progress.md)
{% endcontent-ref %}


---

# 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://guides.getalby.com/user-guide/alby-hub/wallet/swaps.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.
