Bitcoin Forum
June 23, 2024, 05:15:40 PM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Get balance from XPUB  (Read 2703 times)
xhoud01 (OP)
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile WWW
October 26, 2015, 02:05:13 PM
 #1

Hi I need to get final balance from Account public keys (XPUBK). Is there any API or ready made code that can be used to check the balance of particular xpub?
Thank you.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3430
Merit: 6720


Just writing some code


View Profile WWW
October 26, 2015, 02:18:22 PM
 #2

You should be able to look up the xpub key on any block explorer

xhoud01 (OP)
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile WWW
October 26, 2015, 03:18:03 PM
 #3

Here is xpub I have: I only need to know final balance and not history.

xpub6Bx6daFD2499gwjkoac1DrfMDZd6TEhx5frZ6mNoHTkAvL8QckN7uqCMr81Jn2tk1nYvUPL2TFR sD4X3KdzpKac19WTQ3DdgZjQRSjS9iU5

I was not able to find any service.
johoe
Full Member
***
Offline Offline

Activity: 217
Merit: 241


View Profile
October 26, 2015, 04:22:34 PM
 #4

You shouldn't post your xpub in a public forum...  unless you use it only for testing.

There is myTrezor lite android app that reads an xpub (from a qrcode) and shows the balance.  It cannot spend from it but it is useful for watching.

Mycelium can also import xpub addresses.

Your balance is 0.0009 BTC (according to Mycelium).

Donations to 1CF62UFWXiKqFUmgQMUby9DpEW5LXjypU3
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4672



View Profile
October 26, 2015, 04:50:43 PM
 #5

You shouldn't post your xpub in a public forum...
- snip -

Why not?
RustyNomad
Sr. Member
****
Offline Offline

Activity: 336
Merit: 250



View Profile WWW
October 26, 2015, 05:15:11 PM
 #6

You shouldn't post your xpub in a public forum...
- snip -

Why not?

If that is your xpub it now means that you just gave away any privacy you had as anybody can now monitor and see every single address and or transaction that ever goes into and out of that wallet.
Envrin
Sr. Member
****
Offline Offline

Activity: 318
Merit: 251



View Profile
October 26, 2015, 07:16:58 PM
 #7


You'll have to plug it into whatever wallet software you were using to receive funds.  That software should be able to retrieve the balance for you.

Aside from that, there's no way to tell what exact key index structure was used to generate the child keys.  If they went with what's recommended (m / is_change / n) then a generic solution might work, but wouldn't rely on accuracy.  Is that the key index used?  Are they hardened child keys, or no?  etc...

johoe
Full Member
***
Offline Offline

Activity: 217
Merit: 241


View Profile
October 26, 2015, 08:56:02 PM
 #8

You shouldn't post your xpub in a public forum...
Why not?
If that is your xpub it now means that you just gave away any privacy you had as anybody can now monitor and see every single address and or transaction that ever goes into and out of that wallet.

Yes, privacy is the main concern.  It is also that if one of the keys was broken because of bad signatures with weak r values or because you simply leaked the private key, then the xpub can be used to derive all other private keys in the wallet.  On the theoretical side it also makes you vulnerable to quantum computers (similar as reusing addresses does).  And someone may send you 0.0009 BTC just to annoy you Smiley   (They were sent today).

You'll have to plug it into whatever wallet software you were using to receive funds.  That software should be able to retrieve the balance for you.

Aside from that, there's no way to tell what exact key index structure was used to generate the child keys.  If they went with what's recommended (m / is_change / n) then a generic solution might work, but wouldn't rely on accuracy.  Is that the key index used?  Are they hardened child keys, or no?  etc...

Yes this could be an issue.  Mycelium and myTrezor lite assume standard structure m/is_change/n, which seems to be the case here (at least I can see a lot of transactions).  Note that hardened child keys do not work with xpubs (this is the reason why one uses hardening in the first place).  So you can at least exclude that.

You can also use bip32.org to generate the addresses.  Then you can choose the path by hand.  E.g., "Custom" and m/0/0 gives you the first used address.  It is not really practical, though. You need to generate the addresses one by one and then use a block explorer to check the balance.

EDIT: electrum also works: "Recover wallet or import key" (under File->New/Recover)  and then enter the xpub in the seed field..

Donations to 1CF62UFWXiKqFUmgQMUby9DpEW5LXjypU3
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!