foxchain-id
Multi-chain blockchain address identification library for Rust.
Overview
foxchain-id provides functionality to identify which blockchain(s) an input string (address, public key, or private key) belongs to. It supports multiple blockchain address formats and returns normalized addresses with confidence scores for candidate chains.
Features
- Multi-chain support: Identify addresses across multiple blockchain networks
- Address normalization: Convert addresses to their canonical format
- Confidence scoring: Get confidence scores for each candidate chain
- Format detection: Automatically detect address format (EVM, Bitcoin, Solana, etc.)
- EIP-55 checksum validation: Validate and normalize EVM addresses according to EIP-55
- Public key detection: Detect public keys in various formats (hex, base58, bech32)
- Address derivation: Derive addresses from public keys for supported chains
Quick Start
use identify;
Supported Formats
Currently Implemented
-
EVM Addresses (Ethereum, Polygon, BSC, Avalanche, Arbitrum, Optimism, Base, Fantom, Celo, Gnosis)
- Format:
0xfollowed by 40 hex characters - EIP-55 checksum validation and normalization
- See EVM Addresses Documentation for details
- Format:
-
Bitcoin Ecosystem (Bitcoin, Litecoin, Dogecoin)
- P2PKH addresses (legacy, starts with
1) - P2SH addresses (script hash, starts with
3) - Bech32 addresses (native SegWit, starts with
bc1/ltc1/etc.) - Base58Check validation for P2PKH and P2SH
- Bech32 validation for native SegWit
- See Bitcoin Addresses Documentation for details
- P2PKH addresses (legacy, starts with
-
Solana Addresses
- Base58 encoding (32-44 bytes when decoded)
- Length validation (standard 32 bytes, up to 44 bytes)
- Prefix filtering to avoid conflicts with other chains
- See Solana Addresses Documentation for details
-
Tron Addresses
- Base58Check encoding (starts with T)
- Version byte validation (0x41 for mainnet)
- Length validation (25 bytes when decoded)
- Base58Check checksum validation
- See Tron Addresses Documentation for details
-
Cosmos Ecosystem Addresses (Cosmos Hub, Osmosis, Juno, Akash, Stargaze, Secret Network, Terra, Kava, Regen, Sentinel)
- Bech32 encoding with HRP (Human Readable Part) prefixes
- Chain identification from HRP
- Bech32 validation and checksum verification
- Case-insensitive normalization
- See Cosmos Addresses Documentation for details
-
Substrate/Polkadot Ecosystem Addresses (Polkadot, Kusama, Generic Substrate)
- SS58 encoding (Base58 with chain-specific prefixes)
- Chain identification from SS58 prefix
- SS58 structure validation
- Account ID extraction (32 bytes)
- See Substrate Addresses Documentation for details
-
Cardano Addresses
- Bech32 encoding with HRP (Human Readable Part) prefixes
- Support for mainnet (addr, stake) and testnet (addr_test, stake_test) addresses
- Bech32 validation and checksum verification
- Case-insensitive normalization
-
Public Key Detection and Address Derivation
- Hex public key detection (compressed/uncompressed secp256k1, Ed25519)
- Base58 public key detection
- Bech32 public key detection
- EVM address derivation from secp256k1 public keys
- Bitcoin address derivation from secp256k1 public keys (P2PKH)
- Solana address derivation from Ed25519 public keys
- Cosmos address derivation from Ed25519 public keys
Planned
- TON, Algorand, Near, and more...
See Format Documentation for detailed information about each format.
Usage
Basic Identification
use identify;
let result = identify?;
// Get normalized address
let normalized = result.normalized;
// Get all candidate chains
for candidate in result
Working with Results
use identify;
let result = identify?;
// Find specific chain
if let Some = result.iter.find
// Get highest confidence candidate
let best_match = result.iter
.max_by;
Documentation
- Format Documentation - Detailed documentation for each address format
- API Documentation - Full API reference (when published)
Contributing
Contributions are welcome! Please see the main project repository for contribution guidelines.
License
This project is licensed under the GPL-3.0 license.