Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: nicknike on November 28, 2017, 02:41:30 AM



Title: Producing a deterministic wallet
Post by: nicknike on November 28, 2017, 02:41:30 AM
Hi, I've looked at many locations across the internet and asked 'experts', but I cannot find what I need.


I have wallet.dat stored on several USB and SD flash drives and use Bitcoin.qt v15.1.
I’m just sitting on the bitcoins at present so will not be actively buying or selling.
I believe these storage devices are not ideal as they can age and corrupt the dat file.
I’m thinking that writing the relevant information to paper may be the best system.

1) I’m reading about deterministic wallets where mnemonic words can be used to reclaim bitcoins.
I cannot find a step by step set of instructions of how to do this. I’m finding loads of deep theory information or just plain dreadful explanations.
Have I understood this correctly? Can a set of words be written down on paper and used to reclaim the bitcoins? If so, would you kindly supply a line-by-line account of the procedure?

2) Also, is another method to write down the private key and public keys on paper? If so, how are these obtained and then how are they input back into Bitcoin.qt?

I would appreciate any help on this. I don't understand why the Bitcoin-qt site doesn't show these instructions, or am I just not finding them.


Title: Re: Producing a deterministic wallet
Post by: jnano on November 28, 2017, 07:06:25 AM
I think Core doesn't support mnemonic seeds (BIP39). It only supports the hierarchical deterministic (HD) wallets (BIP32).

Not sure about dumping/restoring HD wallet seed.


Title: Re: Producing a deterministic wallet
Post by: mocacinno on November 28, 2017, 07:09:18 AM
the "step by step" version is really, really easy:

1) download the standalone version of electrum
2) disconnect your internet, start electrum, create a new wallet, write down the seed words, generate a new deposit address
3) close electrum, remove the wallet file, try to restore the wallet from seed, check if the first generated deposit address matches the one in step 2)
4) delete the wallet again, reboot, reconnect to the internet, fund the address generated in step 2 (and 3, since that's the same address)
5) make safe copies of your words, don't let the touch a computer, laminate the paper, only store it in a very safe spot, or maybe even use something like https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing (only run such a tool on an offline pc if you want to enter your seed, and always double check if you can restore the seed before burning your original copy!!!)

The thing is: you'll have to move your funds from bitcoin-qt to (in this case) electrum. bitcoin-qt doesn't use a mnemonic at this point (afaik).

There are other ways to achieve the same thing, like using python to convert a random seed to an xprv, then use a fixed derivation path to derive private keys from this xprv, then use the private key to generate a public key, and the public key to generate an address... Or there are downloadable tools like https://github.com/iancoleman/bip39... But i think electrum is the most user friendly way to achieve your goal :)


Title: Re: Producing a deterministic wallet
Post by: bob123 on November 28, 2017, 09:57:55 AM
There are other ways to achieve the same thing, like using python to convert a random seed to an xprv, then use a fixed derivation path to derive private keys from this xprv, then use the private key to generate a public key, and the public key to generate an address...

Python is pretty suitable for this imo. The bitcoin-python libary is pretty user friendly.
With bitcoin-python its basically just this to create the priv-/pub key pair out of a seed:

Code:
priv = sha256('ultrasecure password phrase')

pub = privtopub(priv)
addr= pubtoaddr(pub)

Now if you want to make a deterministic wallet you can modify your seed each time you generate a new address with a speficic pattern.
This way your (random) seed phrase is of course not importable to electrum or other wallets. You would have to calculate the priv key out of your seed 'manually' each time.


Title: Re: Producing a deterministic wallet
Post by: LoyceV on November 28, 2017, 11:34:38 AM
2) disconnect your internet, start electrum, create a new wallet, write down the seed words, generate a new deposit address
~
4) delete the wallet again, reboot, reconnect to the internet, fund the address generated in step 2 (and 3, since that's the same address)
I wouldn't rely on just this: malware is very patient, and very persistent. It's always safest to just assume you have malware that can record your data even when you're offline.
I prefer to use an Ubuntu LIVE CD for this, running entirely from memory, without any network connected. Once you turn off the PC, you can be absolutely sure nothing gets stored on your PC.

2) Also, is another method to write down the private key and public keys on paper? If so, how are these obtained and then how are they input back into Bitcoin.qt?
Any private key you create with any program can be written down if your handwriting is accurate enough. It's much easier to use software designed to create paper wallets. There are at least 2 I trust (and many more I don't trust!):
https://www.bitaddress.org
https://bitcoinpaperwallet.com/
Of course, here too, download the website, and run it offline from a Linux LIVE CD. Print it on a dumb laser printer (big office printers with hard drive can store data) with an USB-cable. You can use inkjet too, but it gets destroyed if your paper wallet ever gets wet.

Importing private keys into Bitcoin Core is easy:
Code:
Click Help > Debug window > Console > enter importprivkey "privkey" ( "label" ) ( rescan )


Title: Re: Producing a deterministic wallet
Post by: nicknike on November 28, 2017, 11:59:43 PM
Importing private keys into Bitcoin Core is easy:
Code:
Click Help > Debug window > Console > enter importprivkey "privkey" ( "label" ) ( rescan )

Many thanks everyone for the help.

I think writing the private key is easiest.

How do you use the code

Code:
enter importprivkey "privkey" ( "label" ) ( rescan )
?

What do I write in the console window?
Is it actually

importprivkey xxxxxxxxxx mybitcoinsatDec2017 rescan                          where xxxxxxxxxx is the private key and is "label" just a name for reference? What does (rescan) do and do I type it without the brackets?

Where do you find this information?

So do I just need the private key to reclaim my bitcoins. Are the public keys generated from the private key?

Also, in the bottom right of Bitcoin-qt is a button labelled HD. What does that do?

Thanks for you help. I'm on the verge of understanding this fully



One more question.
I bought and sold Bitcoins using a previous computer and I encrypted that Bitcoin-qt wallet.
I have just built a new computer, installed Bitcoin-qt 15.1 and downloaded the blockchain. Very pleased as it only took about 8 hours.  :o)
What happens now when I swap the default wallet.dat (that shows zeros) with my actual wallet.dat that holds all my Bitcoins.
Is the encryption in my wallet.dat file?
Or do I load my wallet.dat file and then encrypt the new Bitcoin-qt wallet, and if so can I use a different password?







Title: Re: Producing a deterministic wallet
Post by: mocacinno on November 29, 2017, 06:59:31 AM
--snip--
Is it actually

importprivkey xxxxxxxxxx mybitcoinsatDec2017 rescan                          where xxxxxxxxxx is the private key and is "label" just a name for reference? What does (rescan) do and do I type it without the brackets?
--snip--

That would be allmost correct, the rescan is either True or False not "rescan", just open the debug window, and enter this command... The label and the rescan are optional... You don't really need to enter those.
Where do you get the private key? Well, that was what the other posters and myself were telling you: you can use python (there is also a way to generate a script to derive keys from an xprv that can be written in python), or you use python to create a single private key (non hd), or you use bitaddress,...
Or you take the easy route and just use electrum for everything, in that case you don't need to worry about creating private keys and importing them...

One more question.
I bought and sold Bitcoins using a previous computer and I encrypted that Bitcoin-qt wallet.
I have just built a new computer, installed Bitcoin-qt 15.1 and downloaded the blockchain. Very pleased as it only took about 8 hours.  :o)
What happens now when I swap the default wallet.dat (that shows zeros) with my actual wallet.dat that holds all my Bitcoins.
Is the encryption in my wallet.dat file?
Or do I load my wallet.dat file and then encrypt the new Bitcoin-qt wallet, and if so can I use a different password?




No, if you swap your new (empty) wallet.dat with the old one, the encryption is still there.

As for the last question i found in your post: what does the HD mean: it means your new wallet is deterministic. It is deriving pk's=>public keys=>addrsses from an xprv, so you only need to backup your new wallet once.. .The non-deterministic wallets generate a random key each time you use a new address, so you need to backup this wallet at least every 100 actions you make.


Title: Re: Producing a deterministic wallet
Post by: LoyceV on November 29, 2017, 07:23:09 AM
importprivkey xxxxxxxxxx mybitcoinsatDec2017 rescan                          where xxxxxxxxxx is the private key and is "label" just a name for reference? What does (rescan) do and do I type it without the brackets?
The "rescan"-command is a boolean, you can enter "false" to disable the rescan. If you just leave it out, Bitcoin Core does a full rescan:
importprivkey xxxxxxxxxx mybitcoinsatDec2017

Quote
Where do you find this information?
Type help in the Console.

Quote
So do I just need the private key to reclaim my bitcoins. Are the public keys generated from the private key?
Yes. That's how Bitcoin works. But, if you're unsure about this, it's probably best not to be messing around with private keys until you understand this better. You wouldn't be the first to lose funds by mistake.

Quote
Also, in the bottom right of Bitcoin-qt is a button labelled HD. What does that do?
It's an indicator, not a button. It means you have an HD-wallet.

Quote
Thanks for you help. I'm on the verge of understanding this fully
Test it a few times, with low amounts. Get a feel for how it works.

Quote
I bought and sold Bitcoins using a previous computer and I encrypted that Bitcoin-qt wallet.
I have just built a new computer, installed Bitcoin-qt 15.1 and downloaded the blockchain. Very pleased as it only took about 8 hours.  :o)
What happens now when I swap the default wallet.dat (that shows zeros) with my actual wallet.dat that holds all my Bitcoins.
Is the encryption in my wallet.dat file?
Of course the encryption is in the wallet.dat, it wouldn't make sense any other way ;)

Quote
Or do I load my wallet.dat file and then encrypt the new Bitcoin-qt wallet, and if so can I use a different password?
Your old wallet may not be an HD-wallet, so if you change the password, you'll need to make new backups!


Title: Re: Producing a deterministic wallet
Post by: nicknike on November 29, 2017, 08:07:59 PM
Quote
I bought and sold Bitcoins using a previous computer and I encrypted that Bitcoin-qt wallet.
I have just built a new computer, installed Bitcoin-qt 15.1 and downloaded the blockchain. Very pleased as it only took about 8 hours.  :o)
What happens now when I swap the default wallet.dat (that shows zeros) with my actual wallet.dat that holds all my Bitcoins.
Is the encryption in my wallet.dat file?
Of course the encryption is in the wallet.dat, it wouldn't make sense any other way ;)

Quote
Or do I load my wallet.dat file and then encrypt the new Bitcoin-qt wallet, and if so can I use a different password?
Your old wallet may not be an HD-wallet, so if you change the password, you'll need to make new backups!
[/quote]

Thanks again, this is great.


If I load my bitcoin loaded wallet.dat file into the newly installed Bitcoin-qt, because you say the encryption is in my wallet.dat file, will the option to encrypt be greyed-out? (I'm not experimenting or doing anything until I fully understand).
I thought the idea of the encryption is to password protect the wallet.dat file? If the encryption is in the bitcoin loaded wallet.dat file, then if someone else gets hold of my file, the encryption protection would be meaningless?

When the bitcoin loaded wallet.dat is loaded into the newly installed bitcoin-qt, will I be able to transact straight away, ie, move bitcoins to my exchange, or do I at some stage enter the encryption password?

I was keen on preparing a paper wallet but frightened off as I'm reading that if loaded using the private key, and then spending a part of the total, my wallet becomes empty.

I think the easiest thing to do now is just make multiple copies of my wallet.dat file, on usb sticks and CD's. I read that USB's and any flash card may not be reliable long term. I would have thought CD copies will be reliable long term.

Thanks again for your help.







Title: Re: Producing a deterministic wallet
Post by: LoyceV on November 29, 2017, 08:22:57 PM
If I load my bitcoin loaded wallet.dat file into the newly installed Bitcoin-qt, because you say the encryption is in my wallet.dat file, will the option to encrypt be greyed-out? (I'm not experimenting or doing anything until I fully understand).
It'll look the same as it did before:
https://s18.postimg.org/jksra4w55/screen.gif
(I don't really understand the question, why would you think it would be different when it's the same wallet?)

Quote
I thought the idea of the encryption is to password protect the wallet.dat file? If the encryption is in the bitcoin loaded wallet.dat file, then if someone else gets hold of my file, the encryption protection would be meaningless?
I still don't understand your reasoning. Whoever gets hold of your wallet.dat, needs the password before he can use it.

Quote
When the bitcoin loaded wallet.dat is loaded into the newly installed bitcoin-qt, will I be able to transact straight away, ie, move bitcoins to my exchange, or do I at some stage enter the encryption password?
It works exactly the same as it does now: you make a transaction, and enter the password before sending.

Quote
I was keen on preparing a paper wallet but frightened off as I'm reading that if loaded using the private key, and then spending a part of the total, my wallet becomes empty.
That's why you should always spend the entire balance from a paper wallet at once. You can easily do that by sending it entirely to your own wallet (this is called swiping, very easy if you use a mobile wallet and QR-code), or you can send the change to another paper wallet (this is a bit more advanced, as you need to manually set the change address). You can even use the same paper wallet again, but that's less private and less secure (I do this sometimes though).
Think of any paper wallet as a very big dollar bill: you can take it out of your wallet, but you can't rip it in half and use only a part. You have to use the whole bill, and you have to safely store the change you receive afterwards.

The big warning to use the whole balance comes from this scenario: someone has a 100BTC paper wallet, uses his hot wallet to send 1BTC from the paper wallet to his friend, and then assumes the remaining 99BTC is still in the paper wallet. He removes his hot wallet, and it turns out his paper wallet is empty. His 99BTC was in the hot wallet now.

My advice: try it. Take a small amount, put it on a paper wallet, take it out, get a feel for it.

Quote
I think the easiest thing to do now is just make multiple copies of my wallet.dat file, on usb sticks and CD's. I read that USB's and any flash card may not be reliable long term. I would have thought CD copies will be reliable long term.
CDs age, flash drives age, hard drives can break down too. An easy solution is to make new backups on a regular basis, just like you should do with all your important data. And test your backups once in a while, to be sure they work and you know how to restore them.


Title: Re: Producing a deterministic wallet
Post by: nicknike on November 29, 2017, 10:19:34 PM
It works exactly the same as it does now: you make a transaction, and enter the password before sending.
I haven't done a transaction  for 2 years and I've forgotten procedure. Thanks for that info, it answers all my encryption questions.
Can I test the password somehow, instead of actually sending Bitcoins anywhere?

Quote
You can easily do that by sending it entirely to your own wallet (this is called swiping, very easy if you use a mobile wallet and QR-code
I don't have a mobile phone and what is QR-code? Can I send it to my exchange (Bitstamp) and then send it back to my Bitcoin-qt wallet? Does this somehow renew the private keys so I can spend a proportion and not lose the lot. I would have though that a private key would just reinstall the bitcoins into the bitcoin-qt wallet, and then normal transactions could take place.

My advice: try it. Take a small amount, put it on a paper wallet, take it out, get a feel for it.
How do I put a small amount on a paper wallet?



I'm sorry to bother you with all this stuff. I bought some bitcoins, transferred them to my bitcoin-qt wallet and backed up the wallet.dat file. I did spend some 2 years ago.
Trying to find concise instructions for making a paper wallet and dealing with this issue of losing the change has proved impossible.
Now they are worth insane amounts, I'm just too scared to experiment or do anything I'm not sure of.




Title: Re: Producing a deterministic wallet
Post by: HCP on November 30, 2017, 03:53:15 AM
Can I test the password somehow, instead of actually sending Bitcoins anywhere?
In the debug console... (Help -> Debug window -> console)... you can use the command:
Code:
walletpassphrase YOURPASSPHRASE 0
This will "unlock" your wallet for 0 seconds ;) (that is to say, it won't actually leave the wallet "unlocked"... but it lets you test the passphrase)

If the result you get is "null"... the passphrase is correct, otherwise you'll get an error message


Quote
How do I put a small amount on a paper wallet?
1. Create paper wallet
2. send small amount of btc to the paper wallet address


Title: Re: Producing a deterministic wallet
Post by: mocacinno on November 30, 2017, 06:29:02 AM
OP, it looks to me like you have a lot of questions, and doubts about how everything works... And that's completely fine :).
I'd rather see somebody asking questions instead of just trying something out and then having to ask for help to recover his/her funds.

Since you seem to be unsure about everything, my advice for you would be to start experimenting on the testnet... A tBTC has no value whatsoever, but most bigger wallets are also available on the testnet chain.

For core => create a bitcoin.conf file in the bitcoin data folder, and enter following string (without quotes) "testnet=1"
For electrum => create a shortcut to your electrum binary, adding the --testnet parameter
For paper wallets => https://bitaddress.org/?testnet=true

To get some tBTC => just google for "bitcoin testnet faucets", there are at least 3 working faucets

This way, you can easily create paper wallets, fund them, play around with core's wallet.dat encryption, sweep, import,... Worst case scenario you lose a couple tBTC, setting you back $0 (in fiat)


Title: Re: Producing a deterministic wallet
Post by: nicknike on December 03, 2017, 04:28:30 PM
Many thanks for all the help.

What I have achieved and learnt.

Before I did any of this, I actually paid for a Malwarebytes license and scanned my machine regularly. A good investment when considering the value of Bitcoins.
BTW, great help was given about paper storage, but meant changing wallets and I wanted to stay with Bitcoin-QT

1) Reminded that my wallet encryption password is contained in the wallet.dat file.
2) How to test the password easily, using walletpassphrase YOURPASSPHRASE 0 in the Console window. I typed the code in the long box at the bottom, highlighted and hit Enter. I couldn't see a button to activate this.
The result was Null in the console window, thus showing the password was correct
3) Updated backups on SD cards and DVD disks so to keep them 'active'. I'm told cards can age and files get corrupted. I'm thinking DVDs should have a reasonable life.
4) Still somewhat confused about getting information about paper wallets.
I'm going to use Bitaddress.org to obtain my private key so I will have a paper record. I know there is a problem using this key if only some Bitcoins are spent, as the 'change' disappears. But if I need to use my private key in the future, I will then research how to use it thoroughly. I know it can restore my Bitcoins, and that will do for now.

Thanks again for your help.




Title: Re: Producing a deterministic wallet
Post by: jnano on December 03, 2017, 06:09:32 PM
3) Updated backups on SD cards and DVD disks so to keep them 'active'. I'm told cards can age and files get corrupted. I'm thinking DVDs should have a reasonable life.
Flash may indeed deteriorate after a few years but also DVDs aren't immune. But with quality media, for example Verbatim, I'd put my bets on DVDs being more likely to be OK after 10 years.

If you want to look further into that, there's also the M-Disc disc variants, which claim to be more durable than "normal" discs.
Also, I think in general Bluray (not LTH) might be more durable than DVD.


Title: Re: Producing a deterministic wallet
Post by: LoyceV on December 03, 2017, 07:08:22 PM
Flash may indeed deteriorate after a few years but also DVDs aren't immune. But with quality media, for example Verbatim, I'd put my bets on DVDs being more likely to be OK after 10 years.
I wouldn't bet my money on it though!

But if you want to go HD, you can simply store your seed words in steel (https://cryptosteel.com/)! Or get a $10 letter punch off eBay.


Title: Re: Producing a deterministic wallet
Post by: jnano on December 03, 2017, 07:14:20 PM
Sure. A single backup isn't a good idea anyway.
But for the long-term backup media that you do use, it wouldn't hurt to have it as durable as possible.

I won't be getting that steel thing, though. :)


Title: Re: Producing a deterministic wallet
Post by: nicknike on December 03, 2017, 08:21:50 PM
A nice active site this, with plenty of useful help   :)

May I take advantage by asking if anyone can supply a web site address that tells me how I benefit from Bitcoin cash?
For example, if I want to sell one bitcoin, how do I get the bitcoin cash value as well?



BTW, can someone find my IP address from comments on the internet regarding Bitcoins and trace back to my computer? I'm asking questions on a couple of forums/ comments pages and I hope it doesn't give a crook some ideas.

Further. I have been looking at ways to make a paper wallet by printing my private and public keys.
The instructions I have found say I have to transfer my Bitcoins to the paper wallet. How do I do that? If I transfer them to my paper wallet, does that make my wallet.dat file useless? I want to keep my wallet.dat file intact so it still shows my bitcoins when I fire-up Bitcoin-qt, but also have the paper wallet as a further back-up.


Title: Re: Producing a deterministic wallet
Post by: HCP on December 04, 2017, 01:17:54 AM
May I take advantage by asking if anyone can supply a web site address that tells me how I benefit from Bitcoin cash?
For example, if I want to sell one bitcoin, how do I get the bitcoin cash value as well?
You don't get the BCH value when you sell BTC... you get the BCH by having had BTC on a private key when the fork happened... it doesn't matter what you do withe BTC "after" the fork has happened... the BCH will stay with the private key... you get your BCH by importing your BTC private key (or BTC wallet file) into a BCH wallet (like BitcoinABC or ElectronCash).



Quote
BTW, can someone find my IP address from comments on the internet regarding Bitcoins and trace back to my computer? I'm asking questions on a couple of forums/ comments pages and I hope it doesn't give a crook some ideas.
Probably... it is the internet after all... VPN's and/or TOR are a good idea if you're super paranoid about these sorts of things.



Quote
Further. I have been looking at ways to make a paper wallet by printing my private and public keys.
The instructions I have found say I have to transfer my Bitcoins to the paper wallet. How do I do that? If I transfer them to my paper wallet, does that make my wallet.dat file useless? I want to keep my wallet.dat file intact so it still shows my bitcoins when I fire-up Bitcoin-qt, but also have the paper wallet as a further back-up.
If you want it to be the same... you'll need to export the private key+public address that has your BTC and print it on paper... the issue will be that if you make any transactions using Bitcoin-QT, it will possibly render your paper wallet obsolete if the change from the transaction is put onto a different (ie. "change") address... Your paper wallet will then have a zero balance... and you'd need to export the private key for the change address and reprint your paper wallet.


Title: Re: Producing a deterministic wallet
Post by: Spendulus on December 04, 2017, 02:18:40 AM
3) Updated backups on SD cards and DVD disks so to keep them 'active'. I'm told cards can age and files get corrupted. I'm thinking DVDs should have a reasonable life.
Flash may indeed deteriorate after a few years but also DVDs aren't immune. But with quality media, for example Verbatim, I'd put my bets on DVDs being more likely to be OK after 10 years.

If you want to look further into that, there's also the M-Disc disc variants, which claim to be more durable than "normal" discs.
Also, I think in general Bluray (not LTH) might be more durable than DVD.


If - if this is seriously a discussion about how to store a couple hundred characters or less (each private key being 50 or so characters in length)....

This is bat shit crazy talk.

Storage media are not necessary or optimal for less than some thousands of characters.

Get an old manual typewriter and some high quality paper.



Title: Re: Producing a deterministic wallet
Post by: jnano on December 04, 2017, 04:15:02 AM
Storage media are not necessary or optimal for less than some thousands of characters.
Get an old manual typewriter and some high quality paper.

Nothing prevent you from using multiple backup media formats, including paper.

Surely digital media can store a few bytes just as well as a few GBs? Or even better, if you add redundancy.
It's at least useful for a full wallet backup, including metadata.


Title: Re: Producing a deterministic wallet
Post by: nicknike on December 07, 2017, 08:26:03 PM
With my continued quest to get some kind of paper back-up using Bitcoin-QT, does the following some feasible?

1) walletpassphrase YOURPASSPHRASE 10. This I beleive unlocks the wallet for 10 seconds.
2) During the 10 seconds, type dumpprivkey. Does this leave the bitcoins intact in Bitcoin-QT wallet? Does this dump a file showing all the private and public keys. If so, what is this file called and its extension?
3) Use importprivkey to import private keys back into Bitcoin-QT. If so, what is the procedure.
4) What does importmulti do? Is this relevant?
5) If this works, is there still a problem that if some bitcoins are sold, the 'change' bitcoins are still lost?
Thanks for your help.


Title: Re: Producing a deterministic wallet
Post by: mocacinno on December 08, 2017, 02:37:38 PM
I've tried to give feedback/answer the 5 questions:

1) walletpassphrase YOURPASSPHRASE 10. This I beleive unlocks the wallet for 10 seconds.
correct

2) During the 10 seconds, type dumpprivkey. Does this leave the bitcoins intact in Bitcoin-QT wallet? Does this dump a file showing all the private and public keys. If so, what is this file called and its extension?
Bitcoins aren't something physical, they are not stored on your pc. If you "own" bitcoins, it basically means you have access to the private key that can be used to create a signature for one or more unspent outputs that funded the address that was created by hashing the public key belonging to the private key in question.
In very simple wording: your bitcoins are just lines in blocks that are stored on thousands of computers. Importing or exporting private keys doesn't change anything (unless you use an unsafe procedure/PC and your private keys get exposed, in this case you might get robbed)
So, dumping the private key will not "destroy" your bitcoins.
dumpprivkey only dumps one private key to stdout. If you need to dump all private keys, you can use dumpwallet (dumpwallet actually takes a parameters in which you can define the file that will be used to dump all keys to)


3) Use importprivkey to import private keys back into Bitcoin-QT. If so, what is the procedure.
open the debug window => importprivkey --privatekey--
This procedure will rescan the blocks on your disk, importprivkey takes an optional argument that will avoid this rescan (if you want to)


4) What does importmulti do? Is this relevant?
I've never used this, but apparently it's used to import multiple private keys at once

5) If this works, is there still a problem that if some bitcoins are sold, the 'change' bitcoins are still lost?
I have a hard time understanding this question. IF you use a decent wallet, it will guide you trough the process of creating a transaction spending one or more of the unspent outputs controlled by you. A decent wallet will make sure it funds the address of whoever you're sending BTC to, and it will make sure the change is being used to fund a change address.
Only if you manually create a raw transaction, or if you use a newbie-unfriendly, bad, wallet, or if you start messing with options you don't understand, you might end up losing your funds.


Title: Re: Producing a deterministic wallet
Post by: nicknike on December 08, 2017, 10:50:48 PM
I've tried to give feedback/answer the 5 questions:

1) walletpassphrase YOURPASSPHRASE 10. This I beleive unlocks the wallet for 10 seconds.
correct

Ye-esss

2) During the 10 seconds, type dumpprivkey. Does this leave the bitcoins intact in Bitcoin-QT wallet? Does this dump a file showing all the private and public keys. If so, what is this file called and its extension?
Bitcoins aren't something physical, they are not stored on your pc. If you "own" bitcoins, it basically means you have access to the private key that can be used to create a signature for one or more unspent outputs that funded the address that was created by hashing the public key belonging to the private key in question.
In very simple wording: your bitcoins are just lines in blocks that are stored on thousands of computers. Importing or exporting private keys doesn't change anything (unless you use an unsafe procedure/PC and your private keys get exposed, in this case you might get robbed)
So, dumping the private key will not "destroy" your bitcoins.
dumpprivkey only dumps one private key to stdout. If you need to dump all private keys, you can use dumpwallet (dumpwallet actually takes a parameters in which you can define the file that will be used to dump all keys to)
OK, I understand that the Bitcoins are just computer code. So if I use dumpwallet, what file will be created? Can this be read as a text file? Is that how it is done? I have a number of bitcoins in Bitcoin-qt.
 Will these just have the one private key?


3) Use importprivkey to import private keys back into Bitcoin-QT. If so, what is the procedure.
open the debug window => importprivkey --privatekey--
This procedure will rescan the blocks on your disk, importprivkey takes an optional argument that will avoid this rescan (if you want to)
So do I copy the private key from the dumped text file and type

importprivkey --privatekey-- with the private key typed between --  and --? I know some of these symbols are instructions and not actually typed, but do I type the -- and --?.



4) What does importmulti do? Is this relevant?
I've never used this, but apparently it's used to import multiple private keys at once

5) If this works, is there still a problem that if some bitcoins are sold, the 'change' bitcoins are still lost?
I have a hard time understanding this question. IF you use a decent wallet, it will guide you trough the process of creating a transaction spending one or more of the unspent outputs controlled by you. A decent wallet will make sure it funds the address of whoever you're sending BTC to, and it will make sure the change is being used to fund a change address.
Only if you manually create a raw transaction, or if you use a newbie-unfriendly, bad, wallet, or if you start messing with options you don't understand, you might end up losing your funds.

So, I'm using Bitcoin-qt. If I import the private key, my bitcoin total will show-up, yes, and then I could, for example, send one bitcoin to my exchange and the remainder will still show in Bitcoin-qt for another time?

BTW, when typing-in instructions to the console page, I don't see an activation device, like a button. Is it ok to just highlight the code and hit Enter?
Also BTW, many, many thanks for the help. I don't understand all the terminology so have to take this to grass-roots level. You see, what is a 'raw transaction'? And 'by hashing the public key belonging to the private key in question@ is beyond my understanding.
Bitcoins seems to have terminology all of it's own from what I have seen all over the net.


Title: Re: Producing a deterministic wallet
Post by: nicknike on December 10, 2017, 12:22:31 PM
You don't get the BCH value when you sell BTC... you get the BCH by having had BTC on a private key when the fork happened... it doesn't matter what you do withe BTC "after" the fork has happened... the BCH will stay with the private key... you get your BCH by importing your BTC private key (or BTC wallet file) into a BCH wallet (like BitcoinABC or ElectronCash).

Many thanks.
So, say I sell 1 BTC. If I then use the wallet.dat file with BitcoinABC, will the equivalent BCH still be available? The only way I can see this working is if the BTC and BCH details are now both in the wallet.dat file. Is this the case? Presumably it would be a useful upgrade to Bitcoin-QT if it would show and allow transactions for both BTC and BCH.


Title: Re: Producing a deterministic wallet
Post by: ranochigo on December 10, 2017, 03:27:18 PM
OK, I understand that the Bitcoins are just computer code. So if I use dumpwallet, what file will be created? Can this be read as a text file? Is that how it is done? I have a number of bitcoins in Bitcoin-qt. Will these just have the one private key?
It can be opened using a text editor. If you're using a HD wallet, you will only get a string of alphanumerical characters, IIRC.

So do I copy the private key from the dumped text file and type

importprivkey --privatekey-- with the private key typed between --  and --? I know some of these symbols are instructions and not actually typed, but do I type the -- and --?.
No. importprivkey 5K 

Where 5K is your private key.
So, I'm using Bitcoin-qt. If I import the private key, my bitcoin total will show-up, yes, and then I could, for example, send one bitcoin to my exchange and the remainder will still show in Bitcoin-qt for another time?
Yes. You need to backup your wallet.dat though.
BTW, when typing-in instructions to the console page, I don't see an activation device, like a button. Is it ok to just highlight the code and hit Enter?
Also BTW, many, many thanks for the help. I don't understand all the terminology so have to take this to grass-roots level. You see, what is a 'raw transaction'? And 'by hashing the public key belonging to the private key in question@ is beyond my understanding.
Bitcoins seems to have terminology all of it's own from what I have seen all over the net.
Theres no button when you're using the console.

If you're just using Bitcoin for non-technical stuff, that isn't a must to learn.

So, say I sell 1 BTC. If I then use the wallet.dat file with BitcoinABC, will the equivalent BCH still be available?
Yes. If you do it after the fork and the 1BTC transaction was already in your wallet before the fork.
The only way I can see this working is if the BTC and BCH details are now both in the wallet.dat file. Is this the case? Presumably it would be a useful upgrade to Bitcoin-QT if it would show and allow transactions for both BTC and BCH.
For the same BTC and BCH address, they have the same private key. There's no separate details, its just a private key.

It won't be. Bitcoin Core is catered to only Bitcoin. Bitcoin Cash is a different alt-coin altogether.


Title: Re: Producing a deterministic wallet
Post by: HCP on December 10, 2017, 10:19:13 PM
So, say I sell 1 BTC. If I then use the wallet.dat file with BitcoinABC, will the equivalent BCH still be available?
Yes. Like I said... it doesn't matter what you do with BTC AFTER the fork... the BCH remains associated with the the private key/address and will only move when a properly created/signed BCH transaction is broadcast and confirmed on the BCH blockchain.


Quote
The only way I can see this working is if the BTC and BCH details are now both in the wallet.dat file. Is this the case?
No. The wallet really just contains the private keys (technically it does contain some transaction information, but this can be altered/removed). The important data are the private keys. Everything else can be retrieved from the Blockchain.


Quote
Presumably it would be a useful upgrade to Bitcoin-QT if it would show and allow transactions for both BTC and BCH.
No. That would be a mess. It is "slow" enough now having to maintain/scan one blockchain... having the same app have to download/process/validate TWO 150+Gig blockchains would be terrible.

Besides, you'll find that the BCH version (Bitcoin ABC)... is also called Bitcoin-QT ::) The reasons for this are mostly political. :-\