Cip1852

scalus.cardano.wallet.hd.Cip1852
object Cip1852

CIP-1852 derivation paths for Cardano HD wallets.

CIP-1852 defines the hierarchical deterministic wallet structure for Cardano Shelley-era wallets. It follows the BIP-44 structure with Cardano-specific constants.

Path structure: m / purpose' / coin_type' / account' / role / index

  • purpose: 1852' (Cardano Shelley-era)
  • coin_type: 1815' (Cardano)
  • account: 0', 1', 2', ... (hardened)
  • role: 0 (external), 1 (internal/change), 2 (staking), 3 (DRep), 4 (CC cold), 5 (CC hot)
  • index: 0, 1, 2, ... (non-hardened)

Attributes

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

Members list

Value members

Concrete methods

def accountPath(account: Int): String

Build the derivation path for an account root key.

Build the derivation path for an account root key.

Path: m/1852'/1815'/account'

Value parameters

account

the account index (0, 1, 2, ...)

Attributes

Returns

the path string

def changePath(account: Int, index: Int): String

Build the derivation path for a change (internal) key.

Build the derivation path for a change (internal) key.

Path: m/1852'/1815'/account'/1/index

Value parameters

account

the account index

index

the address index

Attributes

Returns

the path string

def drepPath(account: Int, index: Int = ...): String

Build the derivation path for a DRep (governance) key (CIP-105).

Build the derivation path for a DRep (governance) key (CIP-105).

Path: m/1852'/1815'/account'/3/index

Note: CIP-105 recommends using only index 0 for DRep keys.

Value parameters

account

the account index

index

the DRep key index (usually 0)

Attributes

Returns

the path string

def parseAccountPath(pathStr: String): Option[Int]

Parse an account-level path.

Parse an account-level path.

Value parameters

pathStr

the path string (e.g., "m/1852'/1815'/0'")

Attributes

Returns

Some(account) if valid account path, None otherwise

def parsePath(pathStr: String): Option[(Int, Int, Int)]

Parse a CIP-1852 path string into components.

Parse a CIP-1852 path string into components.

Value parameters

pathStr

the path string (e.g., "m/1852'/1815'/0'/0/0")

Attributes

Returns

Some((account, role, index)) if valid CIP-1852 path, None otherwise

def path(account: Int, role: Int, index: Int): String

Build a generic derivation path.

Build a generic derivation path.

Value parameters

account

the account index

index

the address/key index

role

the key role (0=external, 1=internal, 2=staking, 3=drep, 4=cc-cold, 5=cc-hot)

Attributes

Returns

the path string

def paymentPath(account: Int, index: Int): String

Build the derivation path for a payment (external) key.

Build the derivation path for a payment (external) key.

Path: m/1852'/1815'/account'/0/index

Value parameters

account

the account index

index

the address index

Attributes

Returns

the path string

def stakingPath(account: Int, index: Int = ...): String

Build the derivation path for a staking key.

Build the derivation path for a staking key.

Path: m/1852'/1815'/account'/2/index

Note: Typically index is 0 for the primary staking key.

Value parameters

account

the account index

index

the staking key index (usually 0)

Attributes

Returns

the path string

Concrete fields

val CoinType: Int

Coin type constant for Cardano (registered at SLIP-44).

Coin type constant for Cardano (registered at SLIP-44).

Attributes

val Purpose: Int

Purpose constant for Cardano Shelley-era wallets.

Purpose constant for Cardano Shelley-era wallets.

Attributes

val RoleCCCold: Int

Role for Constitutional Committee cold keys (CIP-105).

Role for Constitutional Committee cold keys (CIP-105).

Attributes

val RoleCCHot: Int

Role for Constitutional Committee hot keys (CIP-105).

Role for Constitutional Committee hot keys (CIP-105).

Attributes

val RoleDRep: Int

Role for DRep (governance) keys (CIP-105).

Role for DRep (governance) keys (CIP-105).

Attributes

val RoleExternal: Int

Role for external (receiving) addresses.

Role for external (receiving) addresses.

Attributes

val RoleInternal: Int

Role for internal (change) addresses.

Role for internal (change) addresses.

Attributes

val RoleStaking: Int

Role for staking keys.

Role for staking keys.

Attributes