-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcheck_addresses.py
54 lines (37 loc) · 1.46 KB
/
check_addresses.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import requests
import json
import time
import pickle
from sha_btc import Address, save_objects
with open("addresses.pickle", 'rb') as pkl:
addresses = pickle.load(pkl)
updated_addresses = list()
def check_addy(add):
phrase = add.pass_phrase
pk = add.u_prk
for address in [add.u_addy, add.c_addy]:
response = requests.get(f"https://blockchain.info/address/{address}?format=json&offset=0")
data = json.loads(response.text)
final_bal = data["final_balance"]
total_rec = data["total_received"]
if int(total_rec) > 1:
time_ = data["txs"][0]["time"]
at = time.strftime('%Y-%m-%d', time.localtime(int(time_)))
print(f"{phrase} > {address} used :: Last Transaction {at}")
add.set_status("Used")
else:
print(f"Address {address} is unused")
add.set_status("Unused")
if int(final_bal) > 1:
print("--*20")
print(f"Hit {address} > {pk} Final Balance {final_bal}")
print("--" * 20)
if not add.status:
add.set_status(f"Hit {final_bal} btc , {address} > time {int(time.time() * 1000)}")
else:
add.set_status2(f"Hit {final_bal} btc , {address} > time {int(time.time() * 1000)}")
return add
if "__main__" in __name__:
for addy in addresses:
updated_addresses.append(check_addy(addy))
save_objects(updated_addresses, "checked_btc.pickle")