Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ExtendedPrivKey and ExtendPubKey classes #138

Closed
elmarsan opened this issue Apr 11, 2022 · 7 comments
Closed

Add ExtendedPrivKey and ExtendPubKey classes #138

elmarsan opened this issue Apr 11, 2022 · 7 comments
Assignees
Milestone

Comments

@elmarsan
Copy link

elmarsan commented Apr 11, 2022

Hi!

The Kotlin library only contains ExtendedKeyInfo.
It would be very useful to also have ExtendedPrivKey and ExtendPubKey.

@notmandatory notmandatory self-assigned this Apr 19, 2022
@notmandatory
Copy link
Member

Hi, can you explain a bit more about how you want to use ExtendedPrivKey and ExtendPubKey if we expose them in the Kotlin library? It would help with prioritizing and maybe there's another way to do what you need.

@elmarsan
Copy link
Author

I'm trying to avoid use xprv as wallet descriptor.
At this moment you don't have a way the get the public key, then it's hard to figure out from xprv without using other library.

Let me put an example:

val key = generateExtendedKey(Network.TESTNET, WordCount.WORDS12, null)

// Desired scenario
val wallet = Wallet(
        "wpkh([c258d2e4/84/1/0]${key.xpub}/0/*)",
        "wpkh([c258d2e4/84/1/0]${key.xpub}/1/*)",
        Network.TESTNET,
        DatabaseConfig.Memory,
        BlockchainConfig.Electrum(
            ElectrumConfig("ssl://electrum.blockstream.info:60002", null, 5u, null, 10u)
        )
    )

Currently there is no way to do that.
For example padawan wallet uses the xprv as wallet descriptor

@notmandatory notmandatory added this to the Release 0.6.0 milestone Apr 26, 2022
@notmandatory
Copy link
Member

OK yes I understand now and this is a very good suggestion. But to make your example work we don't need new ExtendedPrivKey and ExtendPubKey classes. Would it work for you if we add an xpub property to the ExtendedKeyInfo class?

The FFI definition would look like this:

dictionary ExtendedKeyInfo {
  string mnemonic;
  string xprv;
  string xpub;
  string fingerprint;
};

@elmarsan
Copy link
Author

I suppose that adding just xpub it's what the biggest parts of developers would need it.

@notmandatory
Copy link
Member

I'm open to other solutions if you have a need for something more. I just realized an existing PR #139 also adds xpub to ExtendedKeyInfo. If no objections I'm going to work on getting that one merged and then we also solve this issue.

@notmandatory
Copy link
Member

This should be fixed as part of #154 which is focused on deriving xpubs from xprv keys.

@notmandatory
Copy link
Member

@elmarsan please checkout new API in #154, it was just merged and will be in the next release if you want to play with it in your project.

@notmandatory notmandatory added this to the Release 0.9.0 milestone Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants