Author

Topic: Checking for balances of address [range] using Bitcoin Core using descriptors (Read 128 times)

legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
-snip- but now I would like to scan for an xpub with a derivation path and specific range. How may I do that?
importdescriptors command's arguments are listed in here: https://developer.bitcoin.org/reference/rpc/importdescriptors.html
descriptors are documented here: https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md

Here's an example extended public key with derivation path to 'external_index/address_index' ( /0/* ) and with 'range' argument.
(commonly used path for deriving receiving addresses from an xpub):
Code:
importdescriptors "[{\"desc\": \"wpkh(tpubDC8SbfxbQot4BA2kg476RyWA5EM5yawYj9ZUMbAtDeBEBgPNVTyAYRKDCLJQcbUP1yBus4Z9BUMSZANmaNGruFYnfPXwXBDLrPyU8vM7QWy/0/*)#wg24ts7y\",\"timestamp\": \"now\",\"range\": [0,100]}]"
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Which RPC do I use to check the status of the rescan?

getwalletinfo

Thanks.

I can see the UTXOs for the address, but now I would like to scan for an xpub with a derivation path and specific range. How may I do that?
staff
Activity: 3458
Merit: 6793
Just writing some code
Which RPC do I use to check the status of the rescan?

getwalletinfo
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
I tried that, and it seemed to be rescanning the wallet (I used a real address with UTXOs after block height 690000) and then I got this:

Code:
error: timeout on transient error: Could not connect to the server 127.0.0.1:8332 (error code 0 - "timeout reached")

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

followed by this (when trying again)

Code:
error code: -4
error message:
Wallet is currently rescanning. Abort existing rescan or wait.

Which RPC do I use to check the status of the rescan?
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
And for example, this fails with "Error -5 missing checksum": bitcoin-cli -rpcwallet=some_wallet importdescriptors '[{"desc": "addr(
)", "timestamp": "now"}]'
Checksum goes after the descriptor.

But first, to get the checksum: use getdescriptorinfo command.
Example (Regtest):
Code:
getdescriptorinfo "addr(bcrt1qjd5q9e4du3rj4f0gux9794tmf330rtaplqkel9)"
Result: -snip- "checksum": "xtu8a9fg", -snip-

Then, include it to your importdescriptors command.
Example:
Code:
importdescriptors "[{\"desc\": \"addr(bcrt1qjd5q9e4du3rj4f0gux9794tmf330rtaplqkel9)#xtu8a9fg\",\"timestamp\": \"now\"}]"
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
I'm designing a wallet that is going to use a Bitcoin Core node to fetch balances of addresses. And yes I am storing master public keys using standard BIP44 derivation. So in other words: m/44'/0'/0'/0/[0-1000 or whatever] and m/44'/0'/0'/1/[0-1000 or whatever], for legacy addresses for example. Other types of addresses are constructed similarly.

But I cannot figure out how to fetch the balance of these xpubs as a descriptor. I would prefer the UTXOs be separated from each other and tagged with the address they belong to.

Of course, if I was working with single addresses, I could just use importaddress, but legacy wallets are deprecated and will be removed soon.

And for example, this fails with "Error -5 missing checksum": bitcoin-cli -rpcwallet=some_wallet importdescriptors '[{"desc": "addr(
)", "timestamp": "now"}]'

I'm running Bitcoin Core 24.0.
Jump to: