This page is intended for developers & builders.
Finding the right environment for testing XCM features, both standalone or with smart contracts, can be difficult since it requires at least two parachains with open HRMP channels and a Relay Chain. The parachains need to have the features we rely on in testing.
At the moment, only production networks, like
Shiden, have access to a great number of HRMP channels with various parachains. Testing in production isn't a good idea though and should be avoided. A possible alternative is to use
Rococo as a Relay Chain and the connected parachains, if they are available. Not all projects deploy a testnet on Rococo.
The approach that gives users the most control is to setup a local test network, with both the Relay Chain and parachain(s). This is very simple & easy to do using the zombienet tool provided by Parity. Simply put, users can download arbitrary Relay Chain and parachain binaries (or use images) to setup a configurable local test network. Users will have access to all privileged actions on the Relay Chain and on the parachains which makes testing much easier.
For example, user can download
polkadot binary together with
cumulus-parachain to spin up a testnetwork with
polkadot as Relay Chain,
astar as one parachain and
statemint as the second parachain.
Zombienet documentation can be found here, including the installation instructions, CLI usage, guide with examples and many more. Users are advised to consult this document to get a better understanding of the tool.
Shibuya - Shiden Test Network
A quick reminder -
Shibuya is a test network with no market value used by
Astar & Shiden team to test features before deploying into production. It uses a custom Rococo based Relay Chain.
Shiden is a production canary-type network connected to
Kusama. These two parachains aren't aware of one another and do not communicate in live networks.
zombienet, users can setup a local test network where one parachain would be
Shibuya and the other would be
Shiden with HRMP channels opened between them. This is incredibly useful for testing & integration because it gives users the option for cross-chain communication between two smart-contract oriented parachains which support Wasm smart contracts, amongst many other features.
The following instructions will explain how to setup & configure local Shibuya - Shiden test network.
Basic Setup Instructions
For users who already know what they are doing, please check this folder in
Astar repository for ready-to-use
For the sake of simplicity, prepare a folder called
zombienetinto which ALL binaries and config files will be placed.
zombienetbinary appropriate for your operating system (or install it in any way you prefer).
Use the configuration file
multi_parachains.tomlwhich can be found here. Make sure to check the file to get a sense of which parameters are being used.
Start the network. This is a command example:
./zombienet-linux -p native spawn multi_parachains.toml. However, you can start the network in your preferred way (e.g. using
Lots of useful information will be printed, like commands used to generate chain specifications and commands used to start the network (useful for extracting RPC ports). At the end, a table with direct links to node's
polkadot-js pagewill be created. Use this to interact with chain from your browser.
After a minute or two, block production on both
Shidenshould start. This will usually happen after Relay Chain reaches block 11, which will trigger a new session. HRMP channels will automatically be configured between the parachains (check the configuration file).
The test network is running and users can interract with Relay Chain and both parachains. It is now possible to deploy EVM and Wasm smart contracts, send XCM instructions and do everything else what is possible on live chains. In addition, users have direct access to
Aliceaccount, which has
We will provide automated way of performing these setup actions in the future.
Basic Cross-Chain Assets Setup Instructions
After completing the previous steps, a local test network with two parachains is running. The following steps will explain how to setup basic cross-chain payable assets for both parachains.
The aim is to configure a cross-chain SDN asset on
Shibuya and cross-chain SBY asset on
Shiden. Both assets will be configured as payable, meaning they can be used to pay for XCM execution on the remote chain.
For all steps, encoded call data will be provided to simplify the process for the user. Call data can be copy/pasted into field under
Developer -> Extrinsic -> Decode. ALL calls should be executed as
- In the local
Shibuya polkadot-jsexplorer, create a new asset for the cross-chain SDN wrapper. Configure it to be sufficient and payable.
- In the local
Shiden polkadot-jsexplorer, create a new asset for the cross-chain SBY wrapper. Same concept as in the previous step.
- In the local
Shibuya polkadot-jsexplorer, send 1000 SBY to
- In the local
Shiden polkadot-jsexplorer, send 1000 SDN to
- Check that
Aliceon both chains received the assets (minus the execution fee).
Basic Remote Execution Instructions
After completing the previous steps, cross-chain SDN and SBY wrappers are configured as payable and sufficient assets.
The following steps will explain how to execute a cross-chain remote call.
Alice will send an instruction from
Shiden to execute
Alice isn't able to directly control
Alice on the destination chain, instead a new account will be derived. More information can be found here.
Alice'sderived account on
Shibuyawhen sending instructions from
> ./xcm-tools remote-account -p 2007 -a 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
Shibuya(send it some SBY tokens).
Alice, send an XCM sequence instructing
- Observe successful XCM execution on
Shibuyaand inspect the block to observe