# System overview · Verify events across chains with ICCF · Learn Chromia

> The dapp you are building runs on two blockchains: the Subscription Chain and the Digital Warehouse Chain.

Source: https://chromia.com/learn/iccf-course/system-overview/

Verify events across chains with ICCFLesson 3 of 6

1. [01Confirm Events Across Blockchains](https://chromia.com/learn/iccf-course/introduction/)
2. [02Set up your project](https://chromia.com/learn/iccf-course/setup/)
3. [03System overview](https://chromia.com/learn/iccf-course/system-overview/)
4. [04Subscription chain](https://chromia.com/learn/iccf-course/subscription-chain/)
5. [05Digital warehouse chain](https://chromia.com/learn/iccf-course/digital-warehouse-chain/)
6. [06Testing the dapp](https://chromia.com/learn/iccf-course/manual-testing/)

[Learn](https://chromia.com/learn/)[Verify events across chains with ICCF](https://chromia.com/learn/iccf-course/)

03 / 06Intermediate

# System overview

The dapp you are building runs on two blockchains: the Subscription Chain and the Digital Warehouse Chain.

To set up a subscription, the user makes a payment on the Subscription Chain, which deducts a set amount from their account. You can later customize and extend this payment flow with the
[FT library](https://docs.chromia.com/build/ft4/intro/). The user then shows the payment receipt to the Digital Warehouse Chain to gain access. Once inside, the user can update the inventory of a fictional warehouse.

With this design, you can run several warehouses by deploying several warehouse chains. Because payment processing lives on a separate chain, this component could also become part of a larger, more flexible system.

## Subscription model

You represent a subscription as a structure that is sent to the Subscription Chain and checked later on the Digital Warehouse Chain. When the warehouse verifies a payment, it reads this structure as metadata. Start by creating a directory named `src/subscription_chain` and adding a `module.rell` file inside it.



src/subscription\_chain/module.rell

```nolines
module;
```

Next, add an `entities.rell` file to the `src/subscription_chain` directory with this code:

src/subscription\_chain/entities.rell

```
struct subscription {
    account_id: pubkey;
    period;
}

enum period {
    WEEK,
    MONTH,
}

val MILLIS_IN_A_DAY = 24 * 60 * 60 * 1000;
```

Then add a `functions.rell` file to `src/subscription_chain` with this code:

src/subscription\_chain/functions.rell

```
function period_price(period): integer {
    return when (period) {
        MONTH -> 90;
        else -> 30;
    };
}

function period_to_millis(period): integer {
    return MILLIS_IN_A_DAY * when (period) {
        MONTH -> 30;
        else -> 7;
    } ;
}
```

A new subscription request records the account ID and the period. Helper functions map that period to its price and its duration.

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

[← Previous**Set up your project**](https://chromia.com/learn/iccf-course/setup/)[Next →**Subscription chain**](https://chromia.com/learn/iccf-course/subscription-chain/)

On this page

* [Subscription model](#subscription-model)
