Polkadot Interview Questions - Easy
Easy-level Polkadot interview questions covering blockchain basics, Substrate, and parachains.
Q1: What is Polkadot and how does it work?
Answer:
Polkadot is a heterogeneous multi-chain protocol.
Key Components:
- Relay Chain: Main chain providing security
- Parachains: Independent chains with dedicated slots
- Parathreads: Pay-as-you-go parachains
- Bridges: Connect to external chains
Consensus: Nominated Proof of Stake (NPoS)
Q2: What is Substrate and how do you build with it?
Answer:
Substrate is a blockchain framework for building custom chains.
Basic Runtime:
1// runtime/src/lib.rs
2pub struct Runtime;
3
4impl Config for Runtime {
5 type Block = Block;
6 type RuntimeCall = RuntimeCall;
7}
8
9// Define modules (pallets)
10construct_runtime!(
11 pub enum Runtime {
12 System: frame_system,
13 Balances: pallet_balances,
14 }
15);
Build Chain:
1# Create new substrate node
2substrate-node-new my-chain
3
4# Build
5cargo build --release
6
7# Run
8./target/release/my-chain --dev
Q3: What are Polkadot validators and nominators?
Answer:
Validators:
- Produce blocks on Relay Chain
- Validate parachain blocks
- Stake DOT tokens
- Earn rewards
Nominators:
- Stake DOT to validators
- Share in rewards
- Help secure network
Staking:
1# Bond DOT
2polkadot-js-apps -> Staking -> Account actions -> Bond
3
4# Nominate validators
5polkadot-js-apps -> Staking -> Nominate
Q4: How do parachains work?
Answer:
Parachain Architecture:
- Independent chains with own state
- Connected to Relay Chain
- Share security with Relay Chain
- Can communicate with other parachains
Parachain Slot:
- Auctioned for 96 weeks
- Requires DOT bond
- Provides dedicated block space
Collators:
- Collect transactions
- Produce blocks
- Submit to validators
Q5: What are Substrate pallets?
Answer:
Pallets are runtime modules.
Example Pallet:
1#[pallet]
2pub mod pallet {
3 use frame_support::pallet_prelude::*;
4
5 #[pallet::config]
6 pub trait Config: frame_system::Config {
7 type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
8 }
9
10 #[pallet::storage]
11 pub type MyStorage<T: Config> = StorageValue<_, u32>;
12
13 #[pallet::call]
14 impl<T: Config> Pallet<T> {
15 #[pallet::weight(10_000)]
16 pub fn my_function(origin: OriginFor<T>) -> DispatchResult {
17 // Implementation
18 Ok(())
19 }
20 }
21}
Q6: How does XCM (Cross-Consensus Messaging) work?
Answer:
XCM enables communication between parachains.
Send XCM:
1use xcm::prelude::*;
2
3let message = Xcm(vec![
4 WithdrawAsset(assets),
5 BuyExecution { fees, weight_limit },
6 DepositAsset { assets, beneficiary },
7]);
8
9// Send to parachain
10XcmPallet::send(origin, dest, message)?;
Q7: How do you interact with Polkadot using polkadot.js?
Answer:
Basic Interaction:
1import { ApiPromise, WsProvider } from '@polkadot/api';
2
3// Connect
4const provider = new WsProvider('wss://rpc.polkadot.io');
5const api = await ApiPromise.create({ provider });
6
7// Get balance
8const balance = await api.query.balances.account(accountAddress);
9
10// Send transaction
11const tx = api.tx.balances.transfer(recipient, amount);
12await tx.signAndSend(signer);
Q8: What is the difference between parachains and parathreads?
Answer:
Parachains:
- Dedicated slot (auctioned)
- Guaranteed block space
- Higher cost
- Better for high-throughput
Parathreads:
- Pay-per-block model
- No dedicated slot
- Lower cost
- Better for occasional use
Q9: How does Polkadot governance work?
Answer:
Governance Bodies:
- Council: Elected representatives
- Technical Committee: Technical experts
- Referendum: Public voting
Proposal Process:
- Submit proposal
- Council/Technical Committee review
- Public referendum
- Execution if passed
Q10: How do you test Substrate pallets?
Answer:
Unit Tests:
1#[cfg(test)]
2mod tests {
3 use super::*;
4
5 #[test]
6 fn test_my_function() {
7 new_test_ext().execute_with(|| {
8 // Test logic
9 assert_ok!(Pallet::my_function(Origin::signed(1)));
10 });
11 }
12}
Related Snippets
- Bitcoin (Nakamoto) Consensus Interview Questions
Bitcoin consensus algorithm interview questions covering Proof-of-Work (PoW) and … - Byzantine Fault Tolerance (BFT) Consensus Interview Questions
Byzantine Fault Tolerance (BFT) consensus algorithm interview questions covering … - Cardano Interview Questions - Easy
Easy-level Cardano interview questions covering blockchain basics, Plutus, and … - Cardano Interview Questions - Hard
Hard-level Cardano interview questions covering advanced optimization and formal … - Cardano Interview Questions - Medium
Medium-level Cardano interview questions covering advanced Plutus development … - Consensus Algorithms Comparison Interview Questions
Consensus algorithm comparison and general implementation interview questions. … - Cosmos Chain Operations Interview Questions - Easy
Easy-level Cosmos chain operation interview questions covering chain operations, … - Cosmos Chain Operations Interview Questions - Hard
Hard-level Cosmos chain operation questions covering advanced algorithms, … - Cosmos Chain Operations Interview Questions - Medium
Medium-level Cosmos chain operation questions covering advanced chain … - Cosmos SDK Interview Questions - Easy
Easy-level Cosmos SDK interview questions covering chain code, SDK basics, and … - Cosmos SDK Interview Questions - Hard
Hard-level Cosmos SDK interview questions covering advanced SDK internals, … - Cosmos SDK Interview Questions - Medium
Medium-level Cosmos SDK interview questions covering advanced module … - Ethereum Proof-of-Stake Consensus Interview Questions
Ethereum Proof-of-Stake consensus algorithm interview questions covering Casper … - Ouroboros (Cardano) Consensus Interview Questions
Ouroboros consensus algorithm interview questions covering Cardano's … - Paxos Consensus Interview Questions
Paxos consensus algorithm interview questions covering the classic distributed … - Polkadot (NPoS) Consensus Interview Questions
Polkadot consensus algorithm interview questions covering Nominated … - Polkadot Interview Questions - Hard
Hard-level Polkadot interview questions covering advanced optimization and … - Polkadot Interview Questions - Medium
Medium-level Polkadot interview questions covering advanced Substrate … - Solana Interview Questions - Easy
Easy-level Solana interview questions covering blockchain basics, programs, and … - Solana Interview Questions - Hard
Hard-level Solana interview questions covering advanced optimization, security, … - Solana Interview Questions - Medium
Medium-level Solana interview questions covering advanced program development, … - Solana Proof of History Consensus Interview Questions
Solana consensus algorithm interview questions covering Proof of History (PoH) … - Tendermint Consensus Interview Questions
Tendermint consensus algorithm interview questions covering the Byzantine Fault … - Web3 Interview Questions - Easy
Easy-level Web3 interview questions covering blockchain fundamentals, Ethereum, … - Web3 Interview Questions - Hard
Hard-level Web3 interview questions covering MEV, zero-knowledge proofs, … - Web3 Interview Questions - Medium
Medium-level Web3 interview questions covering DeFi, advanced Solidity, …