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

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

derive this public key with the given index.

Errors

If the index is not a soft derivation index (< 0x80000000) then calling this method will fail.

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