MultiversX Tracker is Live!

How to efficiently verify bulk xprv descriptor imports in a Legacy Bitcoin Core wallet via CLI?

Bitcoin Reddit

More / Bitcoin Reddit 28 Views

Warning to scammers: Don't waste your time DMing me. These are completely blank, zero-balance wallets generated locally strictly for testing bulk import scripts. There are zero funds involved, so save your breath and do not bother me.

I used a bash script to bulk import hundreds of extended private keys (xprv) into a Legacy Bitcoin Core wallet. The import was executed using the "importmulti" RPC command, utilizing output script descriptors with checksums (example format: wpkh(xprv...)#checksum).

Problem:

I need an efficient way to verify that Bitcoin Core successfully digested these keys and that the wallet holds the spendable rights ("ismine": true) for the generated addresses.

What I have tried (and why it failed):

Command tried: bitcoin-cli listdescriptors

esult: Threw error "Method not found (code -32601)".

Issue: If the flag is missing (as it is in Legacy wallets), it seems to instantly throw the method not found error

Command tried: bitcoin-cli listreceivedbyaddress 0 true

Result: Did not output the newly imported keys.

Source: In the Bitcoin Core source code (src/wallet/rpc/transactions.cpp), the listreceivedbyaddress function iterates over CWalletTx (transactions) and mapAddressBook (labels). Because the imported addresses have zero transactions and were imported without a specific "label" string, they do not exist in either map and are completely ignored by the output???

Command tried: bitcoin-cli getaddressinfo [address]

Result: This works individually to confirm "ismine": true.

However, because legacy wallets don't store the xprv natively, this requires first running the "deriveaddresses" RPC on every single xprv descriptor to find the anchor address before checking it. Doing this for hundreds of keys in a bash loop is highly inefficient.

Command tried: bitcoin-cli dumpwallet [file]

Thought process: Dumps the entire keypool to disk, allowing me to count total keys using grep.

Result: did not work. Also very stupid fix.

Source: https://developer.bitcoin.org/reference/rpc/dumpwallet.html. Also this is slow as heck.

Warning to scammers: Don't waste your time DMing me. These are completely blank, zero-balance wallets generated locally strictly for testing bulk import scripts. There are zero funds involved, so save your breath and do not bother me.

submitted by /u/DeusExRobotics
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments