Difference in balance in my wallet and in btc explorer

0

I am coding a website to get BTC balance from explorer using the following url:

https://blockexplorer.com/api/addr/3CyZgGhkhE3z2WY8E5ztPMRYCDdg1hdD7g/balance

The problem is that the balance appeared using this url (explorer) is totally different from what in my wallet (nicehash).

Explorer balance for this address: 0.00946525 BTC

Wallet balance for this address: 0.01642334 BTC

What is the cause of this? and how to show the real balance in explorer exactly as in wallet?

Mohamed Amin

Posted 2018-05-01T22:11:25.490

Reputation: 111

Answers

1

The 3CyZ... address has a balance of 0.00946525 BTC, so it appears that your nicehash wallets includes some other addresses as well.

In general, a bitcoin wallet will include a collection of addresses: the more you use the wallet the more addresses it will generate. Best practices include only using each receiving address once (if you search 'address reuse' you'll find the reasoning behind this), so every time you send or receive a transaction the number of addresses you wallet controls will increase.

So to get an accurate account of your wallet balance, you'll need to sum the balance of all of the addresses the wallet controls, not just the 3CyZ.. address.

chytrik

Posted 2018-05-01T22:11:25.490

Reputation: 10 276

I know that Bitcoin wallet is a hierarchical deterministic wallet,but i want to know how to get the exact balance(as in wallet that holds multiple addresses) from explorer for using one address only .Mohamed Amin 2018-05-01T22:57:56.570

1@MohamedAmin that is not possible, using one address will return the balance for that one address. A block explorer has no way of knowing which addresses are related by HD wallet derivation, as an HD-derived address is indistinguishable from any other address.chytrik 2018-05-01T23:53:07.040