Polkadot is the interoperability network which connects chains with distinct state machines and consenus to support past, present and future blockchains. Its a scalable multi-chain network that has been in development since 2016 to become a collaborative reource pooling solution that turns competition into rule-based co-operation.
The Polkadot design principles make it heterogenous, scalable and secure. This means it can support an ecosystem of diverse and complimentary utilities, has an ultra efficient root layer to scale on-scale or off-chain apps and has a rigorous security model for the system.
Parachains on Polkadot
Parachains are extensible networks that are plugged into the Polkadot relay chain as validatable, globally readable data structures. As parallel networks they lose the function of finality and gain the ability to communicate. They also retain the sovereignity of confirming their own transaction validity.
These parachains incorporate various functions to gather and process transactions:
- Validity Functions: This is a piece of WASM that takes block headers or other proofs and stores them on-chain in the parachain registry.
- Collator Node: This creates candidate blocks that satisfy the validity function. It evaluates the true/false nature of a block.
- Message Queues: This builds interoperability by ensuring candidates process incoming & outgoing messages.
Building The Network
For this post, we will deploying a the Adder test parachain built by Polkadot. The parachain is built on several technology stacks. Its written using the Rust programming language which makes it safe, secure & efficient. It runs with a WebAssembly (WASM) compiler that ensures the parachain is protable and well-supported.
To get started running and deploying your own instance of Adder, ensure you have Rust & WASM Compiler installed:
Install Rust & Wasm Compiler
curl https://sh.rustup.rs -sSf | sh rustup install nightly rustup target add wasm32-unknown-unknown --toolchain nightly
Install Support Software
sudo apt install make clang pkg-config libssl-dev
Build From Source
git clone https://github.com/paritytech/polkadot.git cd polkadot ./scripts/init.sh cargo build --release cargo test --all cd parachain/test-parachains/ cargo build cd adder/collator cargo build cargo run
Download wasm binaries for the parachain to the local machine:
scp parachain:¬/polkadot/parachain/tests/res/adder.wasm ¬Downloads/adder.wasm --projects-development-225311
For more parachain examples to interact with consider the parachain I've also deploying for the Powerplay Network and submitted during the #buildPolkadot hackathon that was just concluded. Powerplay is a cross-chain network for the exchange of functions like money exchange or promises.
Deploying The Parachain
Polkadot provides various JavaScript utilities and libraries for interacting with the network. The best way to deploy your parachain is through the Polkadot Portal.
- Choose a network to deploy to - Polkadot (Live, hosted by Web3 Foundation) is recommended. You can also deploy to a custom end-point.
- Create your account and back up your keys (obviously)
- On the extrinsic tab submit the registrar function
- Select registerPara(id, info, code, initial head data)
- Add your validationCode and HeadData. Get this from your the powerplay.wasm file
- Finally, Submit Transaction for parachain to be registered. This will cost about 10 Dot.
- On the parachain tab, look for your deployed and published parachain
Conclusion
Parachains on Polkadot are unmetered state transmission functions. With PowerPlay, you can send asynchorous calls to other parachains to exchange value over the relay chain. This complex state transition functions can derive network security from Polkadot and can be deployed to the network through permissioned governance.