substrate-js-utils
A set of useful JavaScript utilities for Substrate that uses the Polkadot{JS} API; Also deployed as a website.
Substrate JS Utilities
A collection of browser-based utilities for working with Substrate and Polkadot data. No build step required — just static HTML and JavaScript.
Live site: shawntabrizi.com/substrate-js-utilities
Utilities
Main Page
- String to Hex — Bidirectional string/hex conversion
- Balance to Hex — Number to little-endian hex conversion
- AccountId to Hex — SS58 address to raw hex bytes
- Blake2 Hash — Blake2b hashing with configurable bit length
- Blake2 Concat — Blake2b hash concatenated with input
- XXHash — TwoX hashing with configurable bit length
- XXHash Concat — TwoX hash concatenated with input
- Seed to Address — Generate SS58 address from a seed phrase
- Change Address Prefix — Convert addresses between network prefixes
- Module ID to Address — Convert a pallet ID to its sovereign account
- Pallet ID Sub-Account — Derive pallet sub-accounts from a pallet ID and index
- Para ID to Address — Derive parachain sovereign accounts (child or sibling)
- Sub-Account Generator — Derive Utility pallet sub-accounts
- Ethereum to Substrate Address — Bidirectional ETH/Substrate address conversion
- u8a Array to Hex — Convert byte arrays to hex and back
- Number to Hex — Configurable bit length, endianness, and SCALE compact encoding
Additional Pages
- SCALE Decoder — Decode raw SCALE-encoded hex bytes with custom type definitions
- Query Indices — Batch query account indices from a live chain
- Network Versions — Query runtime versions across multiple networks
- Query Nominations — View staking nominations and estimate rewards
- Event Counter — Count and graph blockchain events across block ranges
Development
No build step needed. The site runs as static files with dependencies loaded via CDN.
Running Tests
npm install
npm test
Tests use Node's built-in test runner and cover all utility logic (SCALE encoding/decoding, address derivation, hashing, conversions, etc.).