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

x/lucid/src/mod.ts>C.Bip32PrivateKey#derive

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
method C.Bip32PrivateKey.prototype.derive
import { C } from "https://deno.land/x/lucid@0.10.6/src/mod.ts";
const { Bip32PrivateKey } = C;

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).