derivePrivateKeyByType
Usage
import { derivePrivateKeyByType, DerivationType } from '@stacks/wallet-sdk';
import { HDKey } from '@scure/bip32';
import { mnemonicToSeed } from '@scure/bip39';
const seed = await mnemonicToSeed('your 24-word seed phrase ...');
const rootNode = HDKey.fromMasterSeed(seed);
// Derive using the STX/Wallet path
const stxKey = derivePrivateKeyByType({
rootNode,
index: 0,
derivationType: DerivationType.Wallet,
});
// Derive using the Data path
const dataKey = derivePrivateKeyByType({
rootNode,
index: 0,
derivationType: DerivationType.Data,
});Notes
Signature
Returns
Parameters
opts (required)
Property
Type
Description
Last updated
Was this helpful?