Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Kian Paimani kianenigma

🦀
View GitHub Profile
View nicks-fix.ts
import { ApiPromise, WsProvider } from "@polkadot/api";
import axios from "axios";
import { writeFileSync } from "fs";
import { strict as assert } from 'assert'
async function findLastNicksBlock(block: number, key: string) {
while (true) {
let next = block + 1;
const data = await axios.post(`https://kusama.api.subscan.io/api/scan/block`, {
"block_num": next
View council-fix.ts
import { ApiPromise, WsProvider } from "@polkadot/api";
import { BN } from "@polkadot/util";
import axios from "axios";
async function scrapeSubscan(api: ApiPromise) {
const [from, to] = [3899547, 4876134];
const DOTS = new BN(10000000000);
const HUNDRED = new BN(100);
const REFUND = new BN(new BN(495).mul(DOTS).div(HUNDRED))
const key = process.env['API'] || "DEFAULT_KEY";
@kianenigma
kianenigma / bags.rs
Created Nov 2, 2021
Simple script to see the status of an account in bags-list. Just paste this in Polkadot JS App's Javascript page.
View bags.rs
// This must be a STASH account.
const yourAccount = "xxx";
// This is your node in the bags list. Use `node.prev` and `.next` to see where you are located.
const node = await api.query.bagsList.listNodes(yourAccount);
// This is the bag to which you belong.
const bagUpper = api.createType("Balance", node.toJSON().bagUpper);
// This is the list of all the bags.
const bagThresholds = api.consts.bagsList.bagThresholds.map((x) => api.createType('Balance', x));
//
// This function will always indicate that for an account with stake (aka, weight) `w`, to which bag they belong to.
@kianenigma
kianenigma / staking-updates.md
Last active Jul 4, 2022
Polkadot's Monthly Staking Update
View staking-updates.md

DEPRECATED: Polkadot Staking Progress Report

I started this gist as an index for all of the staking reports. Almost a year in, we migrated everything to https://polkadot.network/tag/staking-updates/. This page will no longer be updated:

Prelude

Polkadot's staking system is among the most complicated in the blockchain ecosystem. The relay chain's validator set is securing not just the state transition of the relay chain itself, but also a potentially large number of parallel chains, or parachains for short. Since security is its main goal, Polkadot has been designed with a complicated, and strict staking system, optimized for locking the most amount of tokens at stake while spreading that stake as evenly as possible to maximize decentralization - all with the goal of effectively minimizing the possibility of the validator set becoming compromised. Read more about this here, or watch [this](https://www

View gist:58dc80ccfb5dcfb78f780f0efe2d9ccc
1 kianenigma@build-host[13:46] ~/substrate-sync (git)-[2ef0f1cb2] % cargo run -- --tmp --dev :(
Finished dev [unoptimized + debuginfo] target(s) in 0.62s
Running `target/debug/substrate --tmp --dev`
2021-01-13 13:47:34 Running in --dev mode, RPC CORS has been disabled.
2021-01-13 13:47:34 Substrate Node
2021-01-13 13:47:34 ✌️ version 2.0.0-2ef0f1cb2-x86_64-linux-gnu
2021-01-13 13:47:34 ❤️ by Parity Technologies <admin@parity.io>, 2017-2021
2021-01-13 13:47:34 📋 Chain specification: Development
2021-01-13 13:47:34 🏷 Node name: raspy-wealth-5222
2021-01-13 13:47:34 👤 Role: AUTHORITY
@kianenigma
kianenigma / slot
Created Jan 13, 2021
slot-backtrace
View slot
1 kianenigma@build-host[13:46] ~/substrate-sync (git)-[2ef0f1cb2] % cargo run -- --tmp --dev :(
Finished dev [unoptimized + debuginfo] target(s) in 0.62s
Running `target/debug/substrate --tmp --dev`
2021-01-13 13:46:42 Running in --dev mode, RPC CORS has been disabled.
2021-01-13 13:46:42 Substrate Node
2021-01-13 13:46:42 ✌️ version 2.0.0-2ef0f1cb2-x86_64-linux-gnu
2021-01-13 13:46:42 ❤️ by Parity Technologies <admin@parity.io>, 2017-2021
2021-01-13 13:46:42 📋 Chain specification: Development
2021-01-13 13:46:42 🏷 Node name: quizzical-belief-8596
2021-01-13 13:46:42 👤 Role: AUTHORITY
View polkadot-refund.txt
who,role,identity,effective_slash_planck,effective_slash_token
1WG3jyNqniQMRZGQUc7QD2kVLT8hkRPGMSqAb5XYQM1UDxN,RunnerUp,DokiaCapital,1252580000000,1.2525 DOT (old)
1dGsgLgFez7gt5WjX2FYzNCJtaCjGG6W9dA42d9cHngDYGg,RunnerUp,0x447261676f6e5374616b6520f09f90b2,1607240000000,1.6072 DOT (old)
1hJdgnAPSjfuHZFHzcorPnFvekSHihK9jdNPWHXgeuL7zaJ,RunnerUp,Listen,1252580000000,1.2525 DOT (old)
1rwgen2jqJNNg7DpUA4jBvMjyepgiFKLLm3Bwt8pKQYP8Xf,RunnerUp,Chevdor,1252580000000,1.2525 DOT (old)
12Vv2LsLCvPKiXdoVGa3QSs2FMF8zx2c8CPTWwLAwfYSFVS1,RunnerUp,Polkascan Foundation,4252580000000,4.2525 DOT (old)
12mP4sjCfKbDyMRAEyLpkeHeoYtS5USY4x34n9NMwQrcEyoh,Members,polkaworld,1202580000000,1.2025 DOT (old)
13pdp6ALhYkfEBqBM98ztL2Xhv4MTkm9rZ9vyjyXSdirJHx6,RunnerUp,Cryptium Labs,2806820000000,2.8068 DOT (old)
15akrup6APpRegG1TtWkYVuWHYc37tJ8XPN61vCuHQUi65Mx,RunnerUp,akru,1407820000000,1.4078 DOT (old)
12Y8b4C9ar162cBgycxYgxxHG7cLVs8gre9Y5xeMjW3izqer,Members,Acala Foundation,1202910000000,1.2029 DOT (old)
View kusama-refund.log
who,role,identity,effective_slash_planck,effective_slash_token
CanLB42xJughpTRC1vXStUryjWYkE679emign1af47QnAQC,None,undefined,1060000000000,1.0600 KSM
CcKPhXSyZgATZD1wVaRsSk81UfLcQvyuuS2i9FNhsoeQeWr,None,undefined,1060000000000,1.0600 KSM
CdEm1ErGKML3waXabLvn3NyqdAGXBQJVngLaM86YM5Yb9dr,None,undefined,1060000000000,1.0600 KSM
DMF8a34emwapz9mV5P5PTDcghh1ZR3miH9ad9mHzfAUMSXU,Members,Al scientist w3f,1176666666666,1.1766 KSM
DTLcUu92NoQw4gg6VmNgXeYQiNywDhfYMQBPYg2Y1W6AkJF,None,federico,1060000000000,1.0600 KSM
DaCSCEQBRmMaBLRQQ5y7swdtfRzjcsewVgCCmngeigwLiax,RunnerUp,POLKAWORLD,12060000000000,12.0600 KSM
DfiSM1qqP11ECaekbA64L2ENcsWEpGk8df8wf1LAfV2sBd4,None,CP287-CLOUDWALK,4060000000000,4.0600 KSM
ET9SkhNZhY7KT474vkCEJtAjbgJdaqAGW4beeeUJyDQ3SnA,None,undefined,2060000000000,2.0600 KSM
FcxNWVy5RESDsErjwyZmPCW6Z8Y3fbfLzmou34YZTrbcraL,Members,0xf09f8dba2047617620f09fa583,3010000000000,3.0100 KSM
View polkadot-sync-log
2020-08-12 13:47:38.946 tokio-runtime-worker ERROR runtime panicked at 'Signature verification failed.', /rustc/d7f94516345a36ddfcd68cbdf1df835d356795c3/src/libcore/macros/mod.rs:10:9
2020-08-12 13:47:38.947 tokio-runtime-worker WARN sc_service::client::client Block prepare storage changes error:
Execution(Other("Wasm execution trapped: wasm trap: unreachable\nwasm backtrace:\n 0: 0x2134 - <unknown>!rust_begin_unwind\n 1: 0x1da2 - <unknown>!core::panicking::panic_fmt::hc25d2b1c8c5e1365\n 2: 0x14f3 - <unknown>!core::panicking::panic::h8043ae54867c461e\n 3: 0x1afa82 - <unknown>!Core_execute_block\n"))
2020-08-12 13:47:38.947 tokio-runtime-worker WARN sync 💔 Error importing block 0x8993d7eed39c484ae0481a43755a5fe6552da3a93c2fb2192c73fed94dfd212c: Err(Other(ClientImport("Import failed: Execution: Wasm execution trapped: wasm trap: unreachable\nwasm backtrace:\n 0: 0x2134 - <unknown>!rust_begin_unwind\n 1: 0x1da2 - <unknown>!core::panicking::panic_fmt::hc25d2b1c8c5e1365\n 2: 0x14f3 - <unknown>!core::pani
@kianenigma
kianenigma / kusama-dump
Created Aug 5, 2020
Kusama state size dump 5/8/2020
View kusama-dump
20 M ├─┬ kusama
16 M │ │─┬ Staking
6 M │ │ │─ ErasStakersClipped => Map(7,074,085 bytes, 34498 keys)
6 M │ │ │─ ErasStakers => Map(7,074,085 bytes, 34498 keys)
1 M │ │ │─ ErasRewardPoints => Map(1,223,388 bytes, 84 keys)
946 K │ │ │─ Ledger => Map(969,138 bytes, 3345 keys)
675 K │ │ │─ Nominators => Map(691,744 bytes, 1904 keys)
129 K │ │ │─ ErasValidatorPrefs => Map(132,652 bytes, 34498 keys)
104 K │ │ │─ Bonded => Map(107,040 bytes, 3345 keys)
50 K │ │ │─ SpanSlash => Map(51,744 bytes, 1617 keys)