1

For few reasons, I must use rpc node to handle wallet at this time. In the near future, I will change the flow to use library to create addreses, store privatekey at database and create raw transaction. That means I will use rpc node for broadcasting only, not depend on it too much. But I need time to do, so I will divide this period to few parts, firstly, I will start at creating and store address:
I have both hex private key and wif key, then I use importprivkey to import wif key to rpc node without rescan because I have a large request contacting to rpc. If those addresses are fresh, it's very nice scenario, each new input to them will automatically fetch UTXO by using listunspent command to check.
In other case, the very worst scenario, for maintenance or backup, I import an address which contains old UTXO and wanna fetch these UTXOs to addresses without using rescan command (it takes a long time to complete), like other api just put address and get UTXOs in a blink. https://testnet.blockexplorer.com/api/addr/myzhMVXT39L7nnco6TtJ2a7sYaEo8ixT4Q/utxo
Is there any ways to fetch old UTXO to address in rpc node without rescan? Because these api are very fast response, I think they're not using rescan. For long term, using other api is not good for my project, I'm using version 0.16 (I know it's very old but the project need time to change it slowly and carefully), thanks for help so much.

0

Because these api are very fast response, I think they're not using rescan.

No, they maintain massive databases that index every transaction and transaction output and their associated addresses. Bitcoin Core does not need this for normal function, and the vast majority of users do not need access to such information. Bitcoin Core does not and cannot build such databases.

I'm using version 0.16

Then there is nothing you can do.

If you were using 0.18, then you could use the scantxoutset command to just scan the UTXO set for UTXOs. This is very quick, and you can specify multiple addresses to do it as single batch scan. scantxoutset will give you all of the UTXOs for the specified addresses but will not add them to any wallets loaded in Bitcoin Core. However, it does not sound like you are using the wallet so that should be fine.

  • Thank you, I've understood. But I can not find more detail on this scantxoutset command. May you give me a simple format with a valid adress without publickey, example: bitcoin-cli scantxoutset start '[{"desc":"MY_ADDRESS", "range":100}]' – mmo2112 Aug 16 at 7:03
  • bitcoin-cli scantxoutset start '["addr(<address>)", "addr(<address2>)"]' where <address> and <address2> are the addresses you want to scan for. Since it is an array, you can just add more addr(<address>) style descriptors. – Andrew Chow Aug 16 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.