0

So to start I have very little experience and this may be a simple answer but I can't find it easily.

I suspect that I am using the wrong thing to achieve what I am trying to do.

I'm parsing out the blocks locally to get transactional information. Then I am trying to take each wallet addr with a transaction and check the current balance.

When I run this code I get this error "('Wallet file not specified (must request wallet RPC through /wallet/ uri-path).',)" which makes me think I am not using the correct method.

If I'm not using the correct method, what should I be using?

                received_info = rpc_connection.listreceivedbyaddress(1, False, True, str([output_address]))
                            if received_info:
                                output_file.write(f"  Received by Address Info:\n")
                                for info in received_info:
                                    output_file.write(f"    Address: {info['address']}\n")
                                    output_file.write(f"    Amount Received: {info['amount']} BTC\n")
                                    output_file.write(f"    Confirmations: {info['confirmations']}\n\n")

1 Answer 1

0

listreceivedbyaddress is a wallet RPC, it will only provide data on any addresses that are part of your wallet.

Bitcoin Core does not index balances by addresses outside of its own wallet’s addresses. You could use scanblocks which will need the node to have a blockfilterindex, or alternatively scantxoutset. I’m not sure either of these two would be particularly performant, so if you want to scan for a lot of addresses, you may want to look into running an electrum server or block explorer backend such as Esplora.

4
  • gotcha, thanks. So I can't use the blockchain locally as a sort of queryable DB? I will look into Esplora Jan 18 at 20:08
  • There is an option to run a txindex, but there is no address index
    – Murch
    Jan 18 at 20:10
  • Could I use scanblocks() with the addr as the descriptor? Jan 18 at 20:23
  • Oh, yeah, scanblocks would be a better choice. I forgot we have that now. You do need the blockfilterindex of course in order for that to be available.
    – Murch
    Jan 18 at 21:18

Your Answer

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

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