How do I import private keys en mass from a text file?

0

How do I import private keys en mass from a text file? They are in Wallet Import Format, e.g. 5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ.

Would there be any limitations to the number of keys I can import?

Thank you and please forgive me for such a question, I'm quite new to this.

Sajidkhan

Posted 2014-10-06T01:29:29.533

Reputation: 103

1We need a lot more details. What OS, what format private keys (WIF, Mini, hex), which client, what format of wallet are the privkeys in now? More details would help.Wizard Of Ozzie 2014-10-06T03:59:37.777

I've tried to edit this to clarify the question. Asker, please let me know if I understood what you're asking correctly. Thanks!Nick ODell 2014-10-06T04:42:09.400

OS: Windows Private key: WIF, I checked Client: I'm not sure actually. Hope you can suggest me one

Additionally, I suppose a CLI that could sweep keys from a text file would be fast enough right? If there is a such a thing yet

Thank you!

@Nick thanks for editing the question :) – Sajidkhan 2014-10-06T05:06:33.923

@Nick actually I meant sweeping and not importing! They're both different right?Sajidkhan 2014-10-06T06:09:15.857

@user3079309 They are. Sweeping usually means moving bitcoins from many addresses to a single address, whereas importing doesn't make any transactions at all.Nick ODell 2014-10-06T06:12:10.657

Thanks! Is there any way to load up a text file( or maybe a .bat file) with private keys and run them in a client with a gui or cli?Sajidkhan 2014-10-06T06:17:26.747

Answers

0

Not sure on this, but you might be able to use the importprivkey RPC call. What I would try is importing one of them with rescan=false and then import another with rescan=true. The rescan=true causes it to go through the whole blockchain and look for any places that the associated address to that private key. After importing two private keys, the first without a rescan and the second with a rescan, then look to see if rescanning on the second private key got you all the transactions for the first private key that you entered.

Then if that works, you could write a command line script to execute that RPC call with each line of the file as the private key.

That's a high level description of what I would try. If you need more help on the importprivkey, open the Bitcoin-QT GUI, go to Help >> Debug Window >> Console and type "help importprivkey". If you need help writing that script, you'll probably have to do some googling around to learn about your OS-dependent scripting language.

morsecoder

Posted 2014-10-06T01:29:29.533

Reputation: 12 624

Thanks! But this means for each key, the whole blockchain would be scanned right? I would actually like to 'sweep' and not importSajidkhan 2014-10-06T15:33:15.737

I'm not sure if what I'm asking is practical, I think I better drop the questionSajidkhan 2014-10-06T15:34:41.713

I mean, there should be a way to do what you are asking for. And no, hopefully you wouldn't have to do a rescan for every key, that would take forever. My proposed idea was to set the rescan flag to be false for all but the last private key you are importing. If you didn't need to rescan at all, then don't even set rescan=true on the last import.morsecoder 2014-10-06T16:15:00.180

I have started to look into this with all seriousness. Thank you for your valuable input. For now, I'll have to do with GUI clients such as Armory / Multibit because of my limited knowledge of this subject.Sajidkhan 2014-10-07T01:13:40.070

Do those alternative clients allow batch import? Is that why you switched?morsecoder 2014-10-07T01:21:41.060

They do actually allow batch import( tested upto 50K private keys in Multibit) but of course you'll agree that a CLI would be fast and much more reliable?Sajidkhan 2014-10-07T02:20:10.003

I have no choice tbhSajidkhan 2014-10-07T02:25:47.847