4 releases
Uses new Rust 2024
| new 0.0.3 | Oct 9, 2025 |
|---|---|
| 0.0.2 | Aug 6, 2025 |
| 0.0.1 | Jun 14, 2025 |
| 0.0.0 | Oct 13, 2022 |
#18 in #32-byte
12KB
66 lines
ss58
A Rust library for SS58 address encoding and decoding, designed for no_std environments.
About
SS58 is the address format used by Substrate-based blockchains like Polkadot, Kusama, Vara, and others. This library provides:
- Encoding: Convert 32-byte public keys to SS58 addresses
- Decoding: Extract public keys from SS58 addresses
- Multiple formats: Support for Polkadot, Kusama, Substrate, Vara, and custom formats
Installation
Add to your Cargo.toml:
[dependencies]
ss58 = "0.0.3"
Usage
use ss58::{encode, decode, Ss58AddressFormat};
// Encode a public key to SS58 address
let pubkey = [0u8; 32]; // Your 32-byte public key
let address = encode(&pubkey, Ss58AddressFormat::Polkadot);
// Decode an SS58 address back to public key
let decoded_pubkey = decode(&address);
Supported Address Formats
Ss58AddressFormat::Polkadot(prefix 0)Ss58AddressFormat::Kusama(prefix 2)Ss58AddressFormat::Substrate(prefix 42)Ss58AddressFormat::Vara(prefix 137)Ss58AddressFormat::Custom(u16)(custom prefix)
Features
no_stdcompatible- Uses Blake2b for checksum hashing
- Base58 encoding with proper prefix handling
- Minimal dependencies
License
MIT
Dependencies
~8.5MB
~159K SLoC