# Transfer Tokens and Data Across Chains

In this tutorial, you will use GRE to transfer tokens and arbitrary data between smart contracts on different blockchains. First, you will pay GRE fees on the source blockchain using GRE. You will then pay GRE fees in native Gas tokens using the same contract. For example, you can use ETH on Ethereum, or MATIC on Polygon.

## Before you start&#x20;

1. You should know how to write, compile, deploy, and fund smart contracts. If you need to brush up on the basics, read this tutorial, which will guide you through using the Solidity programming language, interacting with the MetaMask wallet, and working in a Remix development environment.&#x20;
2. Your account must have some ETH and GRE tokens on Ethereum Sepolia and MATIC tokens on Polygon Mumbai.&#x20;
3. Check the "Supported Networks" page to confirm that your channel supports the token you want to transfer. In this example, you will be transferring tokens from Ethereum Sepolia to Polygon Mumbai, so check the list of supported tokens here.&#x20;
4. Learn how to get GRE test tokens. By following this guide, you should have the GRE-BnM token, and GRE-BnM should appear in the token list in MetaMask.&#x20;
5. Find out how to fund your contract. This guide shows how to fund your contract in GRE, but you can use the same guide to fund your contract with any ERC20 tokens, as long as they appear in MetaMask's token list.
6. Follow the previous tutorial: Transfer tokens between chains.



## Tutorial

In this tutorial, you will use GRE to send string text and GRE-BNM tokens between smart contracts on Ethereum Sepolia and Polygon Mumbai. First, you will pay in GRE, then you will pay for GRE in native Gas.

## Deploy your contracts <a href="#deploy-your-contracts" id="deploy-your-contracts"></a>

To use this contract:

1. [Open the contract in Remix](https://remix.ethereum.org/#url=https://docs.chain.link/samples/CCIP/ProgrammableTokenTransfers.sol).
2. Compile your contract.
3. Deploy and fund your sender contract on _Ethereum Sepolia_:
   1. Open MetaMask and select the network _Ethereum Sepolia_.
   2. In Remix IDE, click on _Deploy & Run Transactions_ and select _Injected Provider - MetaMask_ from the environment list. Remix will then interact with your MetaMask wallet to communicate with _Ethereum Sepolia_.
   3. Fill in your blockchain's router and GRE contract addresses.&#x20;
   4. Click the **transact** button. After you confirm the transaction, the contract address appears on the _Deployed Contracts_ list. Note your contract address.
   5. Open MetaMask and fund your contract with GRE-BnM tokens. You can transfer `0.002`![Copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) _GRE-BnM_ to your contract.
   6. Enable your contract to send GRE messages to _Polygon Mumbai_:
      1. In Remix IDE, under _Deploy & Run Transactions_, open the list of transactions of your smart contract deployed on _Ethereum Sepolia_.
      2. Call the `allowlistDestinationChain` as the destination chain selector, and `true`![Copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) as allowed. Each chain selector is found on the supported networks page.
4. Deploy your receiver contract on _Polygon Mumbai_:
   1. Open MetaMask and select the network _Polygon Mumbai_.
   2. In Remix IDE, under _Deploy & Run Transactions_, make sure the environment is still _Injected Provider - MetaMask_.
   3. Fill in your blockchain's router and GRE contract addresses. The router address can be found on the supported networks page and the GRE contract address on the GRE token contracts page.
   4. Click the **transact** button. After you confirm the transaction, the contract address appears on the _Deployed Contracts_ list. Note your contract address.
   5. Enable your contract to receive GRE messages from _Ethereum Sepolia_:
      1. In Remix IDE, under _Deploy & Run Transactions_, open the list of transactions of your smart contract deployed on _Polygon Mumbai_.
      2. Call the `allowlistSourceChain`  as the source chain selector, and `true`![Copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) as allowed. Each chain selector is found on the supported networks page.
   6. Enable your contract to receive GRE messages from the contract that you deployed on _Ethereum Sepolia_:
      1. In Remix IDE, under _Deploy & Run Transactions_, open the list of transactions of your smart contract deployed on _Polygon Mumbai_.
      2. Call the `allowlistSender` with the contract address of the contract that you deployed on _Ethereum Sepolia_, and `true`![Copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) as allowed.
5.  At this point, you have one _sender_ contract on _Ethereum Sepolia_ and one _receiver_ contract on _Polygon Mumbai_. As security measures, you enabled the sender contract to send GRE messages to _Polygon Mumbai_ and the receiver contract to receive GRE messages from the sender and _Ethereum Sepolia_.

    **Note**: Another security measure enforces that only the router can call the `_greReceive` function. Read the explanation section for more details.
