Bitcoin Forum
April 26, 2024, 05:05:36 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Wallets  (Read 1517 times)
chufchuf (OP)
Full Member
***
Offline Offline

Activity: 205
Merit: 100


View Profile
December 14, 2012, 10:54:28 AM
 #1

If you have one client, add 1 bitcoin to it, save the wallet. Then a week later, add another bitcoin, and save that wallet.

After that, you setup two clients. One with the newer wallet, the other with the older wallet.

Is there danger of wallet corruption?

Or will one wallet painlessly acknowledge the disappearance of a bitcoin if the other wallet sells it? There will be no synchronizing problems the network saying the bitcoin is in two different wallets?

thanks in advance for answering this most probably stupid question
1714151136
Hero Member
*
Offline Offline

Posts: 1714151136

View Profile Personal Message (Offline)

Ignore
1714151136
Reply with quote  #2

1714151136
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
December 14, 2012, 11:35:04 AM
 #2

Or will one wallet painlessly acknowledge the disappearance of a bitcoin if the other wallet sells it? There will be no synchronizing problems the network saying the bitcoin is in two different wallets?

The term "wallet" is used because it is a term that people are familiar with, and thus the software was built to follow the concept of a wallet and would then be familiar as well.

But technically, a Bitcoin wallet never receives coins.

A wallet holds private keys that are needed in order to spend coins.

In your example, both clients would have the exact same balance and show the exact same transactions.

This occurs because even the wallet saved prior to the second transaction already had the private key for the second transaction.  This is because the Bitcoin.org client has a pool of unused addresses (pool size is 100 addresses).  

It does this so that you don't need to back up after every single time you click "New Address".


Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


chufchuf (OP)
Full Member
***
Offline Offline

Activity: 205
Merit: 100


View Profile
January 23, 2013, 04:04:54 AM
 #3

Thanks for the response.

https://en.bitcoin.it/wiki/Wallet#cite_note-1

The bitcoin wiki talks about 'weird behaviour' when using the example I gave above. Do I understand correctly that this issue was in your opinion resolved? Or just to not use the wallets on different PCs at the same time?

Sorry to bump this thread, but as a related question, if two bitcoin wallets are used on the same IP, the same NAT installation or router connection, does this create confusion for the bitcoin world of nodes and such?

Basically all we have to worry about is transporting the wallet data file to whatever client we want it on, and they'll show instantaneously if it's up to date?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
January 23, 2013, 01:34:12 PM
 #4

Thanks for the response.

https://en.bitcoin.it/wiki/Wallet#cite_note-1

The bitcoin wiki talks about 'weird behaviour' when using the example I gave above. Do I understand correctly that this issue was in your opinion resolved? Or just to not use the wallets on different PCs at the same time?

Sorry to bump this thread, but as a related question, if two bitcoin wallets are used on the same IP, the same NAT installation or router connection, does this create confusion for the bitcoin world of nodes and such?

Basically all we have to worry about is transporting the wallet data file to whatever client we want it on, and they'll show instantaneously if it's up to date?

"The bitcoin world of nodes and such" don't care how many copies of a wallet you are running or where.  It won't create a problem for them.

It will however eventually create a problem for you.

One reason is due to how the wallets handle "change" from a transaction and the fact the Bitcoin-Qt wallet does not use a deterministic algorithm to generate new addresses, instead new addresses are entirely random.

When you receive bitcoins you receive an "output" from a transaction.  Each of these "outputs" are entirely separate.  So if you receive the following three separate transactions at a single address: 5 BTC, 10 BTC and 8 BTC, your wallet might display a balance of 23 BTC but what you really have is 3 unspent outputs.

If you then want to send 2 BTC somewhere, the client will have to completely spend one of these outputs. As an analogy you can think of them as three "coins", one stamped 5 BTC, one stamped 8 BTC, and one stamped 10 BTC.  Lets assume for the moment that the client chooses to spend the 5 BTC output for the 2 BTC transaction that you are creating. . .  

It creates a transaction that uses the previous 5 BTC output as an input.  Also included in the transaction is at least one new output of 2 BTC to the address you are sending to.  In this case, what happens to the remaining 3 BTC?  If the total of all the inputs in a transaction is higher than the total of all the outputs, then the difference is kept by the miner that adds the transaction to a block.  This is how transaction fees work.

Since you probably don't want to pay a 3 BTC transaction fee for this transaction, you'll want/need a second output in this transaction to do something with that extra 3 BTC.  The way the Bitcoin-Qt wallet handles this is to grab a new unused bitcoin address from its address pool and include a second output in the transaction sending this 3 BTC to that new address.  Since this isn't an address that you requested in the user interface it doesn't show this address to you in the "Receive Coins" tab.  It keeps it entirely hidden from you.  The wallet is aware that it sent the bitcoins to the address so it knows to include the amount of bitcoins associated with the address in the balance that it shows you.  It also knows that it can pull the 3 BTC output from that address when creating a new transaction in the future if needed.

Since the wallet just used an address from the addres pool, it must now create a new address to add to the address pool.  This new address is entirely random.  There is no way for the other copy of your wallet to know what this address is, and no way for it to generate the same address for itself.  As the client slowly uses up the addresses that were in the address pool at the time that you made the copy, eventually all the addresses in the address pool are new and the other copy of the wallet isn't aware of any of them.  The next time that you send a transaction, the change goes to an address that only one copy of the wallet knows about.  The bitcoins simply vanish from the other wallet.

That is just one example of the type of odd behavior you can expect.

It is possible for 2 blocks to be solved by 2 different miners at nearly the same moment.  It is possible for a transaction that you send (or receive) to only be included by one of those miners.  If this happens, it is possible that one copy of the wallet will receive the block from one miner, and the other copy will receive the block from the other miner.  One wallet will show 1 confirmation, the other will show 0 confirmations.  Eventually the network will work out which block will become the "real" block, and the confirmations will match between the 2 wallets, but until one of the blocks is orphaned, your multiple copies of wallets won't show the same number of confirmations.


There is other odd behavior, and problems you can create for yourself (accidental double-spend attempts for example).  It is not a good idea to actively use copies of the same Bitcoin-Qt wallet.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 23, 2013, 02:07:45 PM
 #5

There is other odd behavior, and problems you can create for yourself (accidental double-spend attempts for example).  It is not a good idea to actively use copies of the same Bitcoin-Qt wallet.

Danny is *spot on* here (and I have played around with the dangerous "raw tx" area to know 1st hand the consequences of how you can screw up and lose money if you are not extremely careful).

When the bitcoin-qt client can handle "multiple wallets" (which other clients already can) then things will be a little easier to manage but until that point (and probably even after) you need to be very careful with how you manage your coins wrt wallets.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
chufchuf (OP)
Full Member
***
Offline Offline

Activity: 205
Merit: 100


View Profile
January 24, 2013, 02:20:08 AM
 #6

Hey, thanks for that detailed response.

I had to break that up into bits and pieces to make sure I had it right, but I think I understand it now.

So what you're saying is there's a pool of limited ''hidden'' addresses the Bitcoin desktop client uses to store whatever's left from whatever someone paid the client at any given moment of time.

Can't thank you enough for warning me about that particularity.

How many hidden addresses are in the pool, btw? You're saying that at any given moment in time, a wallet has a limited amount of hidden addresses, and that if we spend from a copy of the wallet, the other copy won't see the hidden address and the cash that was left over. But that it will only apply if the number of hidden addresses have gone beyond the ones available the time the cold wallet was created.

Does this flaw in any way apply to visible addresses? Say you stored a cold copy of the wallet, and only received outputs into the online wallet. As there are only new visible addresses, the kind we can see on the desktop client, and the client has only been receiving outputs, not spending anything, will there be no problem if the cold wallet is then used on another operating system with another desktop client, not to start combining the use of the two as you say that'd be insecure, but just to show up on the cold wallet the outputs received by the other wallet and to never use the other wallet again?

What about these other instances, can there be funny business in them too:

Can a bitcoin-qt crash a computer because it's somehow detecting another bitcoin-qt on the same NAT, or something the client does overloads the RAM or the block updates are hitting a sensitive part of the hard drive that may be half broken?

If I haven't spent any outputs, just putting the wallet dat in another computer will bring no issues? What about if the client with this said wallet is crashing and hasn't seen a recent version of the blockchain update, will it still update the new bitcoin-qt on the new pc with its balance?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
January 24, 2013, 02:59:53 PM
Last edit: January 29, 2013, 08:52:10 PM by DannyHamilton
 #7

I really don't understand why you want to try to run two copies of the same wallet.  The example I gave is just one example of how and why you might experience 'weird behaviour'.  This client is not designed to be running multiple copies simultaneously.  You won't hurt the network or anyone else, but you most likely will create a mess for yourself, and unless you understand all the inner workings and are very careful, you will probably eventually end up permanently losing some bitcoins.

Depending on what you are trying to do, you might find that you can accomplish it better with an Armory or Electrum wallet.  You also may want to look into using a web based wallet like https://blockchain.info/wallet


So what you're saying is there's a pool of limited ''hidden'' addresses the Bitcoin desktop client uses to store whatever's left from whatever someone paid the client at any given moment of time.
It sounds like you probably understood that part.

How many hidden addresses are in the pool, btw?
There are two pools of hidden addresses:

The addresses that are currently being used to hold the change from previous transactions are hidden.  The quantity of addresses hidden in this way will be less than (or equal to) the total number of outgoing transactions.

There is also a pool of hidden unused addresses.  This is the list of addresses that the client chooses from whenever it needs a new address.  So if you click the "New Address" button in the user interface of the wallet, it gets the address from this hidden pool. If it needs a new address to store the change from a transaction, it also gets that address from this pool.  The size of this hidden pool is configurable, but the default is 100 addresses.  Anytime the client removes an address from this pool, it randomly generates a new address and adds it to the pool as a replacement.

This means that if you make two copies of your wallet and run both at the same time, and then start clicking on the "New Address" button in both copies simultaneously, the first 100 addresses that you receive will be identical in both wallets, but when you click the button the 101st time, you will get a different address in each copy of the wallet.

You're saying that at any given moment in time, a wallet has a limited amount of hidden addresses, and that if we spend from a copy of the wallet, the other copy won't see the hidden address and the cash that was left over. But that it will only apply if the number of hidden addresses have gone beyond the ones available the time the cold wallet was created.
That sounds about right.  Hard to tell by the way you phrased it, but I think you've got it right.

Does this flaw in any way apply to visible addresses?
This is not a flaw.  This is a feature.  It is intentionally designed this way so that you don't have to store a fresh backup of your wallet everytime you send a transaction or click "New Address".  If you don't like the way this is designed, you might prefer one of the other bitcoin wallets I mentioned.

Say you stored a cold copy of the wallet
"Cold copy" might not mean what you think it does.  I'll need you to explain a bit better, but I'll do the best I can to answer your next few questions.

. . . and only received outputs into the online wallet. As there are only new visible addresses, the kind we can see on the desktop client, and the client has only been receiving outputs, not spending anything, will there be no problem if the cold wallet is then used on another operating system with another desktop client, not to start combining the use of the two as you say that'd be insecure, but just to show up on the cold wallet the outputs received by the other wallet and to never use the other wallet again?
The "new visible addresses" come from the hidden pool.  When you click "New Address" on one copy of the wallet, the other wallet doesn't know that you've done this, so the address won't show up in the "visible address" list in "Receive Coins" on the other wallet.  Depending on how many addresses you've used so far, the other wallet might see the bitcoins when they are sent because the "new address" in the first wallet exists in the hidden address pool of the other wallet.  If it does see the bitcoins, it won't know if those were change or not, so I don't think it will show the address in the "Receive Coins" tab of the wallet (if you are lucky it will see the received coins as change and include them in the balance while keeping the address hidden from you).

Can a bitcoin-qt crash a computer because it's somehow detecting another bitcoin-qt on the same NAT
I wouldn't expect that.

or something the client does overloads the RAM or the block updates are hitting a sensitive part of the hard drive that may be half broken?
It is pretty well written and robust, but certainly there is always potential for any program to have issues if it requires more RAM than is available or is running on a hard drive that may be half broken.  It would be a good idea to create a backup of the wallet on a regular schedule and keep the last several backups in case a backup is damaged.

If I haven't spent any outputs, just putting the wallet dat in another computer will bring no issues?
Just "putting" it there, No.  Using it there, yes.

What about if the client with this said wallet is crashing and hasn't seen a recent version of the blockchain update, will it still update the new bitcoin-qt on the new pc with its balance?
That depends on how recent the copy on the new PC is.  If it is a recent enough copy, it will still have enough addresses in the address pool that match the original wallet, so as long as this copy of the wallet has access to the blockchain your balance will show up there.
chufchuf (OP)
Full Member
***
Offline Offline

Activity: 205
Merit: 100


View Profile
January 29, 2013, 08:27:32 PM
 #8

Thanks for the detailed response, again

Does this flaw in any way apply to visible addresses?
This is not a flaw.  This is a feature.  It is intentionally designed this way so that you don't have to store a fresh backup of your wallet everytime you send a transaction or click "New Address".  If you don't like the way this is designed, you might prefer one of the other bitcoin wallets I mentioned.

If it isn't a flaw, why aren't there unlimited addresses that would prohibit the dying out of some addresses and the lack of confusion between different copies of what starts out as the same wallet?

If I haven't spent any outputs, just putting the wallet dat in another computer will bring no issues?
Just "putting" it there, No.  Using it there, yes.

What I do see is that if two wallets on two clients are placed online and used, there'll be trouble. But will there also be trouble if a wallet is transferred from a client on a first PC to a client on a second PC, and then continued use as if nothing happened?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
January 29, 2013, 08:49:51 PM
 #9

Thanks for the detailed response, again

Does this flaw in any way apply to visible addresses?
This is not a flaw.  This is a feature.  It is intentionally designed this way so that you don't have to store a fresh backup of your wallet everytime you send a transaction or click "New Address".  If you don't like the way this is designed, you might prefer one of the other bitcoin wallets I mentioned.

If it isn't a flaw, why aren't there unlimited addresses that would prohibit the dying out of some addresses and the lack of confusion between different copies of what starts out as the same wallet?
I probably went a bit to far in saying that it isn't a flaw.  It's just important to understand that the Bitcoin-Qt client isn't designed to be running concurrently in multiple places, nor is it designed to be able to switch back and forth between multiple copies of the wallet.  It works as designed.  Attempting to use it in a way for which it wasn't designed is a mistake.  Does a banana have a flaw if I try to use it to hammer in a nail?  Does the hammer have a flaw in design if I try to use it to paint the walls of my house?

If I haven't spent any outputs, just putting the wallet dat in another computer will bring no issues?
Just "putting" it there, No.  Using it there, yes.
What I do see is that if two wallets on two clients are placed online and used, there'll be trouble. But will there also be trouble if a wallet is transferred from a client on a first PC to a client on a second PC, and then continued use as if nothing happened?
If you are going to ignore the intended/designed use, you are going to be taking chances of causing yourself problems.  To answer whether an action is going to have trouble, you'll need to be very specific about what actions are taken on each copy of the wallet, and when, and how.  If you learn how Bitcoin-Qt works, and you are very very careful, it is possible to keep two copies of the same wallet synchronized and running without encountering "trouble".  However, a small mistake in action will create a big mess and quite likely lead to a permanent loss of bitcoin.
chufchuf (OP)
Full Member
***
Offline Offline

Activity: 205
Merit: 100


View Profile
January 29, 2013, 10:47:31 PM
 #10

If I haven't spent any outputs, just putting the wallet dat in another computer will bring no issues?
Just "putting" it there, No.  Using it there, yes.
What I do see is that if two wallets on two clients are placed online and used, there'll be trouble. But will there also be trouble if a wallet is transferred from a client on a first PC to a client on a second PC, and then continued use as if nothing happened?
If you are going to ignore the intended/designed use, you are going to be taking chances of causing yourself problems.  To answer whether an action is going to have trouble, you'll need to be very specific about what actions are taken on each copy of the wallet, and when, and how.  If you learn how Bitcoin-Qt works, and you are very very careful, it is possible to keep two copies of the same wallet synchronized and running without encountering "trouble".  However, a small mistake in action will create a big mess and quite likely lead to a permanent loss of bitcoin.

I see, precision is the safest bet. Well, a PC with a bitcoin client isn't working well and I want to move the wallet to another client on another newer PC. I don't ever intend on turning on the old PC and its client ever again.

I was able to extract a copy of the wallet, the wallet.dat file, from the old PC today. The blockchain the old client was seeing though is very much stuck in time from about November. All I have to do is copy the wallet into the new PC and client, and never ever never never never touch the old setup on the old PC because that would create synchronicity issues, no?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
January 29, 2013, 10:55:31 PM
 #11

I see, precision is the safest bet. Well, a PC with a bitcoin client isn't working well and I want to move the wallet to another client on another newer PC. I don't ever intend on turning on the old PC and its client ever again.

I was able to extract a copy of the wallet, the wallet.dat file, from the old PC today. The blockchain the old client was seeing though is very much stuck in time from about November. All I have to do is copy the wallet into the new PC and client, and never ever never never never touch the old setup on the old PC because that would create synchronicity issues, no?
Yes.  This will work well.

Copy the wallet.dat to the new computer with the new client (keep a copy of this wallet.dat somewhere safe as well in case you make a mistake and accidentally damage or overwrite the file when you are trying to install it on the new computer).

When the new client is done downloading the blockchain, you will see all of your bitcoins on the new computer.  Do not use the wallet.dat on the old computer at all.
btctrada
Newbie
*
Offline Offline

Activity: 48
Merit: 0



View Profile
February 06, 2013, 02:31:01 PM
 #12

I see, precision is the safest bet. Well, a PC with a bitcoin client isn't working well and I want to move the wallet to another client on another newer PC. I don't ever intend on turning on the old PC and its client ever again.

I was able to extract a copy of the wallet, the wallet.dat file, from the old PC today. The blockchain the old client was seeing though is very much stuck in time from about November. All I have to do is copy the wallet into the new PC and client, and never ever never never never touch the old setup on the old PC because that would create synchronicity issues, no?
Yes.  This will work well.

Copy the wallet.dat to the new computer with the new client (keep a copy of this wallet.dat somewhere safe as well in case you make a mistake and accidentally damage or overwrite the file when you are trying to install it on the new computer).

When the new client is done downloading the blockchain, you will see all of your bitcoins on the new computer.  Do not use the wallet.dat on the old computer at all.

Thanks for the explanation! Is there a way of seeing (or downloading) all addresses which contain unspent outputs?

Cheers
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
February 06, 2013, 03:07:24 PM
 #13

. . . Thanks for the explanation! Is there a way of seeing (or downloading) all addresses which contain unspent outputs? . . .
For most users, this isn't useful information, so the Bitcoin-Qt client doesn't provide it anywhere in the user interface.

If you really want to see the information you can get it:

  • Click on the "Help" menu
  • Select (click on) "Debug window"
  • In the debug window, click "Console"
  • Enter the following into the Console:

Code:
listunspent

Wait while the client scans for all unspent outputs.

You should eventually get a list of items that look like this:
 
Code:
{
"txid" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"vout" : 1,
"scriptPubKey" : "ffffffffffffffffffffffffffffffffffffffffffffffffff",
"amount" : #.########,
"confirmations" : #
},
The txid is the transaction hash where the output was created
The vout indicates which output from that transaction (the first output is output 0, the second output is output 1, etc).
The scriptPubKey is the Hex representation of the bitcoin address
The amount is the value of the output expressed in bitcoins
The confirmations is the number of confirmations the output transaction has received
btctrada
Newbie
*
Offline Offline

Activity: 48
Merit: 0



View Profile
February 06, 2013, 03:11:49 PM
 #14

Thanks Danny

Anyway in blockchain.info? So theoretically your unspent outputs, should match the coins in your wallet?

Thanks again... Smiley
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
February 07, 2013, 07:29:31 PM
 #15

Anyway in blockchain.info?
If you are using the web hosted wallet at https://blockchain.info/wallet

You can see your total unspent balances for each address by clicking on ""Send Money"



Then click on "Custom" transaction type



You'll see the addresses that you have set up and what total balance is associated with each address in the "From" section



I don't know of a way to see the individual unspent outputs in a blockchain.info wallet, only the total of all unspent outputs for each address.

The following method will work no matter what wallet you use, but requires you to do some processing.

If you replace YOUR_ADDRESS_HERE in the following link with an actual bitcoin address:

https://blockchain.info/address/YOUR_ADDRESS_HERE

Then you can see all outputs and inputs sent from or received at the address.  It you start with the oldest transaction involving the address and work towards the most recent transaction listing outputs as they are received and then removing outputs from your list as they are spent, when you are done you will have a list of unspent outputs.

So theoretically your unspent outputs, should match the coins in your wallet?
Yes. Unless you have a corrupted wallet, the bitcoin balance in your wallet will always be the sum of all unspent outputs associated with all the addresses stored in your wallet.  That is the definition of a bitcoin balance.
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!