# Transfer tokens gaslessly

{% hint style="info" %}
An API key is required to use the infrastructure to power gasless transactions. Visit  <https://app.rallyprotocol.com/> to generate both Amoy and Mainnet Polygon API keys.&#x20;
{% endhint %}

## Gasless transactions with RLY token&#x20;

{% hint style="success" %}
In this section, we leverage the RLY token ([polygonscan](https://polygonscan.com/token/0x76b8D57e5ac6afAc5D415a054453d1DD2c3C0094)) and our faucet to enable developers to complete a gasless token transfer in just seconds. Use the following code to claim test RLY tokens and transfer it to a destination wallet of your choosing.&#x20;
{% endhint %}

```javascript
import { 
    RlyAmoyNetwork, 
    getAccount, 
    Network } from '@rly-network/mobile-sdk';

const rlyNetwork: Network = RlyAmoyNetwork;

//add your API Key
rlyNetwork.setApiKey(YourAPIKey...)

//claim 10 test RLY tokens gaslessly for testing
await rlyNetwork.claimRly();

//destination address for testing
const destinationAddress = "0x8D9F6c7Ab1316B613BDdcD1fDbac6025A1323569"

//transfer 5 RLY token expressed in wei using executeMetaTransaction
await rlyNetwork.transferExact(
    destinationAddress, 
    5000000000000000000, 
    MetaTxMethod.ExecuteMetaTransaction
); 
```

## Getting started with your chosen ERC-20 token

### Contract requirements&#x20;

1. **Contract is compatible with the RallyMobile SDK**
   1. Contracts that are [ERC2771 compatible](/react-native-expo/gasless-transactions/guides/add-erc2771recipient.md#if-you-are-able-to-update-the-contract) are natively supported by the RallyMobile SDK. Those that are not ERC2771 compatible must be whitelisted, [view the guide here.](/react-native-expo/gasless-transactions/guides/add-erc2771recipient.md#if-you-are-able-to-update-the-contract)
2. **Contract natively supports gasless transactions**
   1. Contracts that have the `executeMetaTransaction` or `Permit` method for gasless transactions are natively supported by our SDK. To determine which method is supported by your contract, [view the guide here](/react-native-expo/gasless-transactions/guides/determining-the-gasless-transaction-method.md).&#x20;

{% hint style="info" %}
View our [supported tokens list](https://docs.rallyprotocol.com/resources/supported-tokens) to see if your chosen token is already supported.
{% endhint %}

## Gasless transactions with your chosen ERC-20 token

Use the following code to transfer your chosen token gaslessly.

```javascript
import { 
    RlyAmoyNetwork, 
    getAccount, 
    Network } from '@rly-network/mobile-sdk';

const rlyNetwork: Network = RlyAmoyNetwork;

//add your API Key
rlyNetwork.setApiKey(YourAPIKey...)

//destination address for testing
const destinationAddress = "0x...."

//hex address of token contract
final tokenAddress = "0x...." 

//transfer 5 ERC20 token expressed in wei using executeMetaTransaction
await rlyNetwork.transferExact(
    destinationAddress, 
    5000000000000000000, 
    erc20TokenAddress,
    MetaTxMethod.ExecuteMetaTransaction
); 

//transfer 5 ERC20 token expressed in wei using permit
await rlyNetwork.transferExact(
    destinationAddress, 
    5000000000000000000, 
    erc20TokenAddress,
    MetaTxMethod.Permit
); 
```


---

# 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://docs.rallyprotocol.com/react-native-expo/gasless-transactions/transfer-tokens-gaslessly.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.
