mx-core
Core utilities shared across MultiversX Rust services.
Features
- Wallet Derivation: BIP39 mnemonic to Ed25519 signing keys
- Shard Computation: Matching mx-chain-go algorithm
- Address Encoding: Bech32 encode/decode utilities
- BigIntCaster Helpers: Go-compatible big integer encode/decode plus unsigned amount parsing
- Topic System: P2P gossipsub topic generation and parsing
- Protocol Constants: Centralized network constants
Usage
use ;
// Derive wallet from mnemonic
let key = derive_signing_key?;
let address = derive_address?;
// Compute shard (multiple methods)
let shard = shard_of?;
let shard = shard_of_address_bytes;
let shard = select_shard;
// Parse topic (with caching for hot paths)
let info = parse;
let info = parse_cached; // cached version
Modules
| Module | Description |
|---|---|
wallet |
Ed25519 key derivation from BIP39 mnemonics |
shard |
Shard computation matching mx-chain-go |
bech32_utils |
Address encoding/decoding |
bigint |
Go BigIntCaster helpers and unsigned amount parsing |
topics |
P2P topic generation and parsing |
constants |
Protocol constants |
encoding |
Base64/hex utilities |
mnemonic |
Mnemonic normalization |
Performance
shard_of_address_bytes: ~30ns (pre-decoded)shard_of: ~530ns (includes bech32 decode)- Topic parsing: Cached for hot paths