Skip to content

Kobe

Crates.io Docs.rs CI License Rust

no_std-compatible Rust toolkit for multi-chain HD wallet derivation — one BIP-39 seed, thirteen networks, zero hand-written cryptography, cross-implementation KATs.

Kobe derives standards-compliant accounts and addresses for Aptos, Bitcoin, Ethereum, Solana, Cosmos, Tron, Sui, TON, Filecoin, Spark, XRP Ledger, Nostr (NIP-06 / NIP-19), and Casper from a single BIP-39 mnemonic. It layers thin wrappers around bip39, bip32, k256, and ed25519-dalek on top of a unified Wallet + Derive trait surface (Bitcoin address/WIF encoding is local in kobe-btc, not the full bitcoin crate); every library crate builds under no_std + alloc, mnemonics and private keys wrap in Zeroizing<T> and wipe on drop, and every chain's pipeline is pinned against independent reference implementations (bitcoinjs-lib, @ton/core, @noble/hashes, NIP-06 official vectors, ethanmarcuss/spark-address, casper-types AccountHash preimage, …).

See also signer — the companion transaction-signing toolkit that consumes kobe's derived accounts via Signer::from_derived.

Kobe CLI Demo

Quick Start

Install the CLI

Shell (macOS / Linux):

curl -fsSL https://sh.qntx.fun/kobe | sh

PowerShell (Windows):

irm https://sh.qntx.fun/kobe/ps | iex

Or via Cargo:

cargo install kobe-cli

CLI Usage

# Generate new wallets (default: 12-word English mnemonic, 1 account)
kobe btc    new                              # P2WPKH (Native SegWit), mainnet
kobe btc    new -a taproot -w 24 -c 5        # 5 Taproot addresses, 24-word mnemonic
kobe evm    new                              # Ethereum (MetaMask-compatible)
kobe evm    new --style ledger-live -c 3     # Ledger Live layout, 3 accounts
kobe svm    new                              # Solana (Phantom / Backpack / Solflare)
kobe cosmos new                              # Cosmos Hub (`cosmos1…`)
kobe aptos  new                              # Aptos
kobe sui    new                              # Sui
kobe casper new                              # Casper (CSPR)
kobe casper new --algo ed25519               # Casper Ed25519 path
kobe ton    new                              # TON wallet v5r1 (UQ… non-bounceable)
kobe ton    new --bounceable                 # TON bounceable (EQ…), smart-contract style
kobe ton    new --testnet --workchain -1     # TON testnet masterchain
kobe ton    new --style ledger-live          # TON Ledger Live path
kobe tron   new                              # Tron (base58check `T…`)
kobe fil    new                              # Filecoin (`f1…` secp256k1)
kobe spark  new                              # Spark (Bitcoin L2), bech32m `spark1…`
kobe spark  new --network testnet            # Spark testnet (`sparkt1…`)
kobe xrpl   new                              # XRP Ledger classic `r…`
kobe nostr  new                              # Nostr NIP-06 (`nsec` / `npub`, NIP-19)

# Import from an existing mnemonic
kobe evm    import -m "abandon abandon ... about"

# JSON output — stable, script- and agent-friendly
kobe evm    new --json

# Secrets (mnemonic / private keys) are hidden by default
kobe -r evm new                          # show mnemonic + private keys
kobe --json -r evm new                   # include them in JSON as well

# Self-upgrade (sh.qntx.fun install path; same as re-running the install script)
kobe upgrade                             # install latest if newer (`update` is an alias)
kobe upgrade --check                     # report only
kobe upgrade --force                     # reinstall even when up to date

# Import without putting the mnemonic in argv (preferred on shared hosts)
echo "abandon abandon ... about" | kobe -r evm import -m -

Every chain subcommand accepts the shared flags -w/--words, -c/--count, -p/--passphrase, and --qr through a flattened SimpleArgs group, so ergonomics stay consistent across the 13 networks. Global -r / --reveal opts into printing mnemonics and private keys (default: hidden).

Library Usage

use kobe::prelude::*;     // Wallet, Derive, DeriveExt, DerivationStyle trait, ...
use kobe::evm::Deriver;   // or kobe::btc, kobe::svm, kobe::cosmos, ...

// Import from mnemonic
let wallet = Wallet::from_mnemonic(
    "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
    None,  // optional passphrase
)?;

// Derive addresses (accessor methods — fields are private for zeroization safety)
let eth = kobe::evm::Deriver::new(&wallet).derive(0)?;
let btc = kobe::btc::Deriver::new(&wallet, kobe::btc::Network::Mainnet).derive(0)?;
let sol = kobe::svm::Deriver::new(&wallet).derive(0)?;

println!("ETH: {}", eth.address());  // 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
println!("BTC: {}", btc.address());  // bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu
println!("SOL: {}", sol.address());  // HAgk14JpMQLgt6rVgv7cBQFJWFto5Dqxi472uT3DKpqk

// Chain-specific extensions via newtypes: `BtcAccount` extends `DerivedAccount`
// with `private_key_wif()`, `address_type()`, `bip32_path()`; `SvmAccount`
// exposes `keypair_base58()`. Both `Deref` to the unified `DerivedAccount`.
println!("BTC WIF: {}", btc.private_key_wif().as_str());

String-path entry points are uniform across every chain. Bitcoin additionally exposes an explicit-type escape hatch for non-standard paths:

use kobe::btc::{AddressType, Deriver, Network};

let deriver = Deriver::new(&wallet, Network::Mainnet);
let p2wpkh = deriver.derive_at("m/84'/0'/0'/0/0")?;                    // infer type from purpose
let taproot = deriver.derive_at("m/86'/0'/0'/0/0")?;                   // infer type from purpose
let custom  = deriver.derive_at_with("m/7'/0'/0'/0/0", AddressType::P2tr)?; // non-standard purpose

DerivationStyle is a shared trait implemented by every chain's style enum. kobe::prelude::* brings it into scope so style.path(i) / style.name() work directly:

use kobe::prelude::*;
use kobe::evm::DerivationStyle;

let style: DerivationStyle = "ledger-live".parse()?;           // FromStr
assert_eq!(style.path(0), "m/44'/60'/0'/0/0");                 // trait method
for variant in <DerivationStyle as kobe::DerivationStyle>::all() {
    println!("{variant}: {}", variant.path(0));
}
// Generate new wallet
let wallet = Wallet::generate(12, None)?;  // 12-word mnemonic
println!("Mnemonic: {}", wallet.mnemonic());

Supported Chains

Chain Crate Curve BIP-44 coin Default path Address format
Bitcoin kobe-btc secp256k1 (BIP-32) 0 m/84'/0'/0'/0/{i} P2PKH / P2SH-P2WPKH / P2WPKH / P2TR
Ethereum kobe-evm secp256k1 (BIP-32) 60 m/44'/60'/0'/0/{i} EIP-55 0x…
Cosmos kobe-cosmos secp256k1 (BIP-32) 118 * m/44'/118'/0'/0/{i} Bech32 cosmos1… (HRP configurable)
Tron kobe-tron secp256k1 (BIP-32) 195 m/44'/195'/0'/0/{i} Base58Check T…
Filecoin kobe-fil secp256k1 (BIP-32) 461 m/44'/461'/0'/0/{i} Base32 f1…
Spark kobe-spark secp256k1 (BIP-32) 8797555 † m/8797555'/{i}'/0' Bech32m spark1… / sparkt1… / …
XRP Ledger kobe-xrpl secp256k1 (BIP-32) 144 m/44'/144'/0'/0/{i} Base58Check (XRPL alphabet) r…
Nostr kobe-nostr secp256k1 (BIP-340) 1237 m/44'/1237'/{i}'/0/0 NIP-19 npub1… / nsec1…
Solana kobe-svm Ed25519 (SLIP-10) 501 m/44'/501'/{i}'/0' Base58 + optional 64-byte keypair
Sui kobe-sui Ed25519 (SLIP-10) 784 m/44'/784'/{i}'/0'/0' 0x + hex(BLAKE2b-256(0x00 ‖ pubkey))
TON kobe-ton Ed25519 (SLIP-10) 607 m/44'/607'/{i}' wallet v5r1 (UQ… / EQ… / 0Q… / …)
Aptos kobe-aptos Ed25519 (SLIP-10) 637 m/44'/637'/{i}'/0'/0' 0x + hex(SHA3-256(pubkey ‖ 0x00))
Casper kobe-casper secp256k1 / Ed25519 506 m/44'/506'/0'/0/{i} account-hash- + BLAKE2b-256

* Cosmos coin type defaults to 118; Terra (330), Secret (529), Kava (459), and custom chains are selectable via ChainConfig. † Spark purpose 8797555 is Spark-specific (SHA-256("spark") truncated), not a BIP-44 assignment. ‡ Casper default is secp256k1 (Ledger); Ed25519 uses m/44'/506'/0'/0'/{i}'. AccountHash preimage is algorithm_name || 0x00 || raw_pubkey per casper-types.

Design

  • 13 chains — Aptos, Bitcoin, Ethereum, Solana, Cosmos, Tron, Sui, TON, Filecoin, Spark, XRP Ledger, Nostr, Casper — one BIP-39 seed
  • Mature crypto dependenciesbip39 for mnemonic ↔ entropy, bip32 + k256 for BIP-32 secp256k1 (via kobe-primitives), ed25519-dalek for SLIP-10 Ed25519; hashing via sha2 / sha3 / blake2 / ripemd; encoding via bech32 / bs58 (Bitcoin addresses/WIF implemented in-tree and KAT-pinned)
  • Unified derivation contract — shared Derive trait with an associated Account type + shared DerivationStyle trait; every chain has typed public keys via DerivedPublicKey, one shared DeriveError, and one shared ParseDerivationStyleError
  • Consistent entry pointsderive / derive_with / derive_at / derive_at_with across every chain (Bitcoin's structured path also available as derive_structured)
  • HD standards — BIP-32, BIP-39, BIP-44 / 49 / 84 / 86, SLIP-10, NIP-06, NIP-19
  • Derivation styles — Standard, Ledger Live, Ledger Legacy, Trust, Phantom, Backpack, Tonkeeper — with FromStr aliases and an accepted-token diagnostic on ParseDerivationStyleError
  • Cross-implementation KATs — every chain is pinned against independent references (bitcoinjs-lib, @ton/core, @noble/hashes, NIP-06 official vectors, ethanmarcuss/spark-address, BIP-84 / BIP-86 / EIP-55 / SLIP-10 test vectors) — no self-confirming dumps
  • no_std + alloc — every library crate compiles on thumbv7m-none-eabi under CI; embedded / WASM ready
  • Security hardened — mnemonics, seeds, private keys, WIFs, nsecs, and Solana keypairs wrapped in Zeroizing<T>; secret-bearing types redact in Debug; CLI hides secrets unless --reveal
  • Signer integrationsigner consumes every DerivedAccount / BtcAccount / SvmAccount / NostrAccount via Signer::from_derived behind its kobe feature flag
  • Strict linting — Clippy pedantic + nursery + correctness (deny), rust_2018_idioms deny, zero warnings on nightly

Crates

See crates/README.md for the full crate table, dependency graph, and feature flag reference.

Contributing

See CONTRIBUTING.md for development setup, the chain API contract, PR expectations, and the release checklist.

Security

This library has not been independently audited. Use at your own risk.

  • Mnemonics, seeds, and derived private keys wrapped in zeroize — wiped from memory on drop
  • Debug for Wallet, DerivedAccount, and chain secret newtypes redacts key material ([REDACTED]); do not rely on {:?} for secrets
  • Chain-specific secret encodings (BTC WIF, Nostr nsec, Solana 64-byte keypair) are wrapped in Zeroizing<String> / Zeroizing<[u8; N]>
  • CLI omits mnemonic and private keys unless --reveal is passed
  • Random generation uses the OS-provided CSPRNG via getrandom; Wallet::generate_in_with accepts a caller-supplied CryptoRng on embedded / WASM targets where OS entropy is unavailable
  • secp256k1 contexts are cached on Deriver to avoid the ~768 KB per-call setup cost
  • Environment-variable mutation and std::mem::{transmute, forget} are denied at the lint level
  • No key material is logged or persisted by the workspace

License

Licensed under either of:

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project shall be dual-licensed as above, without any additional terms or conditions.


A QuantX open-source project.

QuantX

Code is law. We write both.

About

A lightweight, no_std multi-chain HD wallet derivation library in Rust.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

160 stars

Watchers

5 watching

Forks

Releases

Sponsor this project

Contributors

Languages