Skip to content

BSV Library Version | HD Keys Confussion #253

@imkrishnaagrawal

Description

@imkrishnaagrawal

Hi Everyone,

I am new to bsv ecosystem and have started a project using typescript/javascript. the obvious choice was bsv npm package as suggested by bsv official website and also followed along some courses however I am facing challenges understanding the versions , maintenance and future of bsv library. most of courses I followed at satolearn and other places are using old version of library which is 1.5.x and also moneybutton documentation is using 0.30.0 (https://about.moneybutton.com/docs/button/mb-crypto-operations). I am facing issue when creating HD Private and Public keys using Mnemonic. while looking at issues I found a solution however it is not working bsv.Mnemonic and bsv.HDPrivKey are undefined. I am using [email protected].

const mnemonic = new bsv.Mnemonic()
const hdPrivKey = bsv.HDPrivKey.fromSeed(mnemonic.toSeed())
const someKey = hdPrivKey.deriveChild("m/5/2/8") // Private key
const somePubkey = someKey.publicKey
const address = somePubkey.toAddress()
console.log(address);

Errors:

const mnemonic = new bsv.Mnemonic()
                 ^
TypeError: bsv.Mnemonic is not a constructor
const hdPrivKey = bsv.HDPrivKey.fromSeed(mnemonic.toSeed())
                                ^
TypeError: Cannot read properties of undefined (reading 'fromSeed')

I need suggestion to get some understanding around the issue. Other developers might be facing similar challenges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions