2

I'm interested in knowing if there is an rpc method to determine whether or not an address was generated, and thus is owned by, a loaded Bitcoin Core wallet.

I have a few addresses that I generated a month or so ago using getnewaddress. These have been stored in a relatively secure encrypted location. In my paranoia, I am reluctant to now use the addresses to receive funds in the wallet, since as far as I know there is no benefit in doing so (besides increasing the gap between used addresses - but I am in no way approaching any gap limit, so this is irrelevant) over simply generating a new address which I can be sure is indeed owned by the loaded wallet. That said, I am curious to know if this is possible (since it may in some cases be useful, if sufficiently trustworthy - which if it were an rpc method for a trusted Bitcoin Corre instance, I'd assume to be the case) and after searching bitcoin.org RPC docs and on here, I have not been able to find an answer to this yet.

Note - I am aware of the validateaddress rpc, but as far as I understand, this only validates whether or not a Bitcoin address is valid, not whether it is associated with the loaded (or any particular) wallet.

3

You want the getaddressinfo wallet RPC. It will tell you whether an address is considers "yours", along with various other information like whether you have the keys, whether it's a payment address or change, what its label is, and how it was derived.

1
  • 1
    Thanks, exactly what I was looking for. To any onlookers, the relevant part of the json response to getaddressinfo is 'ismine' – qmux Dec 15 '20 at 23:35

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.