HdAccount

scalus.cardano.wallet.hd.HdAccount
See theHdAccount companion object
class HdAccount(val accountIndex: Int, accountKey: HdKeyPair, val paymentIndex: Int = ..., val changeIndex: Int = ..., val stakingIndex: Int = ..., val drepIndex: Int = ...) extends Account

HD wallet account implementing CIP-1852 derivation with BIP32-Ed25519.

Provides payment, change, staking, and DRep keys derived from a BIP-39 mnemonic using BIP32-Ed25519 key derivation (Icarus-style) and CIP-1852/CIP-105 path structure.

This implementation is compatible with standard Cardano wallets (Daedalus, Yoroi, etc.) because it uses BIP32-Ed25519 which supports both hardened and non-hardened derivation.

Path structure (CIP-1852 / CIP-105):

  • Payment keys: m/1852'/1815'/account'/0/index (role and index are non-hardened)
  • Change keys: m/1852'/1815'/account'/1/index
  • Staking keys: m/1852'/1815'/account'/2/index
  • DRep keys: m/1852'/1815'/account'/3/index (CIP-105)

Value parameters

accountIndex

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

accountKey

the account-level extended key at path m/1852'/1815'/account'

changeIndex

the change address index (default 0)

drepIndex

the DRep key index (default 0, CIP-105 recommends only index 0)

paymentIndex

the payment address index (default 0)

stakingIndex

the staking key index (default 0)

Attributes

Companion
object
Graph
Supertypes
trait Account
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

The account-level extended key (m/1852'/1815'/account').

The account-level extended key (m/1852'/1815'/account').

Attributes

Get the base address for this account.

Get the base address for this account.

Base address = payment key hash + stake key hash

Value parameters

network

the Cardano network (Mainnet or Testnet)

Attributes

Returns

the base ShelleyAddress

def deriveChangeKey(index: Int): HdKeyPair

Derive a change key at the given index (non-hardened per CIP-1852).

Derive a change key at the given index (non-hardened per CIP-1852).

Attributes

def deriveDrepKey(index: Int): HdKeyPair

Derive a DRep key at the given index (non-hardened per CIP-105).

Derive a DRep key at the given index (non-hardened per CIP-105).

Attributes

def derivePaymentKey(index: Int): HdKeyPair

Derive a payment key at the given index (non-hardened per CIP-1852).

Derive a payment key at the given index (non-hardened per CIP-1852).

Attributes

def deriveStakingKey(index: Int): HdKeyPair

Derive a staking key at the given index (non-hardened per CIP-1852).

Derive a staking key at the given index (non-hardened per CIP-1852).

Attributes

Get the enterprise address for this account.

Get the enterprise address for this account.

Enterprise address = payment key hash only (no staking)

Value parameters

network

the Cardano network (Mainnet or Testnet)

Attributes

Returns

the enterprise ShelleyAddress

Get the stake address for this account.

Get the stake address for this account.

Value parameters

network

the Cardano network (Mainnet or Testnet)

Attributes

Returns

the StakeAddress

def withChangeIndex(index: Int): HdAccount

Create a new HdAccount with a different change index.

Create a new HdAccount with a different change index.

Attributes

def withDrepIndex(index: Int): HdAccount

Create a new HdAccount with a different DRep index.

Create a new HdAccount with a different DRep index.

Attributes

def withPaymentIndex(index: Int): HdAccount

Create a new HdAccount with a different payment index.

Create a new HdAccount with a different payment index.

Attributes

def withStakingIndex(index: Int): HdAccount

Create a new HdAccount with a different staking index.

Create a new HdAccount with a different staking index.

Attributes

Inherited methods

Attributes

Inherited from:
Account

Concrete fields

val accountIndex: Int
val changeIndex: Int
lazy override val changeKeyPair: KeyPair

Change (internal) key for transaction change outputs.

Change (internal) key for transaction change outputs.

Attributes

val drepIndex: Int
lazy override val drepKeyPair: KeyPair

DRep (governance) key - for Cardano governance participation.

DRep (governance) key - for Cardano governance participation.

This is a dedicated key derived at role 3 (m/1852'/1815'/account'/3/index) per CIP-105, separate from the staking key at role 2. Using a distinct key for governance provides better security isolation between staking delegation and governance voting.

Note: CIP-105 recommends using only index 0 for DRep keys (one DRep per account).

Attributes

See also
val paymentIndex: Int

Get the payment key hash (Blake2b-224 of verification key).

Get the payment key hash (Blake2b-224 of verification key).

Attributes

lazy override val paymentKeyPair: KeyPair

Payment (external) key for receiving funds.

Payment (external) key for receiving funds.

Attributes

Get the stake key hash (Blake2b-224 of verification key).

Get the stake key hash (Blake2b-224 of verification key).

Attributes

lazy override val stakeKeyPair: KeyPair

Staking key for delegation and rewards.

Staking key for delegation and rewards.

Attributes

val stakingIndex: Int