Skip to main content

Crate kobe_casper

Crate kobe_casper 

Source
Expand description

Casper Network wallet utilities for Kobe.

Offline HD derivation for CSPR (SLIP-44 coin type 506) with dual signature algorithms:

AlgorithmDefault pathCurveKobe primitive
KeyAlgo::Secp256k1 (default)m/44'/506'/0'/0/{i}secp256k1BIP-32
KeyAlgo::Ed25519m/44'/506'/0'/0'/{i}'Ed25519SLIP-10

§Address encoding

The primary DerivedAccount::address is the Casper AccountHash display form account-hash- + 64 lowercase hex digits.

Per casper-types AccountHash::from_public_key, the BLAKE2b-256 preimage is not the tag-prefixed public-key serialization. It is:

algorithm_name_ascii || 0x00 || raw_public_key_bytes

where algorithm_name is the lowercase ASCII string "secp256k1" or "ed25519", and raw_public_key_bytes is the 33-byte compressed SEC1 secp256k1 key or the 32-byte Ed25519 key (no algorithm tag byte).

The algorithm-tagged public-key hex used in Casper serialization / CEP-57 contexts (0x01 ‖ ed25519 or 0x02 ‖ secp compressed) is exposed separately on CasperAccount::tagged_public_key_hex.

§Example

use kobe_casper::{Deriver, KeyAlgo};
use kobe_primitives::{Derive, Wallet};

let wallet = Wallet::from_mnemonic(
    "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
    None,
)?;
let account = Deriver::new(&wallet).derive(0)?;
assert!(account.address().starts_with("account-hash-"));
assert_eq!(account.algo(), KeyAlgo::Secp256k1);

Structs§

CasperAccount
A Casper-specific derived account.
DerivedAccount
A derived HD account — unified across all chains.
Deriver
Casper address deriver from a unified wallet seed.
ParseDerivationStyleError
Error returned when FromStr fails on a chain’s DerivationStyle.

Enums§

DeriveError
Errors produced by HD derivation, mnemonic handling, and address encoding.
DerivedPublicKey
Strongly typed public key emitted by an HD derivation.
KeyAlgo
Signature algorithm and matching HD path layout for Casper.

Constants§

ACCOUNT_HASH_PREFIX
Prefix applied to the hex-encoded AccountHash for display.
ED25519_TAG
Casper serialization tag for Ed25519 public keys (PublicKey::Ed25519).
SECP256K1_TAG
Casper serialization tag for secp256k1 public keys (PublicKey::Secp256k1).

Functions§

account_hash_ed25519
Compute the Casper AccountHash for an Ed25519 public key.
account_hash_secp256k1
Compute the Casper AccountHash for a compressed secp256k1 public key.
format_account_hash
Format a 32-byte AccountHash digest as account-hash- + lowercase hex.
tagged_public_key_hex
Tagged public-key hex (no 0x prefix): 01 ‖ ed25519 or 02 ‖ secp.