Skip to content

Latest commit

 

History

History
154 lines (98 loc) · 5.98 KB

README.md

File metadata and controls

154 lines (98 loc) · 5.98 KB

The Polkadot handbook.

Welcome. This is EasyA's legendary handbook. If you want to learn Polkadot like a legend, then you're in the right place.

Purpose

This handbook serves as a guide to the Polkadot ecosystem, geared towards those just joining for the first time. It isn't just a beginners' handbook; it's a legendary handbook. Even if you've already immersed yourself in the ecosystem, you'll find tons of helpful tidbits around here!

The EasyA App

Of course, the best place to start is always the EasyA app! Download it here for the fastest and most fun way to learn about Polkadot. Download it directly right here!

Table of Contents

Introduction

What is Polkadot:

  • Polkadot Overview - Official website providing a comprehensive introduction to Polkadot's multi-chain network and its vision for Web3.

Getting Started

The no-fluff starter:

  • Polkadot Wiki - Comprehensive documentation covering all aspects of Polkadot, from basic concepts to advanced topics.
  • Polkadot-JS Apps - A user interface for interacting with Polkadot and Substrate based chains.
  • Substrate Developer Hub - Resources for building parachains and connecting to Polkadot using the Substrate framework.

Core Concepts

Explanation of fundamental concepts in the Polkadot ecosystem:

Development Tools

Key tools and environments for Polkadot:

  • Substrate - Blockchain development framework used to build parachains for Polkadot.
  • Polkadot-JS API - JavaScript library for interacting with Polkadot nodes.

Smart Contracts

How to write and deploy smart contracts on Polkadot:

  • ink! - Rust-based smart contract language for Substrate chains in the Polkadot ecosystem.

Technically you can't (yet, see Plaza developments) deploy smart contracts on Polkadot directly. You need to deploy onto a parachain that supports smart contract execution (e.g. Astar, Acala, Moonbeam etc). Some of those parachains (e.g. Astar, Moonbeam) support EVM smart contracts, so you can also write them in Solidity (no ink! needed).

Polkadot Network

Going into the network level:

  • Telemetry - Real-time visualization of nodes on the Polkadot network.
  • Subscan - Multi-network explorer for Substrate-based chains, including Polkadot.

Ecosystem Projects

Cool projects built on Polkadot:

  • Acala - DeFi hub for Polkadot.
  • Astar - EVM and WASM smart contracts execution parachain on Polkadot.
  • Moonbeam - Ethereum-compatible smart contract parachain on Polkadot.

...and of course many more - check them out in the EasyA app!

Resources

Extra stuff:

  • Polkadot Blog - Official blog with updates, insights, and deep dives into Polkadot and ecosystem.
  • Polkadot SDK GitHub - Official GitHub repository for Polkadot SDK.

Handy Code Snippets

Get a taste of Polkadot development with these code snippets:

Subscribing to blocks

import { ApiPromise } from '@polkadot/api';

// initialise via static create
const api = await ApiPromise.create();

// make a call to retrieve the current network head
api.rpc.chain.subscribeNewHeads((header) => {
  console.log(`Chain is at #${header.number}`);
});

Making a transfer

// Import the API, Keyring and some utility functions
const { ApiPromise } = require('@polkadot/api');
const { Keyring } = require('@polkadot/keyring');

const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';

async function main () {
  // Instantiate the API
  const api = await ApiPromise.create();

  // Construct the keyring after the API (crypto has an async init)
  const keyring = new Keyring({ type: 'sr25519' });

  // Add Alice to our keyring with a hard-derivation path (empty phrase, so uses dev)
  const alice = keyring.addFromUri('//Alice');

  // Create a extrinsic, transferring 12345 units to Bob
  const transfer = api.tx.balances.transferAllowDeath(BOB, 12345);

  // Sign and send the transaction using our account
  const hash = await transfer.signAndSend(alice);

  console.log('Transfer sent with hash', hash.toHex());
}

main().catch(console.error).finally(() => process.exit());

These examples showcase:

  1. How to connect to subscribe to blocks.
  2. How to make transfers.

Contributing

We welcome contributions to make this handbook even more legendary! Here's how you can contribute:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/amazing-addition)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add some amazing feature')
  5. Push to the branch (git push origin feature/amazing-addition)
  6. Create a new Pull Request

Please ensure your contributions align with our code of conduct and contribution guidelines.

Credit/Inspiration

This handbook was inspired by the famous awesome lists by sindresorhus and the Awesome Polkadot list. We need awesome lists for Web3 ecosystems, with more of a hacker's guide to how they work. This is the answer to that need.