---
# System prepended metadata

title: Moonbeam HRMP Demo

---

# Moonbeam HRMP Demo

Used [these instruction](https://hackmd.io/u0wF-tPZRbykz_S3EaqvRg?view) for compiling and preparing build artifacts.

Once you have a parachain producing blocks finalized on the relay chain, you may proceed to the next steps.

HRMP channels are unidirectional (so can only send messages from sender to recipient where sender opens the channel and recipient accepts).

## Moonbeam-1000 -> Moonbeam-1001 native token transfer

### Open HRMP Channel

The root account for the sender parachain (1000) should open the channel.

- https://wiki.acala.network/build/development-guide/composable-chains/open-hrmp-channel

We could use sudo to open this channel, using `paraSudoWrapper`.

### Make Transfer

The cross-chain message is NOT constructed manually. `xtransfer` is the interface for forming and dispatching cross-chain messages. There are two dispatchables, one for each of the possible parachains we may interact with:
1. `transfer_to_account_key_20_parachain`
2. `transfer_to_account_id_32_parachain`

For a Moonbeam-1000 to Moonbeam-10001 transfer, you need to call `transfer_to_account_key_20_parachain` on the sending parachain. The 

## Moonbeam-1000 -> Rococo Parachain Template ROC token transfer

### Register KSM Token Type in Token Factory

If we're not using the native currency (`Balances` instance), the token type must first be registered in the `token-factory`. The relevant dispatchable is `register_token(TokenId)`. You should register the type so you can just choose the relevant ticker in polkadot-js:

```json=
TokenId: {
          _enum: ["DOT", "KSM", "ACA", "AUSD"],
        },
```

> We probably want to register the known token types immediately upon the network's launch. There were attempts to do this automatically using `GenesisBuild`, but nested storage transactions are not yet supported and they are required because `register_token` is actually deploying a contract to our EVM instance.

## Vertical Message Passing (Temporarily Blocked)

In order to test upward message passing (from parachain to relay chain), there must exist relay chain assets on the parachain. In order for the relay chain asset to exist on the parachain, the `token-factory` must mint it and this only occurs as a consequence of processing the `DepositAsset` message.

Therefore, downward message passing is a prerequisite for upward message passing when transferring relay chain assets from a parachain to the relay chain. Here is an issue to add the relevant runtime dispatchable and possibly an asset registry on the relay chain.

- https://github.com/paritytech/polkadot/issues/2564