# Transfer Tokens with Data - Defensive Example
Source: https://docs.chain.link/ccip/evm/tutorials/application-developers/programmable-token-transfers-defensive
Last Updated: 2026-05-01

> For the complete documentation index, see [llms.txt](/llms.txt).

This tutorial extends the [Transfer Tokens with Data](/ccip/evm/tutorials/application-developers/programmable-token-transfers) example. It uses CCIP to send `tokens + arbitrary data` from one chain to another in a single transaction.
In addition though, it incorporates defensive receiver logic that stores failed messages and locks received tokens instead of reverting the whole delivery.

You will send `CCIP-BnM` tokens and a `string` payload from *Ethereum Sepolia* to *Arbitrum Sepolia*. The destination contract is configured to fail intentionally, then you will recover the locked tokens.

> **NOTE: CCIP 2.0 supports Faster-Than-Finality (FTF)**

> **NOTE: Gas limit for defensive contracts**

## Before you begin

1. You should understand how to write, compile, deploy, and fund a smart contract. Go through this [tutorial](/quickstarts/deploy-your-first-contract) to get started.
2. Your account must have some `ETH` on *Ethereum Sepolia* and `ETH` on *Arbitrum Sepolia* for gas. If you plan to pay CCIP fees in `LINK`, you also need testnet `LINK` on *Ethereum Sepolia*. \
   Learn how to [Acquire testnet LINK](/resources/acquire-link).
3. Check the [CCIP Directory](/ccip/directory) if you want to configure a different set of source and destination chains/tokens.
4. [Acquire CCIP test tokens](/ccip/getting-started/test-tokens#evm-chains). You should have `CCIP-BnM` tokens, and `CCIP-BnM` should appear in the list of your tokens in MetaMask.

## Examine the code

## Tutorial

Let's get started! Choose your preferred development environment below.

### Foundry

Best for **Solidity-native** workflows that prefer a modular, powerful scripting framework.

> **NOTE: Want to set up a dev environment from scratch?&#x20;**
>
> Check out the [Getting started page](/ccip/evm/getting-started#foundry) for detailed instructions on setting up a
> Foundry dev environment from scratch.

### Hardhat

Best for developers who want a mature, TypeScript-based smart contract development framework.

> **NOTE: Want to set up a dev environment from scratch?&#x20;**
>
> Check out the [Getting started page](/ccip/evm/getting-started#hardhat-3) for detailed instructions on setting up a
> Hardhat dev environment from scratch.

> **CAUTION: Educational Example Disclaimer**
>
> This page includes an educational example to use a Chainlink system, product, or service and is provided to
> demonstrate how to interact with Chainlink's systems, products, and services to integrate them into your own. This
> template is provided "AS IS" and "AS AVAILABLE" without warranties of any kind, it has not been audited, and it may be
> missing key checks or error handling to make the usage of the system, product or service more clear. Do not use the
> code in this example in a production environment without completing your own audits and application of best practices.
> Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for unintended outputs
> that are generated due to errors in code.