Author

Topic: Gross btc in bitcoin core from multiple wallet files (Read 344 times)

legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
-snip-
Would this work also on a non blank wallet? Or will it cause problems to have multiple active descriptors?
There'll be only one active parent descriptor per script type of receiving and change derivation paths.
If you imported another with "active: true", the original descriptor of that script type will be deactivated.

For more details, go to my reply in your other post: /index.php?topic=5409926.msg61174577#msg61174577
newbie
Activity: 25
Merit: 0
Importing each xpub key via "descriptor" can be time consuming but after setting it up, that specific wallet.dat will be able see all of the imported master keys' transactions and total their balances.

These are the steps:

Super helpful. Thank you!

To make this work for a full wallet (non watching only), I did a few modifications:

Instead of "xpub" key, import the "xpriv" key gotten by using the command in Electrum's console: getmasterprivate()
Add \"active\": true, to the 'receiving' and 'change' descriptors to set those as the active descriptors.
Remove \"watching-only\": false, from the descriptors also.

Would this work also on a non blank wallet? Or will it cause problems to have multiple active descriptors?
member
Activity: 135
Merit: 52
Will do but i hope bitcoin devs are watching this thread.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
daymm thanks but it went over my head!.
You can try to create a "Feature Request" issue in Bitcoin's GitHub repository, here: https://github.com/bitcoin/bitcoin/issues
If the developers will find it useful, they may consider implementing a "gross balance" feature.
member
Activity: 135
Merit: 52
daymm thanks but it went over my head!.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
Each wallet.dat file shows the btc amount but is there any way the bitcoin core shows gross btc of all the wallets that have been connected?
Just to be clear, since you're using BWT plugin in, are the "connected wallets" from Electrum?

If so, then it's doable using this workaround: Create a "blank descriptor wallet" that will hold all of the wallet's master public keys.
Importing each xpub key via "descriptor" can be time consuming but after setting it up, that specific wallet.dat will be able see all of the imported master keys' transactions and total their balances.

These are the steps:
  • In Electrum, get the "Master Public Key" of the wallet that you want to import in "Wallet->Information".
  • For Native SegWit and P2SH-SegWit wallets, you'll have to convert the zpub or ypub into xpub to be compatible with Bitcoin core
    using the console command ("View->Show Console" to enable console tab):
    convert_xkey(xkey="zpub6YBr.....XXZ3DysZgsPX",xtype="standard")
  • With the xpub, create a parent descriptor by following this format:
    For P2WPKH (receiving):        "wpkh([00000000/0]xpub....YOUR_XPUB_KEY......./0/*)"
    For P2WPKH (change):           "wpkh([00000000/0]xpub....YOUR_XPUB_KEY......./1/*)"

    For P2PKH (receiving):         "pkh([00000000/0]xpub....YOUR_XPUB_KEY......./0/*)"
    For P2PKH (change):            "pkh([00000000/0]xpub....YOUR_XPUB_KEY......./1/*)"

    For P2SH-P2WPKH (receiving):   "sh(wpkh([00000000/0]xpub....YOUR_XPUB_KEY......./0/*))"
    For P2SH-P2WPKH (change):      "sh(wpkh([00000000/0]xpub....YOUR_XPUB_KEY......./1/*))"
    If your Electrum wallet is Native SegWit (P2WPKH), create P2WPKH receiving and change address descriptors.

  • Get its checksum by using Bitcoin Core's console, use the command getdescriptorinfo

    For example: getdescriptorinfo "wpkh([00000000/0]xpub....YOUR_XPUB_KEY......./0/*)"

    Take note of the "checksum" among the results.

  • Now, it's ready to be imported to Bitcoin Core.
    Create a new blank wallet in Bitcoin Core by ticking the boxes: "Disable Private Keys", "Make Blank Wallet" and "Descriptor Wallet".

  • After creating the wallet, go to Bitcoin Core's Console (Window->Console), select the newly created wallet from the drop-down menu above.

  • Then import the descriptor by using this command:
    For receiving addresses:
    importdescriptors "[{\"desc\": \"wpkh([00000000/0]xpub....YOUR_XPUB_KEY......./0/*)#2r29ev5v\",\"timestamp\": \"now\",\"watching-only\": true,\"internal\": false,\"range\": [0,999]}]"

    For change addresses:
    importdescriptors "[{\"desc\": \"wpkh([00000000/0]xpub....YOUR_XPUB_KEY......./1/*)#mh0yyey5\",\"timestamp\": \"now\",\"watching-only\": true,\"internal\": true,\"range\": [0,999]}]"
    The example checksum are "2r29ev5v"  and "mh0yyey5" that are next to the descriptors; the only difference is "internal" flag, it's set to 'true' for change address; and lastly you might need to increase the end range depending on the wallet's usage.

  • Just repeat the steps to each of the connected Electrum's master public key, except the "create a new wallet" step.
    Import the other descriptors to that same wallet.

-edited the title for search engines-
legendary
Activity: 3500
Merit: 6320
Crypto Swap Exchange
On the bottom left you have move post. You can put it in  Development & Technical Discussion > Wallet software > Electrum mods don't need to.

But no, there is no way to have electrum add all the totals. Evey wallet file is independent of each other.

How many are there 2? 5? 10? more?

You can export the private keys from all the separate wallets in one, but that takes time and leaves the potential for mistakes.

And as been stated many times before, never delete wallet files even if you move everything or they are empty. You never know when you might need something from them.

-Dave
member
Activity: 135
Merit: 52
So i have connected electrum watch only with bwt plugin to bitcoin core. On top right of the corner i have the option to change wallets. Each wallet.dat file shows the btc amount but is there any way the bitcoin core shows gross btc of all the wallets that have been connected?

I dont want to manually calculate btc per wallet.

mods i dont know in which sub forum this belongs. Now i see dev and tech discussion forum.
Jump to: