dash-platform-sdk
    Preparing search index...

    Class KeyPairController

    Collection of functions to work with private keys and seed phrases

    Index

    Methods

    • Allows to derive child HD Key

      Parameters

      • hdKey: HDKey

        {HDKey} - The HDKey parent instance

      • index: number

        {number} - Index of child

      Returns Promise<HDKey>

      A promise that resolves child key

    • Derives an {HDKey} child by identity index and key index from an {HDKey}

      Usually used to get a identity private key from seed

      Parameters

      • hdKey: HDKey

        {HDKey}

      • identityIndex: number

        {number}

      • keyIndex: number

        {number}

      • network: Network

        {Network}

      Returns HDKey

    • Allows to derive HD key by path

      Parameters

      • hdKey: HDKey

        {HDKey} - The HDKey parent instance

      • path: string

        {string} - Path of children

      Returns Promise<HDKey>

      A promise that resolves key by path

    • Derives the DIP-17 account-level extended public key (xpub) for the clear-funds key class: m/9'/coinType'/17'/account'/0'. The seed is only needed once per account — the returned xpub derives every address index publicly (see derivePlatformAddressFromXpub), with no further access to the seed.

      Parameters

      • seed: Uint8Array

        {Uint8Array} - BIP-39 seed bytes

      • network: Network

        {Network} - network (selects the SLIP-44 coin type)

      • account: number

        {number} - DIP-17 account index

      Returns Promise<string>

      account-level extended public key

    • Derives a transparent platform P2PKH address from a BIP-39 seed via DIP-17 (m/9'/coinType'/17'/account'/0'/index).

      Parameters

      • seed: Uint8Array

        {Uint8Array} - BIP-39 seed bytes

      • network: Network

        {Network} - network (selects the SLIP-44 coin type)

      • account: number

        {number} - DIP-17 account index

      • index: number

        {number} - address index

      Returns Promise<PlatformAddressWASM>

    • Derives a transparent platform P2PKH address from an account-level xpub (see derivePlatformAccountXpub). The address index is non-hardened, so public-only derivation reproduces the exact same address as the seed-based path — no seed required.

      Parameters

      • xpub: string

        {string} - account-level extended public key

      • network: Network

        {Network} - network (selects the extended-key version bytes)

      • index: number

        {number} - address index

      Returns PlatformAddressWASM

    • Derives the private key for a DIP-17 platform address by its index (m/9'/coinType'/17'/account'/0'/index). Used to sign a transfer that spends from that address.

      Parameters

      • seed: Uint8Array

        {Uint8Array} - BIP-39 seed bytes

      • network: Network

        {Network} - network (selects the SLIP-44 coin type)

      • account: number

        {number} - DIP-17 account index

      • index: number

        {number} - address index

      Returns Promise<PrivateKeyWASM>

    • Derives a shielded (Orchard) address from a BIP-39 seed via ZIP-32 (m/32'/coinType'/account').

      Parameters

      • seed: Uint8Array

        {Uint8Array} - BIP-39 seed bytes

      • network: Network

        {Network} - network (selects the SLIP-44 coin type)

      • account: number

        {number} - ZIP-32 account index

      • OptionaldiversifierIndex: number

        {number=} - optional diversifier index

      Returns OrchardAddressWASM

    • Derives the sender's Orchard outgoing viewing key (OVK, 32 bytes) from a BIP-39 seed via ZIP-32 (m/32'/coinType'/account'). Used to recover the outgoing notes a wallet sent.

      Parameters

      • seed: Uint8Array

        {Uint8Array} - BIP-39 seed bytes

      • network: Network

        {Network} - network (selects the SLIP-44 coin type)

      • account: number

        {number} - ZIP-32 account index

      Returns Uint8Array

      32-byte outgoing viewing key

    • Returns seed from mnemonic phrase

      Parameters

      • mnemonic: string

        {string} - The BIP39 mnemonic phrase.

      • Optionalsalt: string

        {string=} - Optional salt for seed derivation.

      Returns Uint8Array

      Seed bytes

    • Converts {PublicKey} to a Dash network address (P2PKH)

      Parameters

      • publicKey: Uint8Array

        {Uint8Array}

      • network: Network

        {Network}

      Returns string

    • Converts a public key to a transparent platform P2PKH address (DIP-18): the canonical variantByte || Hash160(pubkey) PlatformAddress.

      Parameters

      • publicKey: Uint8Array

        {Uint8Array}

      • network: Network

        {Network}

      Returns PlatformAddressWASM

    • Returns seed from mnemonic phrase

      Parameters

      • seed: Uint8Array

        {Uint8Array}

      • network: Network = 'mainnet'

        {Network} network

      Returns HDKey

      HDKey