DILSHAD737 commited on
Commit
f1f9a6c
Β·
1 Parent(s): 5e4d4bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -17
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  from itertools import permutations, combinations
3
  import hashlib, hmac, os, time, math, gc, random
4
  from multiprocessing import Pool
@@ -7,21 +6,17 @@ import coincurve
7
  from eth_utils import keccak, to_checksum_address
8
 
9
  # ============================================================
10
- # πŸ”‘ APNI PHRASE YAHAN DALEIN
11
  MY_PHRASE = "lesson cushion crane affair federal decline limb spend reunion chief cart zebra"
12
  # ============================================================
13
 
14
  _mnemo = Mnemonic("english")
15
  WORDLIST = _mnemo.wordlist
16
-
17
  NUM_RANDOM_PHRASES = 5
18
  RANDOM_PHRASES = []
19
 
20
  my_words = MY_PHRASE.strip().split()
21
  if len(my_words) == 12:
22
  RANDOM_PHRASES.append(my_words)
23
- else:
24
- print(f"⚠️ Aapki phrase 12 words ki nahi hai ({len(my_words)} words) β€” skip")
25
 
26
  for _ in range(NUM_RANDOM_PHRASES):
27
  RANDOM_PHRASES.append(random.sample(WORDLIST, 12))
@@ -35,7 +30,7 @@ CHECK_BIP39_CHECKSUM = True
35
  ADDRESSES_FILE = "12730802_addresses.csv"
36
  MATCHED_FILE = f"matched_keys_{PHRASE_MODE}.txt"
37
  BATCH_SIZE = 5000
38
- NUM_WORKERS = 48
39
  CHUNK_SIZE = 4
40
  # ============================================================
41
 
@@ -73,14 +68,9 @@ try:
73
  _seed_fn = _bip39_rust.bip39_to_seed
74
  _check_fn = getattr(_bip39_rust, 'bip39_validate', None)
75
  else:
76
- _seed_fn = None
77
- _check_fn = None
78
- _USE_RUST_BIP39 = False
79
  except ImportError:
80
- _bip39_rust = None
81
- _USE_RUST_BIP39 = False
82
- _seed_fn = None
83
- _check_fn = None
84
 
85
  _MNEMONIC = None
86
  def _get_mnemonic():
@@ -109,7 +99,7 @@ def load_addresses(path):
109
  a = a[2:]
110
  if a and len(a) == 40:
111
  s.add(a)
112
- return frozenset(s)
113
 
114
  def normalize(addr):
115
  a = addr.strip().lower()
@@ -212,10 +202,8 @@ def main():
212
  all_start = time.time()
213
  total_phrases = len(RANDOM_PHRASES)
214
 
215
- gc.collect()
216
- gc.freeze()
217
 
218
- # βœ… Ek hi Pool poore scan ke liye
219
  with Pool(processes=NUM_WORKERS,
220
  initializer=init_worker,
221
  initargs=(known,)) as pool:
 
 
1
  from itertools import permutations, combinations
2
  import hashlib, hmac, os, time, math, gc, random
3
  from multiprocessing import Pool
 
6
  from eth_utils import keccak, to_checksum_address
7
 
8
  # ============================================================
 
9
  MY_PHRASE = "lesson cushion crane affair federal decline limb spend reunion chief cart zebra"
10
  # ============================================================
11
 
12
  _mnemo = Mnemonic("english")
13
  WORDLIST = _mnemo.wordlist
 
14
  NUM_RANDOM_PHRASES = 5
15
  RANDOM_PHRASES = []
16
 
17
  my_words = MY_PHRASE.strip().split()
18
  if len(my_words) == 12:
19
  RANDOM_PHRASES.append(my_words)
 
 
20
 
21
  for _ in range(NUM_RANDOM_PHRASES):
22
  RANDOM_PHRASES.append(random.sample(WORDLIST, 12))
 
30
  ADDRESSES_FILE = "12730802_addresses.csv"
31
  MATCHED_FILE = f"matched_keys_{PHRASE_MODE}.txt"
32
  BATCH_SIZE = 5000
33
+ NUM_WORKERS = 16 # βœ… RAM kam karne ke liye
34
  CHUNK_SIZE = 4
35
  # ============================================================
36
 
 
68
  _seed_fn = _bip39_rust.bip39_to_seed
69
  _check_fn = getattr(_bip39_rust, 'bip39_validate', None)
70
  else:
71
+ _seed_fn = None; _check_fn = None; _USE_RUST_BIP39 = False
 
 
72
  except ImportError:
73
+ _bip39_rust = None; _USE_RUST_BIP39 = False; _seed_fn = None; _check_fn = None
 
 
 
74
 
75
  _MNEMONIC = None
76
  def _get_mnemonic():
 
99
  a = a[2:]
100
  if a and len(a) == 40:
101
  s.add(a)
102
+ return s # βœ… frozenset ki jagah set
103
 
104
  def normalize(addr):
105
  a = addr.strip().lower()
 
202
  all_start = time.time()
203
  total_phrases = len(RANDOM_PHRASES)
204
 
205
+ # βœ… gc.freeze() hata diya
 
206
 
 
207
  with Pool(processes=NUM_WORKERS,
208
  initializer=init_worker,
209
  initargs=(known,)) as pool: