paint-brush
Polkadot Deep Dive 2021 - Connecting The $DOTsby@haroonbaig
4,421 reads
4,421 reads

Polkadot Deep Dive 2021 - Connecting The $DOTs

by Haroon BaigMarch 25th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A detailed 2021 guide on Polkadot and how it is geared towards solving some of the most fundamental yet complex problems faced by the blockchain ecosystem today

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Polkadot Deep Dive 2021 - Connecting The $DOTs
Haroon Baig HackerNoon profile picture

Remember CryptoKitties? A fairly simple dApp which brought the whole Ethereum network to its knees, with up to sixfold increase in the pending transactions at that time! 🤯

🤔 Think about that for a second - Ethereum, a general purpose blockchain that can run programs getting choked by a single dApp, let alone the gazillion smart contracts deployed on-chain! 👀

With more and more smart contracts getting deployed on Ethereum, limitations surfaced that severely hampered the projects. Low throughput of the platform leading to network congestion and high transaction fees clearly shows something is wrong! 🚨🚨

Not to mention, the one-time only storage fee led to state bloat and excessive chain size growth which made it difficult for the network participants, especially the smaller ones, to secure the network.

Ethereum Virtual Machine (EVM) is clearly not an appropriate tool for complex innovations, and as people started to realize, a single app optimized state machine is much better compared to a bottleneck virtual machine. 

This motivated the development of custom blockchain protocols that are optimized to solve one specific problem - Privacy, Supply Chain, DeFi, Identity, and whatnot.

This approach of building niche-specific protocols with their own governance and consensus looks good on paper, but it only solves a fraction of the bigger problem.  

Building your own blockchain is ‘expensive’ 💸

Yes! Each project takes a lot of $$$, too many years for development and launch, and a ton of rigorous testing. 

Encourages monopolistic behaviour ⚠️

Bitcoin is huge, Ethereum is huge, and so are other projects in the space. If every protocol works in isolation, they can grow to monopolistic proportions.

Still not convinced? Just look at the BigTech - Facebook, Amazon, Google! 

Competing over security resources 🔋

Security is at the heart of decentralization. Most of the blockchain platforms working in isolation are competing with each other over security resources; whether it’s staking or burning coal to solve hashes. 

There is no concept of a shared security base because of a difference in execution environments, consensus and complete lack of interoperability.

In an attempt to solve these challenges, Polkadot took a completely different approach and built a massive and powerful platform to enable the next-gen Web 3.0 as they call it!

Before we dive deeper into the universe of Polkadot, here is the sneak peek of what it can do (for the impatient geeks out there!) 😉

  • Heterogeneous sharding, think of each shard as an independent blockchain itself.
  • Substrate, a set of tools and libraries that you can use to build your own blockchain. 
  • Highly composable with cross-chain messaging and interoperability.
  • Common security and consensus layer.
  • Explicit on-chain governance.
  • … and much more!

Let's go for a ride and decode Polkadot! ✊

Polkadot is commonly referred to as a meta-protocol, or a Layer-0 protocol, upon which you can build and launch your own protocol. 

Sounds confusing? Bear with me, this is not going to be brutal! In the next 5 minutes, you’ll be well versed in the Polkadot and its ecosystem, I promise. 

Let's take Ethereum as an analogy. Ethereum, as you all know, is an infrastructure layer for Smart Contracts and dApps. In other words, it’s an underlying layer upon which you can build applications by deploying your smart contracts. 

In absolute layman terms, Polkadot provides an underlying layer upon which you can launch your own blockchains, and these blockchains can run smart contracts, talk to other blockchains that are launched on the  Polkadot platform, and even talk to external protocols (like Bitcoin, Ethereum) via bridges 💪

The underlying layer (or the meta-layer) of Polkadot is called the Relay Chain, these blockchains that you build on top of the relay chain are called Parachains and Parathreads that can talk to each other and exchange value/information, and they connect and communicate with external networks like Ethereum and Bitcoin via Bridges

Sounds simple enough? That was probably the simplest explanation of Polkadot that you can find on the internet, haha! 😃

The technology behind Polkadot network 👨‍💻

Now let’s get beyond this ‘Polkadot for dummies’ and discuss the core details of how the whole system is put together. 


At its core, Polkadot is a multi-chain protocol with heterogeneous sharding. It consists of the following main components: 

Relay Chain

Polkadot utilizes a central chain called the relay chain which communicates with multiple heterogeneous and independent sharded chains called parachains. The relay chain is responsible for providing shared security for all parachains, and trust-free cross-messaging between them. 

Here is a very generic view of the relay chain bundled with parachains and a bridge chain. 

Parachain 

Parachain (‘parallel chains’) are independent and heterogeneous blockchains that are governed by the relay chain. Parachains are ‘shards’  providing application-level functionality, while the relay chain provides them the security, finality, cross-chain messaging and interoperability as a service. 

With Substrate, a set of tools and libraries, you can build and launch a blockchain in minimal time. In fact, Polkadot is itself being built using Substrate, how cool is that! Substrate cuts the development time and cost and lets you focus on the core business logic. 

Parathreads

Parathreads are just like parachains, with the only difference being the economic model behind them. They can be termed as pay-as-you-go parachains and are best suited for the kind of applications that don’t need to push blocks very often, e.g., Oracles that provide weather data. 

Bridges

With Bridges, both parachains and parathreads can connect to the outside networks like Bitcoin and Ethereum. The underlying consensus  provides ‘provable finality’ so these bridges can easily communicate and verify information when connecting to a different execution environment (external networks).


Consensus Roles ⚖️

The consensus roles sit at the heart of the Polkadot network. From transaction validation to block propagation and finality, these roles secure the network and ensure everything on the network runs smoothly!

Nominators 

Nominators select trustworthy validators. They have no additional role except to place risk capital and signal that they trust a particular validator to act responsibly in maintaining the network.

Validators

Validators are the highest in charge when it comes to the consensus roles, and they are responsible for providing finality by receiving, reviewing, and publishing blocks. They secure the relay chain by staking dots and participating in consensus with other validators.

Collators

Since validator nodes cannot maintain a fully-synchronized database of all parachains, the task of assigning a new block to the validator is assigned to collators. 

Think of a collator as a ‘full node’ for a particular parachain, where they can author new blocks and execute transactions just like the block producers do on any other blockchain. Collators produce proof for the validators and maintain shards (parachains). 

Fishermen

Fishermen are the bounty hunters. They monitor the network and report bad behavior to validators. Any collator or a parachain full node can perform this role. 

The $DOT Token - Powering the Polkadot Network ⚡⚡

Polkadot has a native token called DOT and is used for governance, staking, and bonding on the platform.

Bonding - A new way of crowdfunding (crowdlending)

Bonding is a fascinating concept, think of it as a new and refined version of ICOs. Before we discuss this, we need to understand Parachain Slots and Parachain Offerings. 

You can build a blockchain using Substrate, but in order to connect it to the relay chain (making it a parachain), you have to reserve your parachain slot using Parachain Lease Offerings (PLO) or sometimes referred to as IPO (Initial Parachain Offering)

This process isn’t free, and the team behind a parachain has to lock-up a certain amount of funds in order to reserve their parachain slot. Once they get their slot, they will be given an 18 months grace period, after which they will have to reserve their slot again by locking up the funds for the next 6 months. 

The team can either use their own funds, or run a campaign (just like ICO) to get public backing. If you remember, there was one problem with ICOs - You HAD to trust the team!

In the ICO boom back in 2017-18, countless ‘shitcoins’ were launched where the team ran away with ETH or stablecoins, leaving the public with dubious tokens that hold no value. 

Parachain lease offerings, in contrast, is a complete paradigm shift from crowdfunding to crowdlending, where instead of giving your hard earned cash, you lend your tokens to the team. 

Now you might be wondering, how does it all work? 🧐

Imagine Team A planning to launch a parachain, and they need X amount of DOTs to secure a parachain slot. They launch a fundraising campaign and ask for a public backing. You, as a DOT token holder, want to participate in this campaign. 

You will lock up your DOTs with the team for the initial grace period of 18 months (or whatever the team decides). It’s kind of like staking, your DOTs will be held by the Polkadot relay chain and then later migrated to the parachain. 

But, you don’t have to TRUST the team, and that’s the main thing. The team doesn’t own your DOTs and instead, they are held on the network. Your DOTs don't even leave your account, they’re just locked for a set period of time. 

If you look closely, there is no value transfer, but a guaranteed lock-up situation. However, unlike staking, they don’t produce any returns but the team can plan to incentivize you with rewards for your loaned amount (either in their own tokens, or in some other form). 

After the lock-up period expires, you will be able to spend your DOTs. This is a revolutionary fundraising model that creates a win-win situation for both the participants and team! How cool is that? 

Staking - earn up to 12% APY 💰

DOT tokens can be used for staking in order to secure the network. Every transaction on the Polkadot network goes through the relay chain and it needs to be validated. 

This role of validation is performed by validators, who stake their DOTs and earn up to 12% APY. Good actors are rewarded and bad actors will lose their stake in the network. This ensures the network stays secure.

Governance 🗳️

DOT token holders can directly participate in the governance process by voting directly, which includes managing exceptional events such as protocol upgrades and fixes. Unlike other projects, DOT token holders have complete control over the protocol. 

Just like bonding, Polkadot has introduced a new form of voting that includes time-lock, where token holders can ‘lock’ their tokens during the voting process. 

This is beneficial for two reasons: to show skin in the game and seriousness in your vote, and to discourage large token holders from manipulating the voting process. The minimum time-lock period is 4 weeks. 

Here‘s how the voting mechanism looks like:

Bob votes ‘YES’ with 20 DOTs locked up for 4 weeks will be counted as 20 votes (20 DOTs * 1 (as 4 weeks = 1))

Alex votes ‘NO’ with 10 DOTs locked up 8 weeks will be counted as 20 votes (10 DOTs * 2)

Joh votes ‘NO’ with 5 DOTs locked up for 160 weeks will be counted as 200 votes (5 DOTs * 40) 

There are certain limits of course, but as you can see, one can have more voting power even if they hold a small number of DOTs.

Consensus - BABE and GRANDPA 🧓

The consensus protocol of Polkadot consists of BABE (Blind Assignment for Blockchain Extension), a block production mechanism of the relay chain that provides probabilistic finality and GRANDPA (GHOST-based Recursive Ancestor Deriving Prefix Agreement), which provides provable, deterministic finality and works independently from BABE. 

GRANDPA can finalize blocks nearly instantly, and can even finalize large quantities of blocks at once when the partitions resolve. Intuitively GRANDPA is a Byzantine agreement protocol that works to agree on a chain, out of many possible forks, by following simpler fork choice rules which together with BABE would give probabilistic finality if GRANDPA itself stopped finalizing blocks. 

XCMP (Cross-Chain Messaging Protocol) ✉️

XCMP is the protocol that parachains use to send messages to each other. It aims to guarantee four things: 

  1. Messages arrive quickly.
  2. Messages from one parachain arrive to another in order.
  3. Arriving messages were indeed sent in the finalised history of the sending chain.
  4. Recipients will receive messages fairly across senders, helping guarantee that senders never wait indefinitely for their messages to be seen.

Downward Message Passing (DMP) is a mechanism for delivering messages to parachains from the relay chain, Upward Message Passing (UMP) is a mechanism responsible for delivering messages in the opposite direction, from a parachain up to the relay chain. 

The Polkadot ecosystem 🪐

The polkadot ecosystem is growing very rapidly, and we are seeing very promising projects that are coming to the limelight!  

Not every project in the Polkadot ecosystem is necessarily a Parachain, the ecosystem can be categorized into three different segments: 

Parachains - You can launch substrate based Parachains that can be either heterogeneous blockchains with an execution environment for smart contracts, or simply an Oracle parathread providing data, or an EVM reference implementation, or a bridge chain that connects with the outside network like Bitcoin and Ethereum. 

Smart Contracts - You can build smart contracts for the supported parachains that are already launched on the Polkadot network, and build dApps that can harness the power of composability, cross-chain messaging and interoperability.

Tooling and infrastructure projects - Other than parachains or smart contracts, you can build different tools that facilitate the ecosystem, like a blockchain explorer and analytics platform. 

Here is an excellent visualization of how the Polkadot ecosystem looks like in 2021.

Team behind Polkadot 👨‍💻👩‍💻

Polkadot is a brainchild of Dr. Gavin Wood, one of the early cofounders and CTO of the Ethereum project. He coded Ethereum, along with Vitalik Buterin back in the early days.

Polkadot is a project of Web3 Foundation, a Swiss organization who nurtures technologies and applications in the fields of decentralized web and software protocols. Web3 Foundation is working with teams and organizations around the globe to build Polkadot.

According to their website, 'Researchers from Inria Paris and ETH Zurich, developers from Parity Technologies, and capital partners from crypto-funds such as Polychain Capital are all working together to develop a superlative realization of Web3, with Polkadot at its core.'

Resources to learn more about Polkadot 💡

Here is a list of resources that I’ve compiled during my research, keep exploring and keep learning!

Polkadot Lightpaper - A must read to get a brief overview!
Polkadot whitepaper - Not everyone's cup of tea but a detailed guide.
Polka Wiki - Have a question? Head over to their Wiki.
Web3 Foundation - Want to get involved? Reach out to them!
Polkadot blog - Knowledge nuggets!
PolkaProject - A list of all the projects deployed on Polkadot.

Over and out! 👋
Haroon