Since the access to Polkadot’s testnet Rococo is ended, the process of integration to test relay chain has changed. Now Polkadot announced that all teams hoping to integrate their chain to relay chain need to work with Chachacha.
Introducing Chachacha
Chachacha is a pre-testnet relay chain developed based on Rococo. Rococo is still the official test network for Polkadot. The integration to Chachacha is the same as that to Rococo.
The steps to build a parallel link into Chachacha are as follows:
1. Run and maintain at least 2 Validator of the relay chain, and generate the Validator’s session key.
2. Prepare a wallet address as the Validator Id.
3. Run and maintain at least one Parachain Collator Validator, generate WASM validation function file and gensis state file.
4. Submit the Chachacha access application form.
5. Use your ValidatorId to send a setKeys transaction to Chachacha, and submit the session Key of the Validator.
6. Submit a parachain registration request to Chachacha.
Step 1: Run the Validation Validator
1. Run the validator node
We can manage the startup of Validator through docker-compose. The configuration of docker-compose.yml is as follows:
docker-compose.yml
services:
validator-001
:image: centrifugeio/rococo:chachacha-v1
ports:
- "5544:9944"
- "5533:9933"
command: polkadot --validator --chain rococo-chachacha --name <your_chachacha_validator_name_1> --bootnodes
/ip4/34.89.248.129/tcp/30333/p2p/12D3KooWD8CAZBgpeZiSVVbaj8mijR6mfgUsHNAmCKwsRoRnFod4 --ws-external --rpc-cors all --rpc-methods=unsafe
validator-002:
image: centrifugeio/rococo:chachacha-v1
ports:
- "7744:9944"
- "7733:9933"
command: polkadot --validator --chain rococo-chachacha --name <your_chachacha_validator_name_2> --bootnodes
/ip4/34.89.248.129/tcp/30333/p2p/12D3KooWD8CAZBgpeZiSVVbaj8mijR6mfgUsHNAmCKwsRoRnFod4 --ws-external --rpc-cors all --rpc-methods=unsafe
Note: Please modify your_chachacha_validator_name_x to your node name
Execute the following command to start two Valitator nodes
docker-compose up -d
Because the above docker-compose.yml is configured with different port mappings for the 2 nodes, we get the websocket ports of the two nodes at 5544 and 7744 respectively.
2. Check whether the node has joined the Chachacha network
We use telemetry to check whether your two nodes have joined the Chachacha network normally.
https://telemetry.polkadot.io/#list/Chachacha%20Staging%20Testnet
3. Generate the Validator session key
(1) Build a polkadot apps website by yourself
Repo: https://github.com/polkadot-js/apps
Note: Because https://polkadot.js.org/apps uses the HTTPS protocol, sending an XML request to an HTTP host that is not configured with ssl will be intercepted by the browser (cross-domain issue).
We also provide a polkadot apps website for use
(2) Connect to our Validator node through polkadot apps and execute the RPC request to submit author.rotateKeys.
Connect to the port 5544 and 7744 nodes respectively, execute the RPC request to get the session key, and record it.
Step 2: Prepare a wallet address as the node Id
Generate a wallet address through polkadot.js extension and save it.
You need to upload the metadata of Chachacha to the polkadot.js extension first.
When creating a wallet address, pay attention to choosing the Chachacha network.
Step 3: Run and maintain at least one Collator node
1. Compile Parachain Code
git clone https://github.com/substrate-developer-hub/substrate-parachain-template.git
cd substrate-parachain-template
# Switch to rococo-v1 branch
git checkout -b rococo-v1 rococo-v1
Add the rust-toolchain file in the project root directory
Rust-toolchain
nightly-2021–04–15
Run command to compile
cargo build --release
If you encounter std errors, you need to add WASM target
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-04-15
2. Generate WASM validation function file and gensis state file
WASM validation function file
The WASM validation function file is a WASM binary file, which is a verification function for the relay chain Validator node to check the validity of the parachain state transition.
gensis state file
The gensis state file is a parachain founding state file.
We also need to determine a parachain id, such as 1234 (it must be greater than 1000, because the id within 1000 is reserved by the system, and be careful not to conflict with other people’s parachain id).
Execute the following command to generate a file.
# Export genesis state to `./resources files
./target/release/parachain-collator export-genesis-state --parachain-id 1234 > ./resources/para-1234-genesis
# export runtime wasm
./target/release/parachain-collator export-genesis-wasm >
./resources/para-1234-wasm
3. Run the Collator node
wget -O ./resources/rococo-chachacha.json
https://storage.googleapis.com/centrifuge-artifact-releases/rococo-chachacha.json
./target/release/parachain-collator --collator --parachain-id 1234 -- --execution wasm --chain ./resources/rococo-chachacha.json
Step 4: Submit the Chachacha parachain registration form
1. Join the Chachacha discussion group and get the element handle
The text after the @ symbol is your element handle
2. Fill out the form
Chachacha V1 Parachain Registration
https://forms.gle/1fZTAaA312pkYCtV7
3. Go to the element @mikiquantum to process your request. After the staff has processed it, some CHA coins will be sent to your Validator wallet account.
Step 5: Send setKeys transaction to Chachacha
Use your Validator Id to send sesion.setKeys transaction to Chachacha, and submit the node’s session Key.
Submit the transaction with the Validator wallet account
Keys: fill in the session key just generated
Proof: It will be ignored, so it can be filled in randomly, such as 0x1234.
Two session keys need to be submitted twice.
The wallet address that submitted this request will be used as the ValidatorId of the Validator node.
Step 6: Submit a chain registration request to Chachacha
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Ffullnode-relay.chachacha.centrifuge.io#/extrinsics
Submit the proposeParachain.proposeParachain transaction with the following parameters:
● para_id: the ID of your parachain
● name: a hex-encoded name for your parachain
● validation_function: the Wasm runtime for your parachain
● initial_head_state: your parachain’s genesis state
● validators: one validator from the previous step
● balance: the constant value 1000
After submitting the transaction, go to the element to remind Chachacha staff to deal with it.
Stay tuned for further information about the OAK Network here on Medium, Twitter and LinkedIn, as well as in our Discord Server!
Please check out our engineering and growth job openings, contact partner@oak.tech for partnerships, or contact@oak.tech for any general inquiries.
Reference article
1.Building Parachains on Rococo
https://wiki.polkadot.network/docs/en/build-parachains-rococo
2. Building Chachacha: Rococo’s wilder Cousin
https://medium.com/centrifuge/launching-chachacha-rococos-wilder-cousin-13dcb3820db2
3. Register a Rococo Parachain
https://github.com/substrate-developer-hub/cumulus-workshop/blob/master/en/6-register/1-register.md
About Chris Li
Chris Li (LinkedIn) is the founder and CEO of Ava Protocol. Prior to establishing Ava Protocol, Chris gained valuable experience as a Messaging Protocol Engineer at Microsoft and as a successful serial entrepreneur. He is also a long-term EVM smart contract developer, Web3 Foundation grant recipient, and Polkadot core contributor.