# Transfer strategies · Monetizing your dapp · Learn Chromia

> FT4 includes three registration strategies that require the user to transfer tokens before an account exists: transfer open, transfer fee, and transfer…

Source: https://chromia.com/learn/monetize-dapp/transfer/

Monetizing your dappLesson 5 of 5

1. [01Monetizing your dapp](https://chromia.com/learn/monetize-dapp/introduction/)
2. [02Set up your project](https://chromia.com/learn/monetize-dapp/setup/)
3. [03Account registration](https://chromia.com/learn/monetize-dapp/account-registration/)
4. [04Open strategy](https://chromia.com/learn/monetize-dapp/open/)
5. [05Transfer strategies](https://chromia.com/learn/monetize-dapp/transfer/)

[Learn](https://chromia.com/learn/)[Monetizing your dapp](https://chromia.com/learn/monetize-dapp/)

05 / 05Advanced

# Transfer strategies

FT4 includes three registration strategies that require the user to transfer tokens before an account exists: transfer open, transfer fee, and transfer subscription. Each requires a token transfer to activate the account, but they differ in how, or whether, you earn revenue from it.

## Transfer open strategy

With transfer open, the user sends a set amount of tokens to an account that doesn't exist yet, then claims that account to activate it. Think of the non-existent account as an empty account waiting for funds. After activation, the user can spend the tokens that were sent to it.

This option sits between fully free registration and the paid strategies: a token transfer is required, but no fee is charged.

warning

**Before using this in production:**

Transfer open is usable in production, but because it charges no transfer fees (local or cross-chain), it is open to spam. Without safeguards, someone could create thousands of accounts by moving tokens back and forth.

**To reduce the risk:**

* Restrict account creation to transfers where the sender and recipient are the same (sender ID = recipient ID)
* Add rate limiting or other validation checks
* Watch for spam patterns

### Code example for transfer open strategy

Start from the template using the [transfer open examples](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_open/) and their tests.

Add this registration configuration to your `chromia.yml` file:

rell

```
lib.ft4.core.accounts.strategies.transfer:
  rules:
    - sender_blockchain: x"0000000000000000000000000000000000000000000000000000000000000000"
    sender: "*"
    recipient: "*"
    asset:
        - name: "MyTestAsset"
        min_amount: 100L
    timeout_days: 60
    strategy:
    - "open"
```

note

This snippet covers registration only. The repository's [full configuration file](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_open/rell/chromia.yml) shows the complete `chromia.yml`, including blockchain setup, FT4 library configuration, and the other required settings.

## Transfer fee strategy

Transfer fee asks the user to buy a set amount of tokens once to unlock your dapp's features. It suits users who want a single, straightforward step.

To register, the user transfers a set amount of tokens to a non-existent account, which is an empty account that must be topped up. When the tokens arrive, the fee is subtracted from the transferred amount.

### Code example for transfer fee strategy

Start from the template using the [transfer fee examples](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_fee/) and their tests.

Add this configuration to your `chromia.yml` file:

rell

```
lib.ft4.core.accounts.strategies.transfer:
  rules:
    - sender_blockchain: x"0000000000000000000000000000000000000000000000000000000000000000"
    sender: "*"
    recipient: "*"
    asset:
        - name: "MyTestAsset"
        min_amount: 100L
    timeout_days: 60
    strategy:
    - "fee"
lib.ft4.core.accounts.strategies.transfer.fee:
  asset:
    - name: "MyTestAsset" # issued by current blockchain
    amount: 40L
  fee_account: x"YOUR_FEE_ACCOUNT_ADDRESS" # All fees will be collected into this account
```

note

This snippet covers registration only. The repository's [full configuration file](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_fee/rell/chromia.yml) shows the complete `chromia.yml`, including blockchain setup, FT4 library configuration, and the other required settings.

## Transfer subscription strategy

Transfer subscription charges users on a recurring basis to keep using your dapp, giving you a steady income to maintain and develop it.

Setup involves a few steps. You first enable subscriptions in `chromia.yml`. The user then calls the `transfer` function, pays a predefined fee, and sends a set amount of tokens to a non-existent account, an empty account that must be funded and is central to the flow.

Next, the user calls the `claim` function to take ownership of that account. You control the subscription length with `subscription_period_days` in `chromia.yml`. Once the period expires, the account becomes inactive and can't be used. The user reactivates it by renewing, which means sending a set amount of tokens to the account.

### Code example for transfer subscription strategy

Start from the template using the [transfer subscription examples](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_subscription/) and their tests, which show the full implementation.

To enable subscriptions, paste this configuration into your `chromia.yml` file:

yml

```
lib.ft4.core.accounts.strategies.transfer:
  rules:
    - sender_blockchain: x"0000000000000000000000000000000000000000000000000000000000000000"
      sender: "*"
      recipient: "*"
      asset:
        - name: "MyTestAsset"
        min_amount: 100L
      timeout_days: 60
      strategy:
      - "subscription"
lib.ft4.core.accounts.strategies.transfer.subscription:
  asset:
    - name: "MyTestAsset" # issued by current blockchain # OR id: x"C633343E4AA3213EA92158648F11BA8DFF606C6CAC80614CFA5F45E57367F823"
    amount: 10L
  subscription_period_days: 30
  free_operations:
    - some_free_operation
```

note

This snippet covers registration only. The repository's [full configuration file](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_subscription/rell/chromia.yml) shows the complete `chromia.yml`, including blockchain setup, FT4 library configuration, and the other required settings.

## Strategy comparison

| Aspect | transfer open | transfer fee | transfer subscription |
| --- | --- | --- | --- |
| **Fee required** | No (a token transfer is still required) | Yes (one-time) | Yes (recurring) |
| **Production use** | Safe if safeguards are in place | Recommended | Recommended |
| **Revenue model** | No direct revenue | One-time payments | Recurring payments |
| **User experience** | Token transfer required | Single, simple payment | Payments needed regularly |
| **Complexity** | Low | Medium | High |

## Configuration properties

| Property | Description |
| --- | --- |
| `sender_blockchain` | The blockchain tokens are accepted from. In the example it is the chain with BRID `x"0000000000000000000000000000000000000000000000000000000000000000"`. Set it to `"*"` to accept tokens from every chain in the Chromia network. |
| `sender` | Who may send tokens to the dapp. `"*"` lets anyone send. |
| `recipient` | Who may receive tokens in the dapp. `"*"` lets anyone receive. |
| `name` | Name of the asset used for account registration. |
| `min_amount` | Smallest transfer to a non-existent account that counts toward registration. |
| `timeout_days` | Number of days a user has to claim a non-existent account that holds a balance. |
| `strategy` | Which strategy type the registration process uses. |

note

Test suites are available for each strategy: [transfer open tests](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_open/rell/src/test/), [transfer fee tests](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_fee/rell/src/test/), and [transfer subscription tests](https://bitbucket.org/chromawallet/fee-samples/src/main/transfer_subscription/rell/src/test/).

Written for this site from Chromia’s public course. Code samples are the course’s own.

[← Previous**Open strategy**](https://chromia.com/learn/monetize-dapp/open/)[Course done →**Start building**](https://chromia.com/developers/#start)

On this page

* [Transfer open strategy](#transfer-open-strategy)
* [Transfer fee strategy](#transfer-fee-strategy)
* [Transfer subscription strategy](#transfer-subscription-strategy)
* [Strategy comparison](#strategy-comparison)
* [Configuration properties](#configuration-properties)
