# How to use the Bridge?

## Introduction <a href="#introduction" id="introduction"></a>

The  bridge can be configured and integrated into the deployed Thanos stack. Its key functionality includes Deposit/Withdraw support for ETH, Native token, USDT, and USDC. You can learn more about the thanos bridge here. As the code is open source, operators and developers can extend its functionalities to suit their specific needs.

## Quick User guide <a href="#quick-user-guide" id="quick-user-guide"></a>

After you deploy the thanos bridge following the Thanos stack deployment guide, you will get the public domain of that bridge where you can move assets across Layer1 and Layer2.

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

You should have the Metamask wallet installed in your browser. ([guide](https://support.metamask.io/start/getting-started-with-metamask/#how-to-install-metamask))

**Wallet connect**

1. First things first, you can connect your account by clicking `Connect Wallet` button to use the bridge.

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FN8ty7enlMNG2tXNx1xW9%2Fimage.png?alt=media&#x26;token=3188270a-d7c7-488e-b03d-d459a719a8bf" alt=""><figcaption></figcaption></figure>

2. After you connect your account into the bridge app, you can change the network(L1 & L2) connected and also able to see the token balance of your account.

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FEc2pN3UZeypEFuOC5m99%2Fimage.png?alt=media&#x26;token=708798fd-9d33-40e1-88ef-e596de95f643" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FBv6iOFCFwPGApA9dj3TY%2Fimage.png?alt=media&#x26;token=c1f80bfc-e02d-422d-bd37-b12e16005ee3" alt="" width="375"><figcaption></figcaption></figure>

### **Deposit(L1 → L2)**

1. Click the `Deposit` tab or set the L1 network chain connected to deposit tokens to the L2 network.

   <figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2F2dsLwQLiDUBbP8cXdhvd%2Fimage.png?alt=media&#x26;token=7a677834-d7df-4f77-8a89-d052d111fc75" alt=""><figcaption></figcaption></figure>
2. Select the token and input the amount to deposit. `To address` is the address to be deposited; it is your current account as a default, but you can put another account if needed. (pic1: connected account, pic2: another account)

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FfaoHChTxJTjBUGu2yPfx%2Fimage.png?alt=media&#x26;token=3f369067-f424-4bce-9cc9-2ed2a4d2232b" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FYkc0wTHJmOCdopJkLPZu%2Fimage.png?alt=media&#x26;token=b7720e26-9693-40f1-8250-381fa74212d2" alt="" width="375"><figcaption></figcaption></figure>

3. Click `Deposit` button for ETH deposit and you will need to approve them in case of the other tokens (Native token, USDT, USDC). After the transaction has been confirmed, you will get the link of that transaction.

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2Fppn5HOlVO6GpMKMijWbZ%2Fimage.png?alt=media&#x26;token=679bafe0-cfca-4676-a636-ba6f0bbf54bd" alt="" width="375"><figcaption></figcaption></figure>

### **Withdraw(L2 → L1)**

The withdrawal process contains 3 steps (initiate, prove, finalize) based on Optimistic rollup.

1. Initiate
   1. You can initiate a withdrawal transaction by clicking `Withdaw` → `Initiate` tab and the operations(token selection, input amount, input address to send, etc) are same as what we did for the deposit process.

      <figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2Farnu376luxtyYMuFrHNN%2Fimage.png?alt=media&#x26;token=29c3aa01-9dc4-4559-b1d0-e4799f3f50be" alt="" width="352"><figcaption></figcaption></figure>
   2. After the transaction has been confirmed, you will get the Tx hash which will be used for `prove` and `finalize` process.
2. Prove

   1. You can check the status of your withdrawal transaction in [Layer2 block explorer](https://explorer.thanos-sepolia.tokamak.network/withdrawals) that you deployed in the previous rollup deployment steps.

   <figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FgJZUSSmmkMyWmTEiaWtr%2Fimage.png?alt=media&#x26;token=c6d6e0e6-8d0f-4f04-a683-72ba3f5db825" alt=""><figcaption></figcaption></figure>

   b. Once the transaction is ready to prove, you are ready to prove it. Click `Prove` tab and input the hash of the initiated transaction. Click `Prove` button.

   <figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FyxpcrslPZFwr4VymmB0Y%2Fimage.png?alt=media&#x26;token=719dfaaf-0f40-45fc-91fc-afe84a28af6e" alt=""><figcaption></figcaption></figure>
3. Finalize
   1. Check the status of your withdrawal transaction in Layer2 block explorer and it should be `Ready for relay` to be finalized.
   2. Go to `Finalize` tab and input the hash of the initiate transaction. Click `Finalize` button.

      <figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FfaRZT2tgZOQdPIz0uzP1%2Fimage.png?alt=media&#x26;token=b7050bc7-44ab-44d2-92c7-4020f7c7f3d8" alt=""><figcaption></figcaption></figure>

## Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

1. If you are using an http RPC url for the L2 rollup, instead of https, you will need to manually add the L2 network to your metamask.
   1. Open the metamask extension in your browser, click on the network dropdown on top left corner and click `Add a custom network`.

      <figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FvnUb7fbDEwQrHYuXBupe%2Fimage.png?alt=media&#x26;token=423d998d-e7c5-4d64-aa66-a6638bba288b" alt="" width="273"><figcaption></figcaption></figure>

      <figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FxGEsNY6kL3BZPooH6W7h%2Fimage.png?alt=media&#x26;token=c0e71266-716c-44b7-b38e-6fac083f246e" alt="" width="287"><figcaption></figcaption></figure>
   2. Get the following details from bridge app and fill in the form.
      1. Network Name
      2. New RPC URL
      3. Chain ID
      4. Currency Symbol
      5. Block Explorer URL (Optional)

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FI7y351q2HyFr2HEkGx1r%2Fimage.png?alt=media&#x26;token=58c6ecae-3251-47fc-98c6-e6c77899bf41" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FazeSizvACyGJ5Rcd2P4n%2Fimage.png?alt=media&#x26;token=37a251aa-17b3-4b22-9d61-1b6c5aa0a903" alt="" width="284"><figcaption></figcaption></figure>

2. Network switch issue in case of http L2 RPC url. If you want withdraw or prove/finalize the withdrawals, you need to switch the network to the L2 rollup network. In this case, if you have http L2 RPC url, you will need to manually switch the network in your metamask.

<figure><img src="https://3565366697-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl0dwiwSNGrEYCAvrI0ht%2Fuploads%2FovoNT8CzD6sfrnYMCBTL%2Fimage.png?alt=media&#x26;token=8ae1ad92-8876-456f-a74e-740e0e5d71f7" alt="" width="299"><figcaption></figcaption></figure>

After switching the network, you will see the network has been switched to the L2 rollup network successfully and you can continue with the withdraw or prove/finalize process.
