Skip to content

Instantly share code, notes, and snippets.

View kianenigma's full-sized avatar
🦀

Kian Paimani kianenigma

🦀
View GitHub Profile
// rought file paths writte above each item.
// pallet-balances::weights.rs
trait WieghtInfo {
fn transfer() -> u32;
}
// pallet-balances
trait Config {
type WeightInfo: weights::WeightInfo;
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
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 November 2, 2021 11:56
Simple script to see the status of an account in bags-list. Just paste this in Polkadot JS App's Javascript page.
// 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 October 5, 2022 00:58
Polkadot's Monthly Staking Update

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:

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 January 13, 2021 14:45
slot-backtrace
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
@kianenigma
kianenigma / polkadot-refund.txt
Last active November 25, 2020 11:57
polkadot-refund
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)
@kianenigma
kianenigma / kusama-refund.log
Last active October 5, 2022 01:01
Kusama Refund
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
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