Help understanding "bb_getxpub"

The documentation is a little confusing, the description states:

“Get balances and transactions of an xpub or output descriptor”, but then, in the description for the address field it says:

“Typically a Bitcoin address; xpub will not work.”

But the example also shows an xpub being used.

How is this endpoint different from bb_getaddress? Is there a way I could get the overall wallet balance using bb_getxpub? Is the documentation wrong regarding the address field?

I’ve been trying it out using an zpub converted to an xpub, but I can’t seem to get anything other than “Internal Server Error” as a response.

I ask these questions, but even it worked, and would give me the overall balance of all addresses generated using the xpub, I wonder if it’s safe to be sending the master public key over the wire. Any thoughts on that?

Hey @synic

Yes, the docs are wrong in this case. There was a recent docs migration to a new docs framework, and it did mess up a few things. We are auditing all the chains and soon will reach Bitcoin, too. That being said, I will have this updated. It should be xpub rather than being address.

It is pretty different from bb_getaddress as it returns balances for your addresses related to xpub. I don’t think there is a way to get overall balances.

Can you share the example which is giving you an error?

And I think yes it’s pretty safe to ever share your xpub as it doesn’t allow someone to spend but just allows to watch or track.