Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Elwar on November 22, 2013, 09:18:08 AM



Title: Best client for importing multiple private keys?
Post by: Elwar on November 22, 2013, 09:18:08 AM
I am looking to automate a process of importing a private key to a client, send a certain amount from the client then delete the private key before moving on to the next private key.

Currently I am figuring I can set up a fresh wallet.dat, import a private key and send the BTC, then overwrite the wallet.dat with a copy of the fresh wallet.dat.

There should be a better way.


Title: Re: Best client for importing multiple private keys?
Post by: gusti on November 22, 2013, 09:19:41 AM
I am looking to automate a process of importing a private key to a client, send a certain amount from the client then delete the private key before moving on to the next private key.

Currently I am figuring I can set up a fresh wallet.dat, import a private key and send the BTC, then overwrite the wallet.dat with a copy of the fresh wallet.dat.

There should be a better way.

bitcoind with proper scripting will do it.


Title: Re: Best client for importing multiple private keys?
Post by: /dev/null on November 22, 2013, 10:57:56 AM
Electrum is much easy. Import private key, send funds, freeze that key, import new one, and repeat the process. Or simply import all keys at once.


But that's not automated.


Title: Re: Best client for importing multiple private keys?
Post by: frankenmint on November 22, 2013, 11:04:26 AM
I'm going to go with armory on this one.


Title: Re: Best client for importing multiple private keys?
Post by: kjj on November 23, 2013, 03:10:43 AM
Dare I ask why you are deleting the key?

Are you really that sure that no one will re-use one?


Title: Re: Best client for importing multiple private keys?
Post by: Elwar on November 23, 2013, 07:56:24 AM
Dare I ask why you are deleting the key?

Are you really that sure that no one will re-use one?

The private keys will still be available in cold storage.


Title: Re: Best client for importing multiple private keys?
Post by: kjj on November 23, 2013, 11:19:31 AM
In that case, don't bother importing or deleting.  Just use the raw transaction API to create, sign and send the transaction.


Title: Re: Best client for importing multiple private keys?
Post by: DannyHamilton on November 25, 2013, 07:44:06 PM
In that case, don't bother importing or deleting.  Just use the raw transaction API to create, sign and send the transaction.

Agreed.

Don't import private keys. That is far too slow. Just use them to sign raw transactions.


Title: Re: Best client for importing multiple private keys?
Post by: mccoyspace on November 25, 2013, 09:44:08 PM
In that case, don't bother importing or deleting.  Just use the raw transaction API to create, sign and send the transaction.

Agreed.

Don't import private keys. That is far too slow. Just use them to sign raw transactions.

Can anyone point to any howtos for something like this?


Title: Re: Best client for importing multiple private keys?
Post by: kjj on November 25, 2013, 10:21:50 PM
https://en.bitcoin.it/wiki/Raw_Transactions


Title: Re: Best client for importing multiple private keys?
Post by: mccoyspace on November 26, 2013, 04:42:50 PM
https://en.bitcoin.it/wiki/Raw_Transactions


ty


Title: Re: Best client for importing multiple private keys?
Post by: apetersson on November 26, 2013, 04:50:43 PM
try Mycelium. we specifically support this usecase. With the cold storage spend wizard one keysweep takes about 10 seconds.

see this video demonstration: https://www.youtube.com/watch?v=1pDSzOiFgIk

if you want to import keys in bulk, you can have up to 10 keys imported in the "active" section at once and send 1 transaction from those keys.


Title: Re: Best client for importing multiple private keys?
Post by: Dabs on October 22, 2014, 01:23:01 AM
Sorry for the necro-bump, but is there a way to bulk import a few thousand keys into an encrypted wallet.dat (Bitcoin Core wallet, version 0.9.3)?

What I'm trying to do:

1. brand new wallet.dat (I call it empty.dat)
2. encrypt it with crazy long password
3. import keys using bitcoin-cli / bitcoind

However, I need to import a few thousand keys.


Title: Re: Best client for importing multiple private keys?
Post by: 687_2 on October 22, 2014, 03:55:27 AM
Sorry for the necro-bump, but is there a way to bulk import a few thousand keys into an encrypted wallet.dat (Bitcoin Core wallet, version 0.9.3)?

What I'm trying to do:

1. brand new wallet.dat (I call it empty.dat)
2. encrypt it with crazy long password
3. import keys using bitcoin-cli / bitcoind

However, I need to import a few thousand keys.

I solved this problem just the other day with Multibit. You can work with everything in .csv format and edit the file in Excel.



Title: Re: Best client for importing multiple private keys?
Post by: Biitcoin on October 22, 2014, 06:45:41 AM
I would personally recommend Electrum , really easy to do what you asking for . but know that imported keys are not recoverable from seed


Title: Re: Best client for importing multiple private keys?
Post by: Dabs on October 22, 2014, 07:52:03 AM
ahh.. no no. I need to import them into Bitcoin Core wallet.dat. Because it's going to run on a server as a full node.


Title: Re: Best client for importing multiple private keys?
Post by: amaclin on October 22, 2014, 08:10:55 AM
Sorry for the necro-bump, but is there a way to bulk import a few thousand keys into an encrypted wallet.dat (Bitcoin Core wallet, version 0.9.3)?

What I'm trying to do:

1. brand new wallet.dat (I call it empty.dat)
2. encrypt it with crazy long password
3. import keys using bitcoin-cli / bitcoind

However, I need to import a few thousand keys.

Why not to
1. create new wallet.dat on offline computer even with no blockchain
2. import keys using bitcoin-cli / bitcoind
3. encrypt it with crazy long password
4. move wallet.dat to server



Title: Re: Best client for importing multiple private keys?
Post by: Dabs on October 22, 2014, 08:19:54 AM
Yes, that's the idea. But I need to import 5000~10000 keys. I don't want to be doing that one by one.


Title: Re: Best client for importing multiple private keys?
Post by: amaclin on October 22, 2014, 08:41:29 AM
create & execute .bat file with lines like

Code:
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey L4mP3joYEhSv1ofdsWbz8xEmqCmYK9vGyi8mJmWWbh79Xx2NsS1M addr-1DfyaDvr-1 false
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey Ky2EGjWLhfKv1sWnPcuN4SHF2iALj6SfK7hoLWKx5T4zMqXg7aT9 addr-1DfyaDvr-2 false
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey KzrZ4DULdVWFqpF48pdJicFJfX5dqrhxBkqDnT4HRkCswdFy3Eo4 addr-1DfyaDvr-3 false
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey L2ELWXewr1PQnMwFDpfobHFqspyM6g1noM4uzkCMgoSZTSf3sQJF addr-1DfyaDvr-4 false
...


Title: Re: Best client for importing multiple private keys?
Post by: micax1 on October 27, 2014, 09:33:59 PM
create & execute .bat file with lines like

Code:
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey L4mP3joYEhSv1ofdsWbz8xEmqCmYK9vGyi8mJmWWbh79Xx2NsS1M addr-1DfyaDvr-1 false
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey Ky2EGjWLhfKv1sWnPcuN4SHF2iALj6SfK7hoLWKx5T4zMqXg7aT9 addr-1DfyaDvr-2 false
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey KzrZ4DULdVWFqpF48pdJicFJfX5dqrhxBkqDnT4HRkCswdFy3Eo4 addr-1DfyaDvr-3 false
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey L2ELWXewr1PQnMwFDpfobHFqspyM6g1noM4uzkCMgoSZTSf3sQJF addr-1DfyaDvr-4 false
...


each string will trigger whole blockchain rescan

is there a way to import in bulk?
like:
"C:\Program Files\Bitcoin\daemon\bitcoind.exe" importprivkey key1 key2 key3

to trigger just 1 rescan to save time?

Thank you guys if anybody knows answer!


Title: Re: Best client for importing multiple private keys?
Post by: Dabs on October 28, 2014, 02:41:22 AM
each string will trigger whole blockchain rescan

That's what the "false" at the end of each line is for. No rescan.

I'm going to try this, the last time didn't work because I'm using an encrypted wallet.


Title: Re: Best client for importing multiple private keys?
Post by: micax1 on October 28, 2014, 08:32:20 PM
each string will trigger whole blockchain rescan

That's what the "false" at the end of each line is for. No rescan.

I'm going to try this, the last time didn't work because I'm using an encrypted wallet.

it worked for unencrypted.
Thank you!


Title: Re: Best client for importing multiple private keys?
Post by: rrock on October 31, 2014, 05:56:31 AM
Yes, that's the idea. But I need to import 5000~10000 keys. I don't want to be doing that one by one.

what?so many keys?   may i ask why u need them?


Title: Re: Best client for importing multiple private keys?
Post by: Dabs on October 31, 2014, 11:17:36 AM
Yes, that's the idea. But I need to import 5000~10000 keys. I don't want to be doing that one by one.

what?so many keys?   may i ask why u need them?

For a new website that will probably have a few thousand users (with deposit addresses) and of course change addresses.


Title: Re: Best client for importing multiple private keys?
Post by: bitcreditscc on January 29, 2015, 11:36:42 PM
did anyone finally figure out a way to do this in bulk without triggering rescan ?

say for 250 addresses


Title: Re: Best client for importing multiple private keys?
Post by: johoe on January 30, 2015, 01:26:24 AM
did anyone finally figure out a way to do this in bulk without triggering rescan ?

say for 250 addresses

As amaclin and Dabs on this thread already said, you need to add a third parameter false to importprivkey

Code:
bitcoin-cli importprivkey privatekey-1 somelabel false
bitcoin-cli importprivkey privatekey-2 somelabel false

Works fine even for 2000 addresses.  However, the next rescan will take some time, especially if there were many transactions.


Title: Re: Best client for importing multiple private keys?
Post by: chaosknight on January 31, 2015, 09:29:12 AM
As amaclin and Dabs on this thread already said, you need to add a third parameter false to importprivkey

Code:
bitcoin-cli importprivkey privatekey-1 somelabel false
bitcoin-cli importprivkey privatekey-2 somelabel false

Works fine even for 2000 addresses.  However, the next rescan will take some time, especially if there were many transactions.
how much rescan time we can expect for 1000 private keys imported to wallet with parameter false to importprivkey command


Title: Re: Best client for importing multiple private keys?
Post by: newIndia on January 31, 2015, 09:39:42 AM
did anyone finally figure out a way to do this in bulk without triggering rescan ?

say for 250 addresses

As amaclin and Dabs on this thread already said, you need to add a third parameter false to importprivkey

Code:
bitcoin-cli importprivkey privatekey-1 somelabel false
bitcoin-cli importprivkey privatekey-2 somelabel false

Works fine even for 2000 addresses.  However, the next rescan will take some time, especially if there were many transactions.

So, anything available in those addresses will be sent ? How do I send partial amount ? Moreover, is not there any parameter to mention the mining fee ? Tx without mining fee may take a long to confirm !!!


Title: Re: Best client for importing multiple private keys?
Post by: johoe on January 31, 2015, 09:44:05 AM
As amaclin and Dabs on this thread already said, you need to add a third parameter false to importprivkey

Code:
bitcoin-cli importprivkey privatekey-1 somelabel false
bitcoin-cli importprivkey privatekey-2 somelabel false

Works fine even for 2000 addresses.  However, the next rescan will take some time, especially if there were many transactions.
how much rescan time we can expect for 1000 private keys imported to wallet with parameter false to importprivkey command


The import takes about a minute, but there is no rescan triggered.  

If you need the accurate balance, you have to rescan manually afterwards (it may be enough to import a private key with third parameter true, but I'm not sure).  With my 2000 weak keys (some of them had a lot of transactions) it took a full day to rescan the wallet.  My wallet.dat is about 500 MB.  If your keys are fresh and haven't occured on the blockchain, there is no need to rescan.

So, anything available in those addresses will be sent ? How do I send partial amount ? Moreover, is not there any parameter to mention the mining fee ? Tx without mining fee may take a long to confirm !!!

No, the commands send no transactions, they just put the private/public key into the wallet.  The rescan will just search for transactions and recompute the balance.  I don't think that bitcoind has support for sweeping an address.  You can of course just ask for the balance and then send that amount the usual way to a new address, e.g. using bitcoin-qt.


Title: Re: Best client for importing multiple private keys?
Post by: picolo on January 31, 2015, 12:01:34 PM
I am looking to automate a process of importing a private key to a client, send a certain amount from the client then delete the private key before moving on to the next private key.

Currently I am figuring I can set up a fresh wallet.dat, import a private key and send the BTC, then overwrite the wallet.dat with a copy of the fresh wallet.dat.

There should be a better way.

Blockchain works fine.


Title: Re: Best client for importing multiple private keys?
Post by: hhanh00 on January 31, 2015, 01:40:06 PM
If you are only interested in balances, you can scan the utxo set and that only takes a minute but I don't know if it's possible with bitcoin core.


Title: Re: Best client for importing multiple private keys?
Post by: brituspol on February 01, 2015, 09:28:14 PM
Looking for changing addresses to a website in bulk, spent lot of time to figure out. I would have visited this section often.


Title: Re: Best client for importing multiple private keys?
Post by: Crypto9er on February 01, 2015, 11:06:48 PM
I tried Bitcoin Armory to import multiple priv. keys (few thousands). It was fast. It took about 15 mins for all the process. and the rescan was very quick.


Title: Re: Best client for importing multiple private keys?
Post by: findftp on November 11, 2015, 12:54:37 AM
I tried Bitcoin Armory to import multiple priv. keys (few thousands). It was fast. It took about 15 mins for all the process. and the rescan was very quick.

Well, I'm trying the same with 900 private keys, but it takes more than 1,5 hour total already.


Title: Re: Best client for importing multiple private keys?
Post by: elbandi on November 11, 2015, 01:14:45 PM
I tried Bitcoin Armory to import multiple priv. keys (few thousands). It was fast. It took about 15 mins for all the process. and the rescan was very quick.

Well, I'm trying the same with 900 private keys, but it takes more than 1,5 hour total already.

Code:
importprivkey "5yourveryveryveryverylongprivatekeystring" "my-new-key1" false
importprivkey "5yourveryveryveryverylongprivatekeystring" "my-new-key2" false
importprivkey "5yourveryveryveryverylongprivatekeystring" "my-new-key3" true
The last true triggers the rescan, other false are skip that. So you scan once for balance at the end.


Title: Re: Best client for importing multiple private keys?
Post by: findftp on November 11, 2015, 01:16:24 PM
I tried Bitcoin Armory to import multiple priv. keys (few thousands). It was fast. It took about 15 mins for all the process. and the rescan was very quick.

Well, I'm trying the same with 900 private keys, but it takes more than 1,5 hour total already.

Code:
importprivkey "5yourveryveryveryverylongprivatekeystring" "my-new-key1" false
importprivkey "5yourveryveryveryverylongprivatekeystring" "my-new-key2" false
importprivkey "5yourveryveryveryverylongprivatekeystring" "my-new-key3" true
The last true triggers the rescan, other false are skip that. So you scan once for balance at the end.


I assume this is a bitcoind implementation?