# Withdraw ETH from Gas Tank

## Withdraw ETH from Loopring Wallet’s Gas Tank

{% hint style="success" %}
To withdraw from the gas tank, your wallet must have a small amount of ETH (“dust”) on Taiko Alethia — **not** inside the gas tank itself. Be sure you have a bit of ETH in your wallet before initiating the withdrawal.
{% endhint %}

### 1. Check ETH Balance in the Gas Tank

The Loopring Wallet app displays your Gas Tank balance, but only up to 7 decimal places.\
To view the full ETH balance, use the on-chain contract reader:

🔗 [View full balance on TaikoScan](https://taikoscan.io/address/0x5C07472a097D0e7212612846305a73342Dc01b9A#readContract)

* Scroll to the `balanceOf` function.
* Enter your wallet address.
* Click **Query** to see the full ETH balance displayed in **wei**.

{% hint style="success" %}
If you’re not withdrawing the exact balance, keeping up to 6 decimal digits should work fine.
{% endhint %}

<figure><img src="https://2415010777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjysAcUs3GARrxHWSE1ej%2Fuploads%2Fu4CNaM9qN7ipydn2pclm%2FQuery%20Balance.png?alt=media&#x26;token=d104d4f1-b3ec-4c28-925f-39c6a445c745" alt=""><figcaption></figcaption></figure>

***

### 2. Reserve a Small Amount for Fees

ETH in your Gas Tank is used to pay gas fees on the Taiko network.\
Withdrawing the full balance may cause the transaction to fail if there's not enough ETH left to cover the fee.

Gas fees on Taiko are minimal, but we **recommend reserving a small amount of ETH** in the Gas Tank to avoid issues.

#### How to Estimate and Subtract for Gas

If you want to calculate your `withdrawAmount` precisely, follow these steps:

1. **Estimate the gas cost**
   * Try submitting a full withdrawal.
   * If it fails, note the estimated gas cost (e.g., `0.0000023 ETH`).
2. **Add a buffer**\
   Multiply the estimated cost by **1.5** to ensure your transaction succeeds:

`0.0000023 ETH × 1.5 = 0.00000345 ETH`

3. **Convert to wei**\
   Convert the buffered amount from ETH to wei:

`0.00000345 ETH × 1e18 = 3,450,000,000,000 wei`

4. **Subtract from your balance**\
   Subtract the buffered gas fee (in wei) from your total ETH balance (also in wei).

Example:

| Full Balance    | 376667029381073 wei |
| --------------- | ------------------- |
| Gas Fee Buffer  | -3450000000000 wei  |
| Withdraw Amount | 373217029381073 wei |

5. **Use this value**\
   Use the result as your `withdrawAmount` when calling the smart contract’s `withdraw` function.

{% hint style="success" %}
It's okay to slightly overestimate the buffer. Leaving a tiny amount of ETH in the tank ensures your transaction won’t fail due to insufficient gas.
{% endhint %}

***

### 3. Withdraw ETH Using the Smart Contract

🔗 [Open `writeContract` on TaikoScan](https://taikoscan.io/address/0x5C07472a097D0e7212612846305a73342Dc01b9A#writeContract)

#### Steps:

1. **Connect Wallet:**\
   Use **WalletConnect** to link the Loopring Wallet you want to withdraw from.

<figure><img src="https://2415010777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjysAcUs3GARrxHWSE1ej%2Fuploads%2Fh7c3ZnKFxutDLtMMUazZ%2FWrite.png?alt=media&#x26;token=8637b444-d06c-410a-8a11-f3c05ff36020" alt=""><figcaption></figcaption></figure>

2. **Click on Write Contract**
3. **Use the `withdrawTo` method:**

* `withdrawAddress`: Enter the wallet address where you want to send the ETH.
* `withdrawAmount`: Enter the amount to withdraw (your total balance minus the reserved fee).

3. Click **Write** to submit the transaction.

<figure><img src="https://2415010777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjysAcUs3GARrxHWSE1ej%2Fuploads%2Fp9HoDQ09nyf8DXYUUGkd%2FWrite.png?alt=media&#x26;token=e2d2bbf3-628a-4af1-ad53-830064e95c56" alt=""><figcaption></figcaption></figure>

***

### 4. Approve the Transaction in the Wallet App

The Loopring Wallet app will show a confirmation popup:

* Tap **Approve**.
* Enter your wallet password if prompted.

{% hint style="success" %}
You can close the popup immediately after approving — no further action is required.
{% endhint %}

***

### 5. Confirm the Transaction

After approving:

* Go to the **Transactions** section in your wallet app.
* Confirm that the ETH has been successfully withdrawn from the Gas Tank.
