Skip to content

subdarkdex/subdex-xc-network-hackusama

Repository files navigation

Subdex cross chain network Deprecated - only docker supported

This repo provides simple scripts, inspired by polkadot/cumulus, to set up a network with:-

  1. Relay Chain with 4 validators (Alice, Bob, Charlie and Dave)
  2. Generic parachain (test parachain in cumulus)
  3. Subdex parachain (parachain with generic-asset and dex pallet)

The relay chain chain-specs is a modified version of westend_local, with validator_count = 4 to support 2 parachains.

This is a part of the submission for Hackusama 2020.

  1. subdex-chain (Standalone dex-pallet in a substrate node)
  2. subdex-ui (React frontend providing friendly UI)
  3. subdex-xc-network (current repo)
  4. subdex-parachains (Parachains using the Cumulus framework with the substrate-parachain-template, generic-parachain and dex_chain branches)

To run with docker

# in the root of this directory
docker-compose --file docker-compose-xc.yml up

To stop

# in the root of this directory
docker-compose --file docker-compose-xc.yml down -v
./clear_all.sh 

Development

building all docker images for dockerhub

  1. Base images - this is to compile the binary / wasm file from branches of subdex_cumulus
# To build

# for generic-parachain
git clone https://github.com/subdarkdex/subdex_parachains.git dex-parachain
cd dex-parachain
docker build --tag subdarkdex/generic-chain:<version>
  1. Collators, WASM Runtime Volume, Registrar
  • collators - both dex and generic parachains
  • wasm runtime volume - this is a copy of the wasm runtime for the collators, used to register parachain, we also have the genesis state volume built during docker-compose up for this purpose
  • registrar - simple polkadotjs cli container to register the parachains using sudo
cd docker
./build-containers.sh v0.1.0 
# or other versions

Run local parachain binarys

Pre-requisits

  • Docker version 19.03.8, build afacb8b
  • execute access for the .sh files in this repo

Setup for native parachain binaries

NOTE: - we are not using the script provided in cumulus because we want 2 parachains, also, need to be able to build and rebuild the parachain binaries as we experiment. But when we get more familiar / more stable versions of the parachains, we can build a similar script to do all steps.

Steps required are:-

  1. set up relay chain validators
  2. set up default cumulus parachain
  3. run paraA and paraB
  4. register parachains

1. Set up validators

docker-compose -f docker-compose-validatorsOnly.yml up will set up alice, bob, charlie and dave

2. build parachains

./build_collators.sh

3. run the parachains

./start_collators.sh

4. register parachains

./register_parachain.sh

5. stop validators

docker-compose -f docker-compose-validatorsOnly.yml down

6. (purge-chains, all chains)

./clear_all.sh

Setup config details

Parachain account

The parachain account is tied to the parachain_id encoded

 Parachain id: Id(100) Generic Parachain
 Parachain Account: 5Ec4AhP7HwJNrY2CxEcFSy1BuqAY3qxvCQCfoois983TTxDA
... 
 Parachain id: Id(200) Dex Parachain
 Parachain Account: 5Ec4AhPTL6nWnUnw58QzjJvFd3QATwHA3UJnvSD4GVSQ7Gop

Chain specs

The DarkDex chain spec is a duplication of the westend-local chain, but with 4 validators and validator count as 4. Changes were made to v0.8.14 - chain_spec.rs

# westend-local was updated with 4 validators, Alice, Bob, Charlie and Dave
./target/release/polkadot build-spec --chain=westend-local --raw --disable-default-bootnode > dex_raw.json

Interaction

This version works with 1.29 polkadot js on https://polkadot.js.org/apps/

Types:

{
  "AssetId": "u64",
  "Address": "AccountId",
  "LookupSource": "AccountId"
 
}

About

A default network for XC interactions with a relay chain

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published