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

How to get wallet xpubkey #708

Closed
waterdrop01 opened this issue Feb 21, 2019 · 2 comments
Closed

How to get wallet xpubkey #708

waterdrop01 opened this issue Feb 21, 2019 · 2 comments

Comments

@waterdrop01
Copy link

Hi,
I created a watch-only wallet, with a xpubkey property:

const newWallet = await client.createWallet(id, {
        witness: false,
        watchOnly: true,
        accountKey: xpubkey,
      });

Now I'd like to retrieve the accountKey / xpubkey back.

it's not in bclient.wallet(id).getInfo(), and I couldn't find the proper method in the API docs, any help?

Many thanks

@pinheadmz pinheadmz added the help wanted User has a question, not critical label Feb 21, 2019
@pinheadmz
Copy link
Member

When you create a watch-only wallet and import an xpub, that xpub becomes the account key for Account 0. If you query for account 0 (or default) you should see your original xpub:

http://bcoin.io/api-docs/#get-account-information

See also the example script: https://github.com/bcoin-org/bcoin/blob/5fc3a662e1f4d28e97de7a0d3418ff224f0f1391/docs/Examples/watch-only-wallet.js

@waterdrop01
Copy link
Author

Works great, thank you @pinheadmz !

@braydonf braydonf removed the help wanted User has a question, not critical label May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants