Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/lucid/src/mod.ts>Core.Bip32PrivateKey

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.
Go to Latest
class Core.Bip32PrivateKey
import { Core } from "https://deno.land/x/lucid@0.7.8/src/mod.ts";
const { Bip32PrivateKey } = Core;

Methods

derive(index)

derive this private key with the given index.

Security considerations

  • hard derivation index cannot be soft derived with the public key

Hard derivation vs Soft derivation

If you pass an index below 0x80000000 then it is a soft derivation. The advantage of soft derivation is that it is possible to derive the public key too. I.e. derivation the private key with a soft derivation index and then retrieving the associated public key is equivalent to deriving the public key associated to the parent private key.

Hard derivation index does not allow public key derivation.

This is why deriving the private key should not fail while deriving the public key may fail (if the derivation index is invalid).

see from_128_xprv

Static Methods

__wrap(ptr)

128-byte xprv a key format in Cardano that some software still uses or requires the traditional 96-byte xprv is simply encoded as prv | chaincode however, because some software may not know how to compute a public key from a private key, the 128-byte inlines the public key in the following format prv | pub | chaincode so be careful if you see the term "xprv" as it could refer to either one our library does not require the pub (instead we compute the pub key when needed)

from_bech32(bech32_str)
from_bip39_entropy(entropy, password)
from_bytes(bytes)