3

I just started running my own full node. IBD is finished, and I'm now learning how to use bitcoin-cli.

First I would like to extract all the available information for one or more public addresses from the downloaded blockchain.

For the most part 1, I have not been able to find a way to do this that does not require creating a wallet.

For example, if I run

% bitcoin-cli getaddressinfo 1XPTgDRhN8RFnzniWCddobD9iKZatrvH4

...I get an error message that says

error code: -18
error message:
No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A \
default wallet is no longer automatically created)

(BTW, I get the same error as long as I provide one argument after getaddressinfo, irrespective of its value.)

It seems to me that it should not be that difficult to dump all the information that the local blockchain currently has for a given address, without the need for a wallet.

Can this be done with bitcoin-cli?

If not, is there some other way to do it (without creating a wallet)?


1The only partial exception to this statement is that, if I have a transaction ID, I can use bitcoin-cli gettxout repeatedly, and look for the desired address(es) in the output. This is not only absurdly laborious, but it requires having a specific transaction ID.

2 Answers 2

4

getaddressinfo is a wallet RPC. It reports the information a specific wallet has about a receiving address it created. Without wallet, there is no information.

It seems to me that it should not be that difficult to dump all the information that the local blockchain currently has for a given address, without the need for a wallet.

The local blockchain database in Bitcoin Core has no information about addresses or the scripts they refer to at all. All it has is the raw block data, and a database of unspent transaction outputs (indexed only by the txid and output position that created them - as you can query using gettxout).

It is of course still possible to index the chain and compute information related to addresses/scripts, like various block explorer websites do. Such functionality does not exist in Bitcoin Core, as it is unnecessary for the features it provides (full block validation, wallet functions, ...).

If not, is there some other way to do it (without creating a wallet)?

Perhaps you're interested in the scantxoutset RPC. You give it a descriptor (which can contain an address, but also xpubs, ...) and it will scan the current set of unspent transaction outputs that are assigned to those. Note however that this doesn't use any index, so it is rather slow (several minutes) for a query.

If you want the ability to query things faster, various indexing software packages exist.

1

I have written a program in Python3 that allows you to search for any address on bitcoin core whether it belongs to your wallet or not.

Here is the github link:

https://github.com/ORP967/Bitcoin_Core_RPC_par_address

Let me know what you think or if you have any improvements you might have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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