Author

Topic: IMPORTING PRIVATE KEY (Read 312 times)

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
September 09, 2021, 04:34:50 AM
#12
A simple python script can be used to import them to Electrum or Bitcoin Core.

Electrum won't work in this case, because
1. Electrum use JSON as wallet format, which isn't scalable for million addresses.
2. By default, Electrum server limit request amount to prevent DDoS, so sync process will take very long time.
3. And few other reason i currently don't remember.

One script is for IMPORT and one is for EXPORT

Good Luck!

Code:
#Import.py
#
from bitcoin.core import COIN
import bitcoin.rpc
bitcoin.SelectParams("mainnet")

proxy = bitcoin.rpc.Proxy()
with open("priv.txt")  as f:
    lines = f.readlines()

i = 1
for line in lines:
    addr = line.strip()
    #print (addr)
    print (i)
    print(proxy.call("importprivkey", addr,  "ImportWrongWalletAddr" + str(i),  False))

Don't forget to add i = i + 1 inside loop or use enumerate (for i, line in enumerate(lines):), otherwise all address will have exactly same label.
legendary
Activity: 3346
Merit: 3125
September 14, 2021, 03:35:07 PM
#11
If you have your bitcoin node running on linux it's easy to make a script to import all the privatekeys.

The right command to import a privatekey with bitcoin-cli is:

Code:
bitcoin-cli importprivkey "myPrivKey" "" true

But since you are importing multiple keys you should add false to the end that way you don't rescan the entire local block database each time.

And with Linux you can make a 'for' with your text file. So, the code should be something like this:

Code:
for a in $(cat pks.txt)
do
bitcoin-cli importprivkey "$a" "" false
done

And leave the last private key to input manually with the 'true' option at the end.

Source: https://bitcoin.stackexchange.com/questions/69205/bitcoin-cli-importprivkey-to-the-same-user-or-different-users
hero member
Activity: 1220
Merit: 612
OGRaccoon
September 08, 2021, 07:26:11 PM
#10
https://www.youtube.com/watch?v=ET_cMKPXuwk
He has created an automating tool to import mass keys to wallet without crashing but the download link is not working.

ANY OTHER IDEAS?

Would not surprise me if the file had a virus in it for unwitting people like yourself to come along and run it.

9/10 these things lead to you being infected with RAT (Remote Access Tool) or some hidden miner will run on your machine.

Unless the code is supplied on GitHub and can be verified stay away from solutions like this.

A simple python script can be used to import them to Electrum or Bitcoin Core.
DO NOT download random programs you find on YouTube.

Especially ones that have comments like this under them.




Here is some python code to batch import keys to Bitcoin Core..

it requires the Peter Todd implementation of Python BitcoinLib to work correctly.

https://github.com/petertodd/python-bitcoinlib

You also may want to limit how many you import in one go split your keys down into batches and import them
a batch at a time just to ensure your don't crash core while attempting the import.

5 Million keys is a lot but I doubt you will find anything with a random key import like this.

If your looking to "crack" a puzzle look at things like this Pollards Kangaroo or LBC projects around the forum.

One script is for IMPORT and one is for EXPORT

Good Luck!

Code:
#Import.py
#
from bitcoin.core import COIN
import bitcoin.rpc
bitcoin.SelectParams("mainnet")

proxy = bitcoin.rpc.Proxy()
with open("priv.txt")  as f:
    lines = f.readlines()

i = 1
for line in lines:
    addr = line.strip()
    #print (addr)
    print (i)
    print(proxy.call("importprivkey", addr,  "ImportWrongWalletAddr" + str(i),  False))


Code:
# Main.py
#
from bitcoin.core import COIN
import bitcoin.rpc
bitcoin.SelectParams("mainnet")

proxy = bitcoin.rpc.Proxy()
with open("walletlist.txt")  as f:
    lines = f.readlines()
    
for line in lines:
    tokens = line.split(";")
    addr = tokens[2].replace("\"", "")
    addr = addr.strip()
 #   print (addr)
    print(proxy.dumpprivkey(addr))

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
September 08, 2021, 08:44:30 AM
#9
Create a bash or powershell script that repeatedly calls bitcoin-cli to import each private key, and then only access them from bitcoin-cli - because this number of private keys will crash Bitcoin-QT. (it may also crash bitcoind, but I'm not completely sure)
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
September 08, 2021, 08:08:02 AM
#8
Further questions:

— In which wallet would you want to import them? Do you run a node or is the SPV your only option?
— Are the keys related somehow? For instance, is there a master public key in which you can derive them all or are they just arbitrary keys?
— Why do you want to achieve this? (optional, but appreciated if answered)

https://www.youtube.com/watch?v=ET_cMKPXuwk
He has created an automating tool to import mass keys to wallet without crashing but the download link is not working.
First of all, he or she imported 14,132 private keys and not 5,000,000. Secondly, you should never install closed-source software outside a trusted place. It could be something malicious and judging by the comments, it's most probably a trojan.
newbie
Activity: 24
Merit: 0
September 08, 2021, 07:32:54 AM
#7
https://www.youtube.com/watch?v=ET_cMKPXuwk
He has created an automating tool to import mass keys to wallet without crashing but the download link is not working.

ANY OTHER IDEAS?
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
September 08, 2021, 05:55:12 AM
#6
Whichever wallet you say i would setup and import.
If you only want to find funded addresses, I would use something like bitcoin-tool (in a VM) to get the addresses, and compare the list to this or this list. That would be the fastest solution.
newbie
Activity: 24
Merit: 0
September 08, 2021, 05:27:32 AM
#5
I can import in whichever wallet, if it is possible.
I just neet to know in which wallet and how to import mass keys.
Whichever wallet you say i would setup and import.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
September 08, 2021, 05:19:51 AM
#4
i want to import nearly 5 million keys to my wallet.
Which wallet? You can't import this many in - say - Electrum.

Are you trying to prove for yourself you can't brute-force private keys or something?
newbie
Activity: 24
Merit: 0
September 08, 2021, 05:17:16 AM
#3
i want to import nearly 5 million keys to my wallet.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
September 08, 2021, 05:14:01 AM
#2
First, turn off your Caps Lock.

Then: how many private keys are you talking about, and where do you want to import them?
newbie
Activity: 24
Merit: 0
September 08, 2021, 05:09:00 AM
#1
I NEED TO IMPORT MASS NUMBER OF PRIVATE KEYS FROM A TEXT FILE.

IMPORTING MANUALLY TAKES A LOT OF TIME.

SO DO ANYONE HAVE ANY IDEAS
Jump to: