Working example for polkadot-v0.9.13
to transfer the native token from the relay-chain to the parachain
via the xcm-pallet
and vice-versa. The message format is very generic, hence the correct extrinsics for those transfers are shown below.
The relay chain must have marked encointer as a trusted teleporter, which is not yet the case. This polkadot fork contains slightly amended westend and rococo runtimes, where encointer is a trusted teleporter.
-
Polkadot relay chain: https://github.com/encointer/polkadot/tree/v0.9.13-trusted-encointer
-
For debugging it greatly helps to pass
-lxcm=trace
to the collator. a subsequentless 9944.log | grep xcm
, neatly displays all XCM steps.
Send from Alice on the relay chain to Ferdie on the parachain.
Send from Alice on the parachain to Ferdie on the relay chain.
Note: The relay chain tracks teleported assets. Hence, we must perform a downward transfer before we do the upward
transfer such that the total token stream in parachain direction remains positive. Otherwise, we get a NotWithdrawable
error upon the upward transfer on the relay chain side. In production system this condition always holds as the
parachain starts with 0 tokens anyhow.