Skip to content

Cannot retrieve secret key from mneumonic #20

Description

@akhilparakka

`const StellarHDWallet = require("stellar-hd-wallet");
const { Keypair } = require("stellar-sdk");

function privateKeyToMnemonic(privateKey) {
const mnemonic = StellarHDWallet.generateMnemonic(privateKey);
return mnemonic;
}

const privateKey = "SBT4B2Y4VN33OCHVPRSD6JXXNPZ2UDXQFLRS7B5C4MLRMLOTEZS4UDY5";
console.log("Private key before: ", privateKey);

const mneumonic = privateKeyToMnemonic(privateKey);
console.log("Mneumonic is ", mneumonic);

const wallet = StellarHDWallet.fromMnemonic(mneumonic);
console.log(wallet.getSecret(0));
`
The key keeps changing

Private key before: SBT4B2Y4VN33OCHVPRSD6JXXNPZ2UDXQFLRS7B5C4MLRMLOTEZS4UDY5 Mneumonic is decline come potato citizen visual awkward owner illness pigeon save apple snake ordinary salmon twenty uphold toss must put primary oak hollow people ivory SBCNTVPPHD2GDWQTKA7CNCMLI53QDZK7JWKHTDZGTVCV4OIHTSGR5GQI

Private key before: SBT4B2Y4VN33OCHVPRSD6JXXNPZ2UDXQFLRS7B5C4MLRMLOTEZS4UDY5 Mneumonic is dance scatter cry recycle rookie day wage culture fly expect wolf mirror market approve soon before test sleep heavy connect unknown lawsuit lake idle SDZGV6NYGR7BNCWMJV2EUPXSGGGUEZ3C47Y2RPCFF7J7RHC6XZIUEVPU

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions