Skip to content

Instantly share code, notes, and snippets.

View shawntabrizi's full-sized avatar

Shawn Tabrizi shawntabrizi

View GitHub Profile
@shawntabrizi
shawntabrizi / paid-resources-spec.md
Created September 28, 2026 14:12
Statement grants and paid capacity: specification (individuality-community)

Statement grants and paid capacity: specification

Specification for the issue "Paid resource consumption: a paid door beside every personhood door" in paritytech/individuality-community. Targets pallet-resources in paritytech/individuality-community (origin/main e3b35e0087) and, in §11, pallet-bulletin-transaction-storage in paritytech/polkadot-bulletin-chain (main 71c75c62). SDK facts are from polkadot-sdk master a92f928a64c3. Revised 2026-09-25 after an independent code review.

Terms. Node key: the raw storage value ":statement_allowance:" ++ account that the statement store reads (sp_statement_store::statement_allowance_key). Grant: one recorded statement allowance on one account. Lease: a grant with an expiry. Permanent grant: a grant without one. Bundle: LitePersonStatementLimit, {50, 500 KiB} on Paseo. Day: T::Clock::now().as_secs() / 86_400, the same unit as stmt_store_period_from_timestamp (lib.rs:1517).

1. Summary

Every account-level statemen

@shawntabrizi
shawntabrizi / index.html
Last active October 7, 2024 21:00
Play with PAPI
<!doctype html>
<html lang="en">
<head>
<title>Play with PAPI</title>
</head>
<body>
<h1>Play with PAPI (<a href="https://github.com/polkadot-api/polkadot-api">The Polkadot API</a>)</h1>
<pre id="chainInfo">Loading...</pre>
@shawntabrizi
shawntabrizi / index.html
Created September 11, 2024 20:19
Polkadot SDK Balance
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Polkadot Balance Fetcher</title>
<style>
body {
font-family: Arial, sans-serif;
@shawntabrizi
shawntabrizi / export_history.sh
Last active November 19, 2023 16:50
Export each historical commit of a repo into a separate folder.
#!/bin/bash
# Name of the folder where files will be copied for each commit
output_folder="commit_files"
# Create the output folder if it doesn't exist
mkdir -p $output_folder
# Counter for incrementing folder names
counter=1
@shawntabrizi
shawntabrizi / index.html
Created June 16, 2022 17:12
the most simple polkadot js api example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="//unpkg.com/@polkadot/util/bundle-polkadot-util.js"></script>
<script src="//unpkg.com/@polkadot/util-crypto/bundle-polkadot-util-crypto.js"></script>
<script src="//unpkg.com/@polkadot/types/bundle-polkadot-types.js"></script>
<script src="//unpkg.com/@polkadot/api/bundle-polkadot-api.js"></script>
<script type="text/javascript">
@shawntabrizi
shawntabrizi / index.js
Created June 20, 2021 23:49
Get Parachain Wasm Size
var { ApiPromise, WsProvider } = require('@polkadot/api');
// Main function which needs to run at start
async function main() {
const provider = new WsProvider('wss://kusama-rpc.polkadot.io/');
const api = await ApiPromise.create({ provider });
// Get general information about the node we are connected to
const [chain, nodeName, nodeVersion] = await Promise.all([
@shawntabrizi
shawntabrizi / kusama.js
Last active November 7, 2021 09:03
unlocking data on substrate
var { ApiPromise, WsProvider } = require('@polkadot/api');
var { BN_ZERO } = require('@polkadot/util');
async function main() {
const provider = new WsProvider("wss://kusama-rpc.polkadot.io/", false);
provider.connect();
const api = await ApiPromise.create({ provider });
// Get general information about the node we are connected to
const [chain, nodeName, nodeVersion] = await Promise.all([
/// A runtime module template with necessary imports
/// Feel free to remove or edit this file as needed.
/// If you change the name of this file, make sure to update its references in runtime/src/lib.rs
/// If you remove this file, you can remove those references
/// For more guidance on Substrate modules, see the example module
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs
fio --randrepeat=1 --ioengine=posixaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75
######################################
+++ Winner Validators:
#1 == W3F-012 [578e1d3e796c1df204ceb0dd0841b28df59ca81b1e49e0c81e08da11eb088158 (EZ7uBY7Z...)]
[stake_total: 26827_KSM (26,827,164,243,973,954)] [vote_count: 5] [ctrl: Some(1e4c6490abbc74684fa6a32b771a6ace358279948b2655685236679ea8d1af67 (DG3eXF79...))]
#2 == cp287-cloudwalk [30599dba50b5f3ba0b36f856a761eb3c0aee61e830d4beb448ef94b6ad92be39 (DfiSM1qq...)]
[stake_total: 22056_KSM (22,056,129,553,895,962)] [vote_count: 15] [ctrl: Some(30599dba50b5f3ba0b36f856a761eb3c0aee61e830d4beb448ef94b6ad92be39 (DfiSM1qq...))]
#3 == W3F-020 [9ee6f9ef5cb4d24b3519c7efca31a60dc27c215100014e50f8871feb381aebba (GAfhRsNq...)]