Bip32Ed25519

scalus.cardano.wallet.hd.Bip32Ed25519
object Bip32Ed25519

BIP32-Ed25519 key derivation for Cardano (Icarus-style).

Implements the BIP32-Ed25519 specification as used by Cardano wallets, supporting both hardened and non-hardened child key derivation.

Key differences from SLIP-0010:

  • Extended keys are 96 bytes (64-byte secret + 32-byte chain code)
  • Non-hardened derivation is supported using the public key
  • Key clamping is applied to make Ed25519 keys valid BIP32 keys

Attributes

See also
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class ExtendedKey(kL: Array[Byte], kR: Array[Byte], chainCode: Array[Byte])

Extended key containing private key components and chain code.

Extended key containing private key components and chain code.

Value parameters

chainCode

Chain code for derivation (32 bytes)

kL

Left half of extended secret key (32 bytes, clamped scalar)

kR

Right half of extended secret key (32 bytes)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def deriveFromPath(mnemonic: String, passphrase: String, path: String): ExtendedKey

Derive a key from a path string.

Derive a key from a path string.

Path format: "m/purpose'/coin_type'/account'/role/index"

Value parameters

mnemonic

BIP-39 mnemonic

passphrase

Optional passphrase

path

Derivation path

Attributes

Returns

Derived extended key

def masterKeyFromEntropy(entropy: Array[Byte], passphrase: String = ...): ExtendedKey

Generate master key from BIP-39 entropy using Icarus-style derivation.

Generate master key from BIP-39 entropy using Icarus-style derivation.

Uses PBKDF2-HMAC-SHA512 with:

  • Password: passphrase (empty string if none)
  • Salt: raw entropy bytes from mnemonic
  • Iterations: 4096
  • Output: 96 bytes

Note: This differs from standard BIP-39 seed derivation which uses the mnemonic words as password and "mnemonic" + passphrase as salt.

Value parameters

entropy

BIP-39 entropy (typically 16-32 bytes)

passphrase

Optional passphrase (empty string if none)

Attributes

Returns

Master extended key

def masterKeyFromMnemonic(mnemonic: String, passphrase: String = ...): ExtendedKey

Generate master key from BIP-39 mnemonic using Icarus-style derivation.

Generate master key from BIP-39 mnemonic using Icarus-style derivation.

Value parameters

mnemonic

BIP-39 mnemonic sentence

passphrase

Optional passphrase

Attributes

Returns

Master extended key

def parsePath(path: String): Seq[Int]

Parse a derivation path string into indices.

Parse a derivation path string into indices.

Value parameters

path

Path like "m/1852'/1815'/0'/0/0"

Attributes

Returns

Sequence of indices (hardened indices have high bit set)

Throws
IllegalArgumentException

if path is malformed