Polkadot
- date: 2023-02-04
- last updated: 2023-02-04
Overview
Note: The majority of this research was done in early 2019 and has been updated recently with some notes on consenus and signing. In 2021 John built and deployed a Parachain called Eave Network codebase is here. The parachain was deployed to the Rococo Testnet. John self funded this initiative, but failed to raise seed funding, due to this and other priorities this project was never fully developed and deployed on Kusama or Polkadot. Polkadot is one of John's favourite development frameworks and he is extremely grateful for Gavin Wood and Tomasz Drwięga who he was fortunate enough to collaborate with briefly on the Parity Ethereum Client in early 2016 as he began his blockchain journey.
Polkadot substrate is a chain layer which allows pluggable consensus, definition of storage through the seperation of "extrinsics" and abstracts the runtime design allowing for blockchain providers to decide which runtime best suits there application needs. It also has been built with light client protocol in mind with a number of storage and pruning options giving the ability to clearly seperated different actors requirements for infrastructure (e.g. participants can run a light client on a mobile device and validators can run full nodes with gauranteed performance and uptime). On top of this Polkadot sits as a relay chain (built on Substrate) which allows private chains to share infrastucture such as validators.
Consensus Mechanism
Following is an excerpt from Polkadot learn consensus
Nominated Proof of Stake
In traditional PoS systems, block production participation is dependent on token holdings as opposed to computational power. While PoS developers usually have a proponent for equitable participation in a decentralized manner, most projects end up proposing some level of centralized operation, where the number of validators with full participation rights is limited. These validators are often seen to be the most wealthy, and, as a result, influence the PoS network as they are the most staked. Usually, the number of candidates to maintain the network with the necessary knowledge (and equipment) is limited; this can directly increase operational costs as well. Systems with a large number of validators tend to form pools to decrease the variance of their revenue and profit from economies of scale. These pools are often off-chain.
A way to alleviate this is to implement pool formation on-chain and allow token holders to vote with their stake for validators to represent them.
Polkadot uses NPoS (Nominated Proof-of-Stake) as its mechanism for selecting the validator set. It is designed with the roles of validators and nominators, to maximize chain security. Actors who are interested in maintaining the network can run a validator node.
Validators assume the role of producing new blocks in BABE, validating parachain blocks, and guaranteeing finality. Nominators can choose to back select validators with their stake. Nominators can approve candidates that they trust and back them with their tokens.
References
Consensus-
NPoS: Polkadot Nominated Proof of Stake Documentation
-
Polkadot Consensus: Polkadot's documentation on consenus.
-
Rhododendron - Asynchronously safe BFT consensus, implementation in Rust
-
Block Finality
- Sr25519 Documentation: Polkadots sr25519 Documentation. The implementation of Schnorr signatures that is used in Polkadot and implements the Schnorrkel protocols over the Ristretto compression of the Curve25519 is known as sr25519.
- Substrate sr25519 codebase: Polkadot's sr25519 code (rust).
- ED25519
- Polkadot Staking Documentation: Documentation on Polkadot including staking validators and Nominiated Pools
- Staking Polkadot Application: Polkadot Staking Application validator view.
- Subscan Explorer: Block Explorer built for Polkadot and supporting all Parachains
- parachains: Polkadot documentation on Parachains
- Blockchain Explorers
- Substrate Overview
- What is Substrate
- Substrate Video - Slides
- Parity Substrate Wiki
- What is PolKadot
- Polkadot Governance Video - Slides
- Polkadot Whitepaper
- Polkadot Video Slides
- Substrate : A Rustic Vision of Polkadot by Gavin Wood Video - Slides
- Gavin Wood Podcast on Polkadot, Sharding and Substrate
- Polkadot runtime Environment : Alternative Implementation Grant - Github
- Token Economics - DOTS
- Secret Store shard key generation
- Parity Ethereum IPFS
- Cosmos vs Polkadot
- Polkadot POC Tutorials
- Polkadot on Reddit
- substrate.readme.io - Substrate Developers Hub
- Substrate Workshop - Video
- Substrate Web 3 Summit - Slides
- Building on Substrate
- Polkadot 2018 Recap
- What is Substrate
- Relevant Code Links
- Functional Breakdown
- Persistence
- Storage
- RocksDB
- DB Code
- Data Overview - Light Client
- decl_storage - macro
- Get and Set Storage
- Light Client
- Node
- Storage
- Gossip
- Execution
- Polkadot - Relay Chain
- Whitepaper Overview - Participation in Polkadot - Page 4 gives an overview of the actors
- Collator
- A collator node lives on a distinct parachain and submits a proposal fora state transition, along with a proof for its validity (what we might call a witness or block data).
- Pokadot Parachain - Defines primitive types for creating or validating a parachain.
- Statement Table - This stores messages other authorities issue about candidates.
- Network - Does the heavy lifting of routing the statements and gaining consensus across the relay chain (and associated parachains)
- Consensus - The "consensus" networking code built on top of the base network service. This fulfills the
polkadot_consensus::Network
trait, providing a hook to be called each time consensus begins on a new chain head. - Consensus Pool - Bridge between the network and consensus service for getting collations to it.
- Router - Statement routing and consensus table router implementation.
- Consensus - The "consensus" networking code built on top of the base network service. This fulfills the
- Fisherman (Misbehaviour check) - Utility for substrate-based runtimes that want to check misbehavior reports.
- Hashing
- Chaincode (See WASM above)
- Deployment
- Substrate
- Polkadot Developer Tools
- API
- RPC
- CLI
- SDK
- Polkadot Chain Tools
- Governance
- Substrate Prototyping
- Background Material
- Deploying a Substrate Chain
- Deploying Polkadot
- Deploying a simple contract
- Running a Transaction
- Persistence