# Gasless Transaction

At this point, it's a well-known fact that managing and paying gas tokens for your on-chain transactions has always been a pain. While the account abstraction method in EIP-4337 can help abstract away gas completely, not all users or ecosystems have adopted EIP-4337. Given that more than 80% of users are still using EOAs instead of a smart contract accounts, XY Finance is now ready to support Gasless Transaction to bring a better UX to our cross-chain swap service for everyone.

### What Is Gasless Transaction?

Gasless Transaction is an optional method added to our token swap interface that enables users to swap certain tokens without paying gas on-chain.

### How Does It Work?

To allow EOAs to perform transactions gaslessly,

* Permit (EIP-2612) is used to collect an off-chain token approval signature from user EOAs
* EIP-712 is used to collect an off-chain transaction signature from user EOAs
* A Relayer EOA will send the transaction on-chain by paying gas itself
* User EOA signatures are still mandatory in this process, all transactions can only be processed on-chain if proper signatures are provided
  * Our smart contracts will revert the transactions if the signatures are invalid

When Gasless is enabled, our platform covers the network gas cost using our native tokens. In return, a corresponding fee is deducted from the original token used in the swap to offset that cost. For example, if a user swaps USDC on Arbitrum to a meme token on Base, the fee is taken directly from the USDC amount being swapped, no additional tokens are spent from the user EOA. Refer to [fee-structure](https://docs.xy.finance/fee-structure "mention") for more details on the fee structure.

### How Can I Use Gasless Transaction?

{% tabs %}
{% tab title="Token Selection" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FuDBTj7ORWQDVykg7Shki%2Fimage.png?alt=media&#x26;token=7a83a9bf-9d44-4a7c-bebc-29904880a458" alt="" width="375"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Route Selection" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FqcrVc5w2ZPtJNNfdkH3d%2Fimage.png?alt=media&#x26;token=b0702695-eddf-46bc-a310-2a31687cbc3e" alt="" width="563"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Enable Gasless" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2Fxe1ZDOhEnlR7fj2FsPxT%2Fimage.png?alt=media&#x26;token=d298b22d-044d-4186-b38b-219d90f7f51f" alt="" width="375"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Token Approval" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FHA9aTzx8jUhoQSZioOiQ%2Fimage.png?alt=media&#x26;token=eab993d3-e31e-4c6c-bbc2-f31b09292bcc" alt="" width="563"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Tx Signature" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FZ5bvxsQmIIhF6xct9uGa%2Fimage.png?alt=media&#x26;token=7e7ddbe6-a6a0-469c-bdad-9ca2a4401a4c" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Track Status" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FpJ3V1q2I3BQN4q57MzNT%2Fimage.png?alt=media&#x26;token=5be3c2f6-84d5-42c7-aa49-d0df8063ae2e" alt="" width="375"><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

1. Select a token labeled with  `Gasless` next to its symbol
2. Proceed with your swap configuration, click `Review Route` to continue
3. At the Confirmation page, you can enable Gasless with  `Pay Fees With <Token>` toggle
4. Upon clicking `Transfer`, you will be asked to sign a token approval
5. After token approval is signed, you will still be asked to sign a transaction
6. Once the approvals are signed, your transaction will be sent on-chain for processing &#x20;
