Bitcoin Forum
May 05, 2024, 10:32:23 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question about shared wallet  (Read 507 times)
Uniex (OP)
Jr. Member
*
Offline Offline

Activity: 115
Merit: 2


View Profile
November 18, 2017, 07:20:10 PM
 #1

If I copy my wallet.dat to another computer and generate new address on old computer and then send to new generated address 1 BTC,
will the wallet.dat on another computer be updated with new address and btc?

If yes - why its possible ?
1714905143
Hero Member
*
Offline Offline

Posts: 1714905143

View Profile Personal Message (Offline)

Ignore
1714905143
Reply with quote  #2

1714905143
Report to moderator
1714905143
Hero Member
*
Offline Offline

Posts: 1714905143

View Profile Personal Message (Offline)

Ignore
1714905143
Reply with quote  #2

1714905143
Report to moderator
1714905143
Hero Member
*
Offline Offline

Posts: 1714905143

View Profile Personal Message (Offline)

Ignore
1714905143
Reply with quote  #2

1714905143
Report to moderator
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
November 18, 2017, 07:45:18 PM
 #2

If I copy my wallet.dat to another computer and generate new address on old computer and then send to new generated address 1 BTC,
will the wallet.dat on another computer be updated with new address and btc?

If yes - why its possible ?
It depends, depending on your wallet, you may not see the new address or the Bitcoin.

The Bitcoin Core wallet (and most other wallets) have this thing called the keypool. The keypool is just several (Bitcoin Core defaults to 1000) keys and their addresses that are pregenerated. When you get a new address, you are given a key from the keypool and a new key is generated and placed into the keypool. This is useful for encrypted wallets where you can get addresses and public keys without needing to decrypt your wallet first.

So if your wallet has a full keypool, then yes, you would see the new address and the Bitcoin on your other computer as it would see the transaction for a key in your keypool.

However your keypool may not be full. You could have taken all the keys from the keypool. If your wallet is not an HD wallet (so Bitcoin Core wallets made prior to Bitcoin Core 0.13.0), then once you have retrieved the keys from the keypool, all keys after that will not be the same (aka any newly generated keys are not the same). This is because they are randomly generated.

If your wallet is an HD wallet (Bitcoin Core wallets make with Bitcoin Core 0.13.0 and later) then you will be able to get the same keys after the keypool is exhausted. This is because the wallet generates keys in a deterministic manner from a given seed that is stored in the wallet. So you will generate the same keys when the keypool is refreshed.

Uniex (OP)
Jr. Member
*
Offline Offline

Activity: 115
Merit: 2


View Profile
November 18, 2017, 07:49:39 PM
 #3

If I copy my wallet.dat to another computer and generate new address on old computer and then send to new generated address 1 BTC,
will the wallet.dat on another computer be updated with new address and btc?

If yes - why its possible ?
It depends, depending on your wallet, you may not see the new address or the Bitcoin.

The Bitcoin Core wallet (and most other wallets) have this thing called the keypool. The keypool is just several (Bitcoin Core defaults to 1000) keys and their addresses that are pregenerated. When you get a new address, you are given a key from the keypool and a new key is generated and placed into the keypool. This is useful for encrypted wallets where you can get addresses and public keys without needing to decrypt your wallet first.

So if your wallet has a full keypool, then yes, you would see the new address and the Bitcoin on your other computer as it would see the transaction for a key in your keypool.

However your keypool may not be full. You could have taken all the keys from the keypool. If your wallet is not an HD wallet (so Bitcoin Core wallets made prior to Bitcoin Core 0.13.0), then once you have retrieved the keys from the keypool, all keys after that will not be the same (aka any newly generated keys are not the same). This is because they are randomly generated.

If your wallet is an HD wallet (Bitcoin Core wallets make with Bitcoin Core 0.13.0 and later) then you will be able to get the same keys after the keypool is exhausted. This is because the wallet generates keys in a deterministic manner from a given seed that is stored in the wallet. So you will generate the same keys when the keypool is refreshed.

Thanks for explanation, yes I have Bitcoin Core - now that's clear for me
neurotypical
Hero Member
*****
Offline Offline

Activity: 672
Merit: 502


View Profile
November 22, 2017, 05:39:07 PM
 #4

If I copy my wallet.dat to another computer and generate new address on old computer and then send to new generated address 1 BTC,
will the wallet.dat on another computer be updated with new address and btc?

If yes - why its possible ?
It depends, depending on your wallet, you may not see the new address or the Bitcoin.

The Bitcoin Core wallet (and most other wallets) have this thing called the keypool. The keypool is just several (Bitcoin Core defaults to 1000) keys and their addresses that are pregenerated. When you get a new address, you are given a key from the keypool and a new key is generated and placed into the keypool. This is useful for encrypted wallets where you can get addresses and public keys without needing to decrypt your wallet first.

So if your wallet has a full keypool, then yes, you would see the new address and the Bitcoin on your other computer as it would see the transaction for a key in your keypool.

However your keypool may not be full. You could have taken all the keys from the keypool. If your wallet is not an HD wallet (so Bitcoin Core wallets made prior to Bitcoin Core 0.13.0), then once you have retrieved the keys from the keypool, all keys after that will not be the same (aka any newly generated keys are not the same). This is because they are randomly generated.

If your wallet is an HD wallet (Bitcoin Core wallets make with Bitcoin Core 0.13.0 and later) then you will be able to get the same keys after the keypool is exhausted. This is because the wallet generates keys in a deterministic manner from a given seed that is stored in the wallet. So you will generate the same keys when the keypool is refreshed.

Is there any command that will give me the amount of used keys from the keypool? I don't know if i have passed 1000 yet or not.

What happens when you pass 1000 then? can I keep using the same wallet.dat file because it will automatically create another keypool inside the same file so it generates batches of 1000 each time you use 1000? how many keypools can be generated? Its not clear to me how this works. I never updated to HD wallet so im using the same old wallet.dat for ages, im worried in case there is any problems if I pass 1000 addresses.
LoyceV
Legendary
*
Online Online

Activity: 3304
Merit: 16596


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
November 22, 2017, 05:55:31 PM
 #5

The Bitcoin Core wallet (and most other wallets) have this thing called the keypool. The keypool is just several (Bitcoin Core defaults to 1000) keys and their addresses that are pregenerated.
As far as I know, the default used to be 100 addresses, not 1000.

https://en.bitcoin.it/wiki/Running_Bitcoin :
Code:
 	-keypool=<n> 	Set key pool size to <n> (default: 100) 

My current Bitcoin Core 0.15.1:
Code:
  -keypool=<n>
       Set key pool size to <n> (default: 1000)

It seems recent versions use a larger default keypool, but it's something to keep in mind in case you're running an older version.


Is there any command that will give me the amount of used keys from the keypool? I don't know if i have passed 1000 yet or not.
Click Help > Debug window > Console > enter getwalletinfo

Mine says:
Code:
"keypoolsize": 998,
The keypool gets refilled up to 1000 every time you unlock the wallet with your passphrase. My 998 means I've used 2 addresses since the last time I unlocked it.

Quote
What happens when you pass 1000 then? can I keep using the same wallet.dat file because it will automatically create another keypool inside the same file so it generates batches of 1000 each time you use 1000? how many keypools can be generated? Its not clear to me how this works. I never updated to HD wallet so im using the same old wallet.dat for ages, im worried in case there is any problems if I pass 1000 addresses.
Let's take my wallet as an example. If I make a backup now, my backup holds the private keys to 998 unused addresses.
My wallet has no problem creating more addresses, suppose I receive payments to 1200 new unique addresses. That will work just fine, my keypool gets refilled up to 1000 each time I unlock my wallet. But, all payments I receive to the last 202 addresses, won't be included in my current backup!

For this reason it's important to make a new backup once in a while. I do it often enough to be absolutely sure I don't get close to using the entire 1000 addresses in my keypool. (in reality I do it more like every 10 addresses already, you can never have enough backups)

Note that changing or setting a password also flushes your keypool (for security reasons), and requires you to make a new backup.

jnano
Member
**
Offline Offline

Activity: 301
Merit: 74


View Profile
November 25, 2017, 10:23:56 PM
Last edit: November 25, 2017, 10:36:07 PM by jnano
 #6

Was it implied here that Core watches for transactions for all pre-generated keypool addresses, even addresses that haven't become visible yet in the GUI?

A comment to the OP:
Note that even if the balance updates properly, still the labels of the receive addresses won't magically appear in the other wallet instance.



LoyceV
Legendary
*
Online Online

Activity: 3304
Merit: 16596


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
November 25, 2017, 10:46:00 PM
 #7

Was it implied here that Core watches for transactions for all pre-generated keypool addresses, even addresses that haven't become visible yet in the GUI?
Yes, that is correct. I've actually tested this when I had my backup-wallet running on another laptop for a while.

Quote
A comment to the OP:
Note that even if the balance updates properly, still the labels of the receive addresses won't magically appear in the other wallet instance.
This is quite annoying indeed.

jnano
Member
**
Offline Offline

Activity: 301
Merit: 74


View Profile
November 26, 2017, 04:38:09 AM
 #8

So these addresses would also be automatically added to the visible "receive addresses" list?

If so, on HD wallets I guess it would automatically refill the keypool with the same keys as in the main wallet, check for any transactions on these new keys, and repeat until there are no more. Sounds convenient.

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!