Bitcoin Forum
May 08, 2024, 03:13:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Checking for balances of address [range] using Bitcoin Core using descriptors  (Read 111 times)
NotATether (OP)
Legendary
*
Online Online

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
May 10, 2023, 05:43:32 AM
Merited by OmegaStarScream (3), ABCbits (2)
 #1

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(<address>)", "timestamp": "now"}]'

I'm running Bitcoin Core 24.0.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
1715138033
Hero Member
*
Offline Offline

Posts: 1715138033

View Profile Personal Message (Offline)

Ignore
1715138033
Reply with quote  #2

1715138033
Report to moderator
"This isn't the kind of software where we can leave so many unresolved bugs that we need a tracker for them." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715138033
Hero Member
*
Offline Offline

Posts: 1715138033

View Profile Personal Message (Offline)

Ignore
1715138033
Reply with quote  #2

1715138033
Report to moderator
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5591


Self-proclaimed Genius


View Profile
May 10, 2023, 07:19:04 AM
Merited by OmegaStarScream (3), ABCbits (3)
 #2

And for example, this fails with "Error -5 missing checksum": bitcoin-cli -rpcwallet=some_wallet importdescriptors '[{"desc": "addr(<address>)", "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\"}]"

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
NotATether (OP)
Legendary
*
Online Online

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
May 10, 2023, 08:50:38 AM
 #3

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?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6631


Just writing some code


View Profile WWW
May 11, 2023, 02:30:42 AM
 #4

Which RPC do I use to check the status of the rescan?

getwalletinfo

NotATether (OP)
Legendary
*
Online Online

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
May 11, 2023, 11:09:19 AM
 #5

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?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5591


Self-proclaimed Genius


View Profile
May 11, 2023, 12:13:51 PM
 #6

-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]}]"

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!