lunalib 1.5.2__py3-none-any.whl → 1.6.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -235,55 +235,55 @@ class TransactionManager:
235
235
 
236
236
  # System transactions are always valid
237
237
  if signature in ["system", "unsigned", "test"]:
238
- print(f"[TRANSACTIONS] Skipping signature check for {signature} transaction")
238
+ safe_print(f"[TRANSACTIONS] Skipping signature check for {signature} transaction")
239
239
  return True
240
240
 
241
241
  if not self.key_manager:
242
- print("[TRANSACTIONS] No key manager available for verification")
242
+ safe_print("[TRANSACTIONS] No key manager available for verification")
243
243
  return False
244
244
 
245
245
  # Check SM2 signature format
246
246
  if len(signature) != 128:
247
- print(f"[TRANSACTIONS] Invalid SM2 signature length: {len(signature)} (expected 128)")
247
+ safe_print(f"[TRANSACTIONS] Invalid SM2 signature length: {len(signature)} (expected 128)")
248
248
  return False
249
249
 
250
250
  # Get signing data (without public_key!)
251
251
  sign_data = self._get_signing_data(transaction)
252
252
  public_key = transaction.get("public_key", "")
253
253
 
254
- print(f"[TRANSACTIONS VERIFY] Signing data length: {len(sign_data)}")
255
- print(f"[TRANSACTIONS VERIFY] Signing data (first 100 chars): {sign_data[:100]}")
254
+ safe_print(f"[TRANSACTIONS VERIFY] Signing data length: {len(sign_data)}")
255
+ safe_print(f"[TRANSACTIONS VERIFY] Signing data (first 100 chars): {sign_data[:100]}")
256
256
 
257
257
  # Try to verify with KeyManager
258
- print(f"[TRANSACTIONS] Attempting verification...")
258
+ safe_print(f"[TRANSACTIONS] Attempting verification...")
259
259
  is_valid = self.key_manager.verify_signature(sign_data, signature, public_key)
260
260
 
261
- print(f"[TRANSACTIONS] SM2 signature verification result: {is_valid}")
261
+ safe_print(f"[TRANSACTIONS] SM2 signature verification result: {is_valid}")
262
262
 
263
263
  return is_valid
264
264
 
265
265
  except Exception as e:
266
- print(f"[TRANSACTIONS] Verification error: {e}")
266
+ safe_print(f"[TRANSACTIONS] Verification error: {e}")
267
267
  import traceback
268
268
  traceback.print_exc()
269
269
  return False
270
270
  def _debug_signature_issue(self, transaction: Dict, sign_data: str, signature: str, public_key: str):
271
271
  """Debug why signature verification is failing"""
272
- print("\n" + "="*60)
273
- print("DEBUGGING SIGNATURE ISSUE")
274
- print("="*60)
272
+ safe_print("\n" + "="*60)
273
+ safe_print("DEBUGGING SIGNATURE ISSUE")
274
+ safe_print("="*60)
275
275
 
276
276
  # 1. Check if we can sign and verify a simple test
277
- print("\n1. Testing SM2 with simple message...")
277
+ safe_print("\n1. Testing SM2 with simple message...")
278
278
  test_message = "Simple test message"
279
279
  test_private = self.key_manager.generate_private_key()
280
280
  test_public = self.key_manager.derive_public_key(test_private)
281
281
  test_sig = self.key_manager.sign_data(test_message, test_private)
282
282
  test_valid = self.key_manager.verify_signature(test_message, test_sig, test_public)
283
- print(f" Simple test verification: {test_valid}")
283
+ safe_print(f" Simple test verification: {test_valid}")
284
284
 
285
285
  # 2. Try to recreate what was signed during transaction creation
286
- print("\n2. Reconstructing original transaction data...")
286
+ safe_print("\n2. Reconstructing original transaction data...")
287
287
  # Create the exact transaction data that should have been signed
288
288
  reconstructed = {
289
289
  "amount": float(transaction["amount"]),
@@ -298,23 +298,23 @@ class TransactionManager:
298
298
 
299
299
  import json
300
300
  reconstructed_json = json.dumps(reconstructed, sort_keys=True)
301
- print(f" Reconstructed JSON: {reconstructed_json}")
302
- print(f" Current signing data: {sign_data}")
303
- print(f" Are they equal? {reconstructed_json == sign_data}")
304
- print(f" Length difference: {len(reconstructed_json)} vs {len(sign_data)}")
301
+ safe_print(f" Reconstructed JSON: {reconstructed_json}")
302
+ safe_print(f" Current signing data: {sign_data}")
303
+ safe_print(f" Are they equal? {reconstructed_json == sign_data}")
304
+ safe_print(f" Length difference: {len(reconstructed_json)} vs {len(sign_data)}")
305
305
 
306
306
  # 3. Check for whitespace differences
307
- print("\n3. Checking for whitespace differences...")
308
- print(f" Reconstructed has spaces: {' ' in reconstructed_json}")
309
- print(f" Sign data has spaces: {' ' in sign_data}")
307
+ safe_print("\n3. Checking for whitespace differences...")
308
+ safe_print(f" Reconstructed has spaces: {' ' in reconstructed_json}")
309
+ safe_print(f" Sign data has spaces: {' ' in sign_data}")
310
310
 
311
311
  # 4. Check float formatting
312
- print("\n4. Checking float formatting...")
313
- print(f" Amount in tx: {transaction['amount']} (type: {type(transaction['amount'])})")
314
- print(f" Amount in reconstructed: {reconstructed['amount']} (type: {type(reconstructed['amount'])})")
312
+ safe_print("\n4. Checking float formatting...")
313
+ safe_print(f" Amount in tx: {transaction['amount']} (type: {type(transaction['amount'])})")
314
+ safe_print(f" Amount in reconstructed: {reconstructed['amount']} (type: {type(reconstructed['amount'])})")
315
315
 
316
316
  # 5. Try different JSON serialization options
317
- print("\n5. Trying different JSON formats...")
317
+ safe_print("\n5. Trying different JSON formats...")
318
318
  formats = [
319
319
  ("Compact", lambda x: json.dumps(x, sort_keys=True, separators=(',', ':'))),
320
320
  ("Default", lambda x: json.dumps(x, sort_keys=True)),
@@ -324,9 +324,9 @@ class TransactionManager:
324
324
  for name, formatter in formats:
325
325
  formatted = formatter(reconstructed)
326
326
  is_valid_test = self.key_manager.verify_signature(formatted, signature, public_key)
327
- print(f" {name} format: {is_valid_test} (length: {len(formatted)})")
327
+ safe_print(f" {name} format: {is_valid_test} (length: {len(formatted)})")
328
328
 
329
- print("="*60 + "\n")
329
+ safe_print("="*60 + "\n")
330
330
  def assess_transaction_risk(self, transaction: Dict) -> Tuple[str, str]:
331
331
  """Assess transaction risk level"""
332
332
  return self.security.assess_risk(transaction)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lunalib
3
- Version: 1.5.2
3
+ Version: 1.6.6
4
4
  Summary: Cryptocurrency Ecosystem library (LunaLib)
5
5
  Home-page:
6
6
  Author: Ling Lin
@@ -10,10 +10,16 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
+ Requires-Dist: cryptography
14
+ Requires-Dist: requests
15
+ Requires-Dist: numpy
16
+ Requires-Dist: pytest
17
+ Requires-Dist: pandas
13
18
  Dynamic: author
14
19
  Dynamic: classifier
15
20
  Dynamic: description
16
21
  Dynamic: description-content-type
22
+ Dynamic: requires-dist
17
23
  Dynamic: requires-python
18
24
  Dynamic: summary
19
25
 
@@ -1,31 +1,33 @@
1
1
  lunalib/__init__.py,sha256=fEvoHvfcC6ilDGQrhXaVmcdB4yDmuijxz6YZHkjbuBg,527
2
2
  lunalib/cli.py,sha256=SyuJIhvqld-XL9ks9XFOuyqVb44qyBUbahlqE_RDVkM,524
3
3
  lunalib/luna_lib.py,sha256=ue9Bs93xjpg7_GHSUJPKBhf8nF5YcbCIdoMIu-jDgG4,2748
4
- lunalib/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- lunalib/core/blockchain.py,sha256=gnlYSU1CIaa38bxByfKHlMpt8GMYpvib0EboVfNESek,36568
4
+ lunalib/core/__init__.py,sha256=V86B0jI8snFIg8yCyd_Qoi2Tl6elQn_1cT-oeR6Ig3s,361
5
+ lunalib/core/blockchain.py,sha256=dY_zQXzT8wufrinN8rGlpDTHM_M1yejfKEIm6_s78io,36564
6
6
  lunalib/core/crypto.py,sha256=R_f2sj7ASNnMW8Dtf2LIWTw-vCUjXD33zJPqPcPQVB8,10684
7
+ lunalib/core/daemon.py,sha256=h8I68axWR78I8w5eOrBBQwfTeAxGqOKKW0RtLoQ52yM,16189
7
8
  lunalib/core/mempool.py,sha256=itYFGQEuUde0Xh6WXcEz_n8hDsNhxkEAlRQ5g_Qiygg,14845
9
+ lunalib/core/p2p.py,sha256=TQ44vQk1aak4hu1Q7jAXfsynS0Eu0xfTjlK06r066ek,13081
8
10
  lunalib/core/sm2.py,sha256=Eq8Er3XQW5rYJXwaPT5vw5NoVXbSWhyuvjoG1LMo-NQ,23454
9
11
  lunalib/core/wallet.py,sha256=RNrEI7_tsaJOLcCJoTy_lLj22bc_bJtoO7iR3C3u7Ls,57435
10
12
  lunalib/core/wallet_manager.py,sha256=KK58hrr_xF1vZ4qI6x_BJqrs9XXh5m0XbZYnZmi9yoU,26031
11
13
  lunalib/core/wallet_sync_helper.py,sha256=CGfSBXvf8vg4SGsLaxsjGwHVbD9dmfcuMrZ_CO0J5lE,6282
12
14
  lunalib/gtx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
15
  lunalib/gtx/bill_registry.py,sha256=J1TivYIzmJEVQHNJrZxqOOEbUSlJs7rQIXfSA90ztL4,4333
14
- lunalib/gtx/digital_bill.py,sha256=EnQvAztMNE9uHuxXWmShEpNl084y-clHagK5s1Amvpc,10614
15
- lunalib/gtx/genesis.py,sha256=Mic48kI93fzMoz3Zm8xXGk8MXqUhfpLsNFLs8-ZJdCE,15939
16
- lunalib/mining/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- lunalib/mining/cuda_manager.py,sha256=PUnmVvpu98OTZNdKIIYpVXnY__Ng4pHyZoh8wU-tDCM,5174
18
- lunalib/mining/difficulty.py,sha256=tzIYmdcm1Xr9-8wyTwwkXJvJoGDyE77o_nu9d81VGvI,3927
19
- lunalib/mining/miner.py,sha256=8MYsp3-ua5K-8FneHWfEkdOezWhluDRe3ACJeIGAA-0,27930
16
+ lunalib/gtx/digital_bill.py,sha256=xi2d7RVBGFwDOr8ulMCgvXXebHKl9LeeW9f5H4j_P_A,10977
17
+ lunalib/gtx/genesis.py,sha256=dDiLz-jW0zr5WUifYo9lzsrafQGOuZ9oakv_TX6QdPg,16028
18
+ lunalib/mining/__init__.py,sha256=kOwXt_fwjHLUvV3XxieG2LZyKMW316brXLF8V8lHBUo,193
19
+ lunalib/mining/cuda_manager.py,sha256=VjVx9KLhT2F1jOOhva8ioGP32oQIAciZjf1irWl1jJY,5136
20
+ lunalib/mining/difficulty.py,sha256=hKCtvEovb4le5Fnhz6Mm8-Cugjm_CduJnZA2aNC2eyU,5326
21
+ lunalib/mining/miner.py,sha256=nGzfv4oK1evDXeYyS6lzaAWc8IolFrO99F0ZucBH3Ec,47715
20
22
  lunalib/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
23
  lunalib/storage/cache.py,sha256=U-riY8OTzxCOpl8yvhpbU3YUysEKgrPlmhO4F4cI9FM,5352
22
24
  lunalib/storage/database.py,sha256=2f3Ie6JnuK7L0YGtAdZt5mgj90pokneXhSQKUyvx8Pc,8219
23
25
  lunalib/storage/encryption.py,sha256=59g8vFFPAkc_L7t2TXas9Rs4oB3JB1t5ikmDbs4aaqM,4399
24
26
  lunalib/transactions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
- lunalib/transactions/security.py,sha256=3q0ENtUD9C3C6FbocwzbDtMXcedKEpeUQdEBNUVSHXA,10269
26
- lunalib/transactions/transactions.py,sha256=3Y0Gu-vIdtIdIwj1z2oymIJ3LPPWsYTQULny-eVtvPA,18016
27
+ lunalib/transactions/security.py,sha256=cQJRasJ37Z8mJo8gt0JJOb0_M9CQ0QScr67y3M_NP4Q,10309
28
+ lunalib/transactions/transactions.py,sha256=3PgyW8gDQwY-gAPGY_T3m7RE_9HzEIOjTf6CWCsOKFY,18151
27
29
  lunalib/transactions/validator.py,sha256=FQ-jVjj8VoVTlq65blB_hprAwJOtpc2peYdQk_L2xmg,2730
28
- lunalib-1.5.2.dist-info/METADATA,sha256=D88XMMu1LCG1mmFt7NaavHGWndGw6nIPGUoKB1LZAvI,628
29
- lunalib-1.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- lunalib-1.5.2.dist-info/top_level.txt,sha256=eLcoOCtOwfvoqUu5g5CNBZB9bdhGXbTwmjuOM7i8ylw,8
31
- lunalib-1.5.2.dist-info/RECORD,,
30
+ lunalib-1.6.6.dist-info/METADATA,sha256=fn5JvUFlgnjjR3vqMOeP-ojwd255pdlWymqnMqa6Pys,774
31
+ lunalib-1.6.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
+ lunalib-1.6.6.dist-info/top_level.txt,sha256=eLcoOCtOwfvoqUu5g5CNBZB9bdhGXbTwmjuOM7i8ylw,8
33
+ lunalib-1.6.6.dist-info/RECORD,,