forked from Pymmdrza/Convertor_PrivateKey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Convertor_Blockchain.py
29 lines (25 loc) · 1.1 KB
/
Convertor_Blockchain.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Convert All Private key to bitcoin address (p2pkh) and check just value balance from blockchain
# first install : pip install bit [Linux : pip3 install bit lxml]
from bit import Key
import requests, json
# Convert Private key to Wallet Import Format (WI
found = 0
count = 0
# import all key from text file
filename = "PrivateKey_10M_Nov_2022.txt"
with open(filename, 'r', encoding='utf-8', errors='ignore') as fr:
for Prikvatekey in fr.readlines():
Privatekey = Prikvatekey.strip('\n').strip()
Private_Key = Key.from_hex(Privatekey)
# Create Address from Private Key
addr = Private_Key.address
req = requests.get("https://blockchain.info/balance?active=" + addr).json()
balance = dict(req)[addr]['final_balance']
count += 1
if int(balance) > 0:
found += 1
with open('FoundValue.txt', 'a') as vf:
vf.write(f"{addr} Balance: {balance}\n{Privatekey}\n{'=' * 55}\n")
vf.close()
else:
print(f"{count} Address: {addr} # Balance: {balance}\n{Privatekey}")