Bitcoin Forum
May 26, 2024, 12:15:43 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Blockexplorer balance vs Bitcoin-qt balance - Please help explain the difference  (Read 1976 times)
ModusPwnd (OP)
Member
**
Offline Offline

Activity: 546
Merit: 10



View Profile
February 16, 2013, 11:17:06 PM
 #1

I have not been able to wrap my head around what is going when a transaction is made.  When I go to blockchain.info or blockexplorer.com they give a balance for my address which does not match my local bitcoin client's balance.  I read that this has to do with sending some BTC back to one's self at a new address for the purpose of security.  ??  Any links that might explain this better?  I see the link on blockexplorer.com, but wasn't able to glean as much as I'd like from that.

I sent a small transaction to try to understand what happens...  I have one bitcoin-qt client running on a PC with only one address listed under "Receive coins".  I have another bitcoin-qt client on a different PC with three "Receive coins" addresses.  I sent .01 BTC + .005 Fee from one address to another across PCs.  When I go to Blockchain.info and find the transaction it gives me total input and total output which are ~.02 BTC each, higher than I sent.  This excess was coins being sent back to myself?  And they are now at a new address which is in my first PC's wallet, but not visible under "Receive coins"?

One of my addresses hasn't been used in ~6 months.  According to blockexplorer.com there are a few coins in it.  They arnt my coins though...  How does somebody else have access to coins with my address?  I thought that the address was supposed to be unique to me...?


Seems like I am missing something here...
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
February 17, 2013, 02:41:06 AM
 #2

- SNIP -
I read that this has to do with sending some BTC back to one's self at a new address for the purpose of security.  ??  Any links that might explain this better?
 - SNIP -

With the way bitcoin works, you can't partially spend a previous output that you received.  It has to be completely spent.  So, if you receive 10 BTC all in a single transaction from someone/somewhere at an address, then that address now has a single 10 BTC output.

Later if you want to send 2 BTC to somebody, the program can use the previous 10 BTC output as an input into the transaction, and create a 2 BTC output to the address where you want to send it.  This leaves 8 BTC leftover in the transaction.  If you don't send those 8 BTC somewhere, then they become miner fees and end up in the coinbase transaction of the new block for the miner to keep.  If you don't want to give those 8 BTC away as fees to the miner, then you need to include a second output in your transaction sending the 8 BTC back to your own wallet.  As an analogy, think of pulling a $10 bill out of your pocket to pay for something that costs $2, you get $8 back in "change".

The way Bitcoin-Qt does this is to create a new bitcoin address that it doesn't tell you about and keep track of that address and the associated private key in your wallet.dat.  Since this isn't an address that you requested in the "Receive Coins" tab of the user interface, it doesn't show up in that list.  Bitcoin-Qt knows about the address since it is in the wallet.dat file, so it includes it in the balance that it shows you.  Bitcoin-Qt uses a new change address for every transaction.  So if you create 10 different transactions, each sending bitcoins somewhere, then your wallet will have used 10 different change addresses (although some of them may be empty if Bitcoin-Qt used the bitcoins associated with some of those address as inputs into other transactions).


One of my addresses hasn't been used in ~6 months.  According to blockexplorer.com there are a few coins in it.  They arnt my coins though...

If it is one of your addresses, then yes, they are your coins.

How does somebody else have access to coins with my address?

Unless they have your private key, they don't.


Anything specific here that needs further clarification?
ModusPwnd (OP)
Member
**
Offline Offline

Activity: 546
Merit: 10



View Profile
February 17, 2013, 06:39:52 PM
 #3

Thx for that quote, it was helpful and makes sense.  I presume that a more fancy bitcoin client would list these "change" addresses for me and allow me to dump their private keys, etc. ?

Also, I guess I just dont know how to read blockchain.info and blockexplorer.com.  For example, this address is mine (I think...);

1Uv3wbhTWSttr6voxUPdiQCEMXGS7DMsL

My wallet with that address in it has ~0.0111 BTC as a balance.  So presumably some of that total is attributed to the address above and some is not. (right?)  But at Blockchain.info it says that address has a "Final Balance" of ~2.95 which contradicts my client.  Blockexplorer.com has a "Balance" of ~0.0057 BTC, which is more reasonable.  But it includes a caveat: " While the last "balance" is the accurate number of bitcoins available to this address, it is likely not the balance available to this person. "  Could you please explain this statement if you understand it?  Are they saying that I may have more or less coins available?  Also, what does "Final Balance" at Blockchain.info mean if its not the balance of my address?

I hope these questions make sense.  Thx!
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
February 17, 2013, 06:57:09 PM
 #4

Also, I guess I just dont know how to read blockchain.info and blockexplorer.com.  For example, this address is mine (I think...);

1Uv3wbhTWSttr6voxUPdiQCEMXGS7DMsL

My wallet with that address in it has ~0.0111 BTC as a balance.  So presumably some of that total is attributed to the address above and some is not. (right?)  But at Blockchain.info it says that address has a "Final Balance" of ~2.95 which contradicts my client.

Blockchain.info is including bitcoins that you received from orphaned blocks.  In this case, your wallet is correct and blockchain.info is incorrect.

If you look at the following 3 transactions:

http://blockchain.info/tx/3fa74e691125dd2975e5e312e5cd93c4de81f6b18f571937fee4f19fedae3287
http://blockchain.info/tx/00817a917e2ba7d8e239659fa3dbc4848354ae2941349557757c798e89617d09
http://blockchain.info/tx/3f80055f45b9303236d7c89f1ee1f8ba229c805c0ffdb2175991f699ca58af23

You'll see that the total of the bitcoins that were mined to your address in those orphaned blocks was 2.95156792 BTC (which exactly matches the "Final Balance" when you look at the address here:
http://blockchain.info/address/1Uv3wbhTWSttr6voxUPdiQCEMXGS7DMsL

I would consider this to be a bug in the blockchain.info website.

Your actual balance at address 1Uv3wbhTWSttr6voxUPdiQCEMXGS7DMsL is currently 0 BTC.



I presume that a more fancy bitcoin client would list these "change" addresses for me and allow me to dump their private keys, etc. ?

The Bitcoin-Qt wallet does not provide this level of information in the regular user interface.  If you really want that level of information, it can be acquired using JSON RPC calls in the Debug Window Console.


it includes a caveat: " While the last "balance" is the accurate number of bitcoins available to this address, it is likely not the balance available to this person. "  Could you please explain this statement if you understand it?  Are they saying that I may have more or less coins available?  Also, what does "Final Balance" at Blockchain.info mean if its not the balance of my address?
I'm not certain, but I believe that the caveat is attempting to explain that a person can have more than one bitcoin address.  So while the "Balance" may be the number of bitcoins available to the address (as we've seen, this isn't true do to a bug in the website), the person may have additional addresses with additional bitcoins.
ModusPwnd (OP)
Member
**
Offline Offline

Activity: 546
Merit: 10



View Profile
February 18, 2013, 01:46:55 AM
 #5

I would consider this to be a bug in the blockchain.info website.

Your actual balance at address 1Uv3wbhTWSttr6voxUPdiQCEMXGS7DMsL is currently 0 BTC.

That makes sense.  Any idea why blockexplorer.com lists a different balance of 0.00573768?  It seems to be missing some transactions with only 39 sent and received.  blockchain.info lists 46 transactions which if we removed 3 unconfirmed ones would give 43... ?  blockchain.info is not accurate either for some reason.



Quote
The Bitcoin-Qt wallet does not provide this level of information in the regular user interface.  If you really want that level of information, it can be acquired using JSON RPC calls in the Debug Window Console.

Ok, I'm somewhat familiar with that.  I dont know the public keys but I suppose one of the commands will list all the public keys in the wallet for me, and then I can also fetch their corresponding private keys.  And if I find the totals under all of those addresses and sum them up they should equal what my wallet says I have, right?  That is assuming that blockchain.info and/or blockexplorer.com are accurate, which they may not be.


As long as I send coins to an address the total will stay under one address.  Once I send from it then I have to take care to see where the "change" was sent.  I could then recombine my new address's "change" back with my original address, can I not?  Thus having my total under one address again.  I suppose there is a reason this is not done?
Milkshake
Member
**
Offline Offline

Activity: 98
Merit: 10


Milkshake


View Profile
February 18, 2013, 01:51:35 AM
 #6

Yes, because with bitcoin-qt you don't just have one address. Even if it just says one address in your addressbook, you have MUCH MORE because of change.

Say you want to spend 5 BTC to buy something worth 1 BTC. You have to spend your entire 5 BTC input, so you send 1 BTC to someone, and send the 4 BTC back to you, under a new address.

TradeFortress has left me negative trust and has provided no proof to substantiate his claim. He has done this to discredit me as I am investigating him.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
February 18, 2013, 04:14:36 AM
 #7

That makes sense.  Any idea why blockexplorer.com lists a different balance of 0.00573768?
You are looking at that page upside down.  The 0.00573768 is the first balance (after the mining reward that you received 2012-08-17 16:25:04).

Scroll down to the bottom of the page and you'll see that the balance is currently 0 BTC:

It seems to be missing some transactions with only 39 sent and received.  blockchain.info lists 46 transactions which if we removed 3 unconfirmed ones would give 43... ?  blockchain.info is not accurate either for some reason.

The "Received transactions" and "Sent transactions" reported by blockexplorer are actually "inputs" and "outputs".  I'm not sure why blockexplorer chooses to call them "transactions". A transaction can be made up of multiple inputs from the same address.  If you count up the outputs to that address (on either blockchain.info or blockexplorer.com) you'll see that there are 39 of them, each belonging to a separate transaction.  Then there were an additional 4 transactions each spending multiple previous outputs as inputs (giving you the 43 that you calculated from blockchain.info).

Ok, I'm somewhat familiar with that.  I dont know the public keys but I suppose one of the commands will list all the public keys in the wallet for me, and then I can also fetch their corresponding private keys.  And if I find the totals under all of those addresses and sum them up they should equal what my wallet says I have, right?  That is assuming that blockchain.info and/or blockexplorer.com are accurate, which they may not be.

Other than the fact that blockexplorer calls inputs and outputs "transactions", and the fact that blockchain.info is displaying orphaned blocks that are no longer part of the publicly recognized blockchain, the rest of the data at both sites looks correct.

You can use the RPC command:

Code:
listunspent

It will return a list of all unspent outputs associated with addresses in your wallet. I don't think it gives you the Bitcoin Address, but it will give you the transactionID where the bitcoins were received and it will give you the public key and the bitcoin value of the output.

You can look up the transactionID at either blockchain.info or blockexplorer.com.  Or you can use the following RPC command in the Console window:

Code:
gettransaction  TRANSACTION_ID

Substituting the actual transaction ID in place of TRANSACTION_ID

As long as I send coins to an address the total will stay under one address.

Yes.

Once I send from it then I have to take care to see where the "change" was sent.

Only if you care to know.  The wallet program generally takes care of keeping track of all this for you.

I could then recombine my new address's "change" back with my original address, can I not?  Thus having my total under one address again.

If you want it all associated with the original address you could.  All you'd have to do is create a single transaction that sends your entire balance to the address where you want it.  Depending on how many outputs you have and how large the balance is, you might end up having to spend some of that balance in transaction fees.

I suppose there is a reason this is not done?

Security and Anonymity.

Regarding anonymity: reusing addresses allows those who have engaged in transactions with you in the past to know how much bitcoin you have moving through those addresses.  By using a new address for every transaction, it becomes much more difficult for anyone to know how much bitcoin you have stored in other addresses.

Regarding security: bitcoins stored at an address that has never sent any bitcoins anywhere have three levels of cryptography between the private key and the publicly available bitcoin address (ECDSA, SHA-256, and RIPEMD-160).  Once you spend bitcoins from an address the public key of the address becomes public knowledge.  After that the only layer of security is the ECDSA algorithm between the private key and the public key.  This means that if a weakness is ever discovered in the ECDSA algorithm, bitcoins that are stored at addresses that have previously sent bitcoins will become vulnerable to the weakness.  Meanwhile, the bitcoins that are stored at addresses that have only ever received bitcoins are not vulnerable unless weaknesses are simultaneously discovered in all three algorithms.
ModusPwnd (OP)
Member
**
Offline Offline

Activity: 546
Merit: 10



View Profile
February 19, 2013, 04:19:01 AM
 #8

It all makes very good sense now.  Thanks for taking the time to answer my questions specifically!
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
February 19, 2013, 04:27:39 AM
 #9

It all makes very good sense now.  Thanks for taking the time to answer my questions specifically!
You're welcome.

If you have other questions you can ask them in this thread or start a new one.  There are plenty of very knowledgeable people at this forum who are willing to help beginners learn as much as they'd like.
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!