
Polkadot
Table of Contents
Polkadot Wiki
Okay so let’s start learning about Polkadot.
Learn
Web3 is transforming applications hosted on centralized infrastructure into decentralized applications (dApps) powered by trust-free blockchain protocols. The goal is to transform the internet into a decentralized web, where users control their data and identity in a trust-free environment. The Web3 movement aims to remove intermediaries and build trustless infrastructure. Web3 is an interactive and collaborative web where users can read, write, and own data.
Data Ownership
In web3, ownership is achieved and validated through cryptography. Each user has a digital identity bound to a set of cryptographic keys usually based on the public key cryptographic scheme, i.e., the famous public and private key pair.
To summarize, data ownership comes from the fact that any message you sign with your private key comes from your digital identity, and the signature proof can be cryptographically verified. Unless someone else stole your keys, you and only you are held accountable for signing the messages and are responsible for the information on your account. Transferring an NFT between two accounts is essentially a transfer of ownership.
The Polkadot Vault app is an air-gapped cold storage solution for all users, including developers and power users. See Ledger devices for other cold storage solutions.
This app does not work on Rooted devices.
Nova Spektr — All-in-one Polkadot desktop wallet supporting multisigs, staking, light clients, and more
Governance and Treasury
In Polkadot, an on-chain treasury together with an open governance model allow to access funds in a fully decentralized manner without any bank transaction whatsoever. This opens up the possibility to come to a decision through on-chain voting mechanism, promoting a sense of community and creating an independent socio-economical environment.
Polkadot’s Representation
Polkadot has a relay chain acting as the main chain of the system. The Polkadot relay chain is represented as a ring surrounded by multiple parachains attached to it. Based on Polkadot’s design, as long as a chain’s logic can compile to Wasm and adheres to the relay chain API, then it can connect to the Polkadot network as a parachain.
Now, Polkadot is the most advanced topic that I am reading about because for me it is very abstract, very high level. But this is the way I learn.
So, about Polkadot:
- Multichain
- Coming from the founders of Ethereum
Polkadot is chain of chains, we can spin up a new chain in no effort(We there will be effort but not that much). That chain will be later on connected to Polkadot chain. (I am telling what I am understanding, this will change in future iterations).
- Sort of internet of chains
- Now 2 Cryptocurrencies, Social media, DAO can communicate with each other.
Let’s build with Polkadot:
- Your launchpad for all things Polkadot—access tools, guides, and resources to quickly start building custom chains, deploying smart contracts, and creating dApps.
❶ Create a chain in minutes -Fast-track your development with a preconfigured blockchain template.
❷ Customize your business logic -Design and tailor your blockchain’s functionality to fit your needs.
❸ Deploy your chain to Polkadot -Launch your blockchain on Polkadot’s secure and scalable platform.
Develop with Polkadot
- Identify your development pathway:
- Parachain Developers - build, deploy, and maintain custom parachains with the Polkadot SDK
- Smart Contract Developers - leverage smart contracts and execute custom logic over existing chains to streamline your development process
- Application Developers - leverage Polkadot’s underlying protocol features to create solutions for your users to interact with the ecosystem
Ummmmm Parachain developers I guess.
A parachain is a coherent, application-specific blockchain that derives security from its respective relay chain. Parachains on Polkadot are each their own separate, fully functioning blockchain.
A parachain is a blockchain that derives shared infrastructure and security from a relay chain.
Relay chains are blockchains that provide shared infrastructure and security to the parachains in the network. In addition to providing consensus capabilities, relay chains allow parachains to communicate and exchange digital assets without needing to trust one another.
Coherency refers to the degree of synchronization, consistency, and interoperability between different components or chains within a system.
Parachains enable parallelization of different services within the same network. However, unlike most layer two rollups, parachains don’t suffer the same interoperability pitfalls that most rollups suffer. Cross-Consensus Messaging (XCM) provides a common communication format for each parachain and can be configured to allow a parachain to communicate with just the relay chain or certain parachains.
Introduction to Polkadot SDK
The Polkadot SDK is a powerful and versatile developer kit designed to facilitate building on the Polkadot network. It provides the necessary components for creating custom blockchains, parachains, generalized rollups, and more. Written in the Rust programming language, it puts security and robustness at the forefront of its design.
The Polkadot SDK houses the following overall functionality:
- Networking and peer-to-peer communication (powered by Libp2p)
- Consensus protocols, such as BABE, GRANDPA, or Aura
- Cryptography
- The ability to create portable Wasm runtimes
- A selection of pre-built modules, called pallets
- Benchmarking and testing suites
consensus /kən-sĕn′səs/ noun - An opinion or position reached by a group as a whole
Github: The Parity Polkadot Blockchain SDK
- Substrate - a set of libraries and primitives for building blockchains
- FRAME - a blockchain development framework built on top of Substrate
- Cumulus - a set of libraries and pallets to add parachain capabilities to a Substrate/FRAME runtime
- XCM (Cross Consensus Messaging) - the primary format for conveying messages between parachains
- Polkadot - the node implementation for the Polkadot protocol
Create a Custom Blockchain Using the SDK
Before starting your blockchain development journey, you’ll need to decide whether you want to build a standalone chain or a parachain that connects to the Polkadot network. Each path has its considerations and requirements. Once you’ve made this decision, follow these development stages:
- Install the Polkadot SDK - set up your development environment with all necessary dependencies and tools
- Build the chain - learn how to create and customize your blockchain’s runtime, configure pallets, and implement your chain’s unique features
- Deploy the chain - follow the steps to launch your blockchain, whether as a standalone network or as a parachain on Polkadot
Install the Polkadot SDK
sudo dnf install clang curl git make
sudo dnf update
sudo dnf install clang curl git openssl-devel make protobuf-compiler
rustup is an installer for the systems programming language Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
/home/AtulyaRaaj/.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory is located at:
/home/AtulyaRaaj/.cargo
This can be modified with the CARGO_HOME environment variable.
The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:
/home/AtulyaRaaj/.cargo/bin
This path will then be added to your PATH environment variable by
modifying the profile files located at:
/home/AtulyaRaaj/.profile
/home/AtulyaRaaj/.bash_profile
/home/AtulyaRaaj/.bashrc
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>
Check the version:
rustc --version
rustc 1.84.1 (e71f9a9a9 2025-01-27)
After installing get the basic template:
git clone https://github.com/paritytech/polkadot-sdk-minimal-template.git minimal-template
cd minimal-template
Now build
cargo build -p minimal-template-runtime --release
Error
error: failed to run custom build command for `minimal-template-runtime v0.1.0 (/home/AtulyaRaaj/Desktop/Projects/Web3/Polkadot/minimal-template/runtime)`
Caused by:
process didn't exit successfully: `/home/AtulyaRaaj/Desktop/Projects/Web3/Polkadot/minimal-template/target/release/build/minimal-template-runtime-eab89f0357295635/build-script-build` (exit status: 1)
--- stderr
Cannot compile the WASM runtime: no standard library sources found at /home/AtulyaRaaj/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust!
You can install them with `rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu` if you're using `rustup`.
https://github.com/rust-lang/rustup/issues/3733
Solution:
rustup component add rust-src --toolchain nightly
cargo +nightly build -p minimal-template-runtime --release
This much I am able to run.
Parachain Zero To Hero Tutorials
Setup the template
cargo install --git https://github.com/paritytech/polkadot-sdk --force staging-chain-spec-builder
cargo install --git https://github.com/paritytech/polkadot-sdk --force polkadot-omni-node
Compile the Runtime¶ The Polkadot SDK Parachain Template provides a ready-to-use development environment for building using the Polkadot SDK. Follow these steps to compile the runtime:
Clone the template repository:
git clone https://github.com/paritytech/polkadot-sdk-parachain-template.git parachain-template
Navigate to the root of the template directory:
cd parachain-template
Compile the runtime:
cargo build --release
Error:
running cd "/home/AtulyaRaaj/Desktop/Projects/Web3/Polkadot/parachain-template/target/release/build/openssl-sys-432f115fc3bc3633/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/home/AtulyaRaaj/Desktop/Projects/Web3/Polkadot/parachain-template/target/release/build/openssl-sys-432f115fc3bc3633/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
cargo:warning=configuring OpenSSL build: 'perl' reported failure with exit status: 2
cargo:warning=openssl-src: failed to build OpenSSL from source
--- stderr
Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC entries checked: /usr/local/lib64/perl5/5.40 /usr/local/share/perl5/5.40 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ./Configure line 15.
BEGIN failed--compilation aborted at ./Configure line 15.
Error configuring OpenSSL build:
'perl' reported failure with exit status: 2
Command failed: cd "/home/AtulyaRaaj/Desktop/Projects/Web3/Polkadot/parachain-template/target/release/build/openssl-sys-432f115fc3bc3633/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/home/AtulyaRaaj/Desktop/Projects/Web3/Polkadot/parachain-template/target/release/build/openssl-sys-432f115fc3bc3633/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
warning: build failed, waiting for other jobs to finish...
sudo dnf update
sudo dnf groupinstall "Development Tools"
sudo dnf install perl-FindBin perl-devel openssl-devel
Compile the runtime:
cargo build --release
So basically I installed Rust and many many packages and tried running a node. This was a very top level approach. But it’s good.