Guest User

Untitled

a guest
Jan 12th, 2026
502
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.86 KB | Cryptocurrency | 0 0
  1. import socket
  2. import json
  3. import time
  4. import threading
  5. import hashlib
  6. import struct
  7. from requests.auth import HTTPBasicAuth
  8. import requests
  9.  
  10. # Configuration du nœud Bitcoin2
  11. RPC_USER = "RPC user"
  12. RPC_PASSWORD = "RPC pass"
  13. RPC_HOST = "127.0.0.1"
  14. RPC_PORT = 8332 # Port RPC de Bitcoin2
  15. RPC_URL = f"http://{RPC_HOST}:{RPC_PORT}"
  16.  
  17. # Configuration du serveur Stratum
  18. STRATUM_HOST = "0.0.0.0" # Écoute sur toutes les interfaces
  19. STRATUM_PORT = 3333 # Port standard pour Stratum
  20. DIFFICULTY = 1000 # Difficulté initiale pour le Bitaxe (sera ajustée automatiquement)
  21.  
  22. # Configuration Vardiff (difficulté variable)
  23. TARGET_SHARE_TIME = 15 # Cible: 1 share toutes les 15 secondes
  24. VARDIFF_MIN = 100 # Difficulté minimum
  25. VARDIFF_MAX = 100000 # Difficulté maximum
  26. VARDIFF_RETARGET_TIME = 90 # Recalculer la difficulté toutes les 90 secondes
  27. VARDIFF_VARIANCE = 0.3 # Variance acceptée (30%)
  28.  
  29. class Bitcoin2RPC:
  30. """Classe pour communiquer avec le nœud Bitcoin2"""
  31.  
  32. def __init__(self, user, password, url):
  33. self.auth = HTTPBasicAuth(user, password)
  34. self.url = url
  35. self.id_counter = 0
  36.  
  37. def call(self, method, params=None):
  38. """Effectue un appel RPC"""
  39. if params is None:
  40. params = []
  41.  
  42. self.id_counter += 1
  43. payload = {
  44. "jsonrpc": "2.0",
  45. "id": self.id_counter,
  46. "method": method,
  47. "params": params
  48. }
  49.  
  50. try:
  51. response = requests.post(
  52. self.url,
  53. data=json.dumps(payload),
  54. headers={"content-type": "application/json"},
  55. auth=self.auth,
  56. timeout=30
  57. )
  58.  
  59. if response.status_code == 200:
  60. result = response.json()
  61. if "error" in result and result["error"]:
  62. print(f"❌ Erreur RPC {method}: {result['error']}")
  63. return None
  64. return result.get("result")
  65. else:
  66. print(f"❌ Erreur HTTP {response.status_code}")
  67. return None
  68.  
  69. except Exception as e:
  70. print(f"❌ Erreur connexion RPC: {e}")
  71. return None
  72.  
  73. def get_block_template(self):
  74. """Récupère le template de bloc pour mining"""
  75. # Essayer d'abord avec les règles segwit
  76. template = self.call("getblocktemplate", [{"rules": ["segwit"]}])
  77. if template is None:
  78. # Fallback sans règles
  79. template = self.call("getblocktemplate", [{}])
  80. if template is None:
  81. # Dernier fallback sans paramètres
  82. template = self.call("getblocktemplate")
  83. return template
  84.  
  85. def submit_block(self, block_hex):
  86. """Soumet un bloc miné"""
  87. return self.call("submitblock", [block_hex])
  88.  
  89. def get_info(self):
  90. """Récupère les infos du nœud"""
  91. # Essayer différentes méthodes selon la version
  92. info = self.call("getblockchaininfo")
  93. if info is None:
  94. info = self.call("getinfo")
  95. if info is None:
  96. # Fallback: essayer getnetworkinfo
  97. network_info = self.call("getnetworkinfo")
  98. blockchain_info = self.call("getblockchaininfo")
  99. if network_info and blockchain_info:
  100. info = {**network_info, **blockchain_info}
  101. return info
  102.  
  103. def get_mining_info(self):
  104. """Récupère les infos de mining"""
  105. return self.call("getmininginfo")
  106.  
  107. def get_block_count(self):
  108. """Récupère le nombre de blocs"""
  109. return self.call("getblockcount")
  110.  
  111. def get_network_info(self):
  112. """Récupère les infos réseau"""
  113. return self.call("getnetworkinfo")
  114.  
  115.  
  116. class StratumServer:
  117. """Serveur Stratum pour Bitaxe Gamma"""
  118.  
  119. def __init__(self, host, port, rpc):
  120. self.host = host
  121. self.port = port
  122. self.rpc = rpc
  123. self.clients = {}
  124. self.job_id = 0
  125. self.current_template = None
  126. self.running = False
  127. self.server_socket = None
  128.  
  129. def start(self):
  130. """Démarre le serveur Stratum"""
  131. self.running = True
  132. self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  133. self.server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  134.  
  135. try:
  136. self.server_socket.bind((self.host, self.port))
  137. self.server_socket.listen(5)
  138. print(f"✅ Serveur Stratum démarré sur {self.host}:{self.port}")
  139. print(f"📡 Configurez votre Bitaxe Gamma avec:")
  140. print(f" URL: stratum+tcp://{self._get_local_ip()}:{self.port}")
  141. print(f" User: bc2miner")
  142. print(f" Password: x\n")
  143.  
  144. # Thread pour mettre à jour les jobs
  145. update_thread = threading.Thread(target=self._update_jobs, daemon=True)
  146. update_thread.start()
  147.  
  148. # Accepter les connexions
  149. while self.running:
  150. try:
  151. print("⏳ En attente de connexion...")
  152. client_socket, address = self.server_socket.accept()
  153. print(f"🔌 Nouvelle connexion détectée: {address}")
  154. client_socket.settimeout(30) # Timeout de 30 secondes
  155. client_thread = threading.Thread(
  156. target=self._handle_client,
  157. args=(client_socket, address),
  158. daemon=True
  159. )
  160. client_thread.start()
  161. print(f"✅ Thread démarré pour {address}")
  162. except Exception as e:
  163. if self.running:
  164. print(f"❌ Erreur acceptation connexion: {e}")
  165. import traceback
  166. traceback.print_exc()
  167.  
  168. except Exception as e:
  169. print(f"❌ Erreur serveur: {e}")
  170. finally:
  171. if self.server_socket:
  172. self.server_socket.close()
  173.  
  174. def _get_local_ip(self):
  175. """Récupère l'IP locale"""
  176. try:
  177. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  178. s.connect(("8.8.8.8", 80))
  179. ip = s.getsockname()[0]
  180. s.close()
  181. return ip
  182. except:
  183. return "127.0.0.1"
  184.  
  185. def _handle_client(self, client_socket, address):
  186. """Gère une connexion client (Bitaxe)"""
  187. client_id = f"{address[0]}:{address[1]}"
  188. print(f"🎯 Handler démarré pour {client_id}")
  189.  
  190. self.clients[client_id] = {
  191. "socket": client_socket,
  192. "address": address,
  193. "subscribed": False,
  194. "authorized": False,
  195. "worker": None,
  196. "difficulty": DIFFICULTY,
  197. "shares": 0,
  198. "last_share": None,
  199. "share_times": [], # Pour vardiff
  200. "last_retarget": time.time() # Dernier ajustement de difficulté
  201. }
  202.  
  203. buffer = ""
  204.  
  205. try:
  206. print(f"👂 En écoute sur {client_id}...")
  207. while self.running:
  208. try:
  209. data = client_socket.recv(4096)
  210. if not data:
  211. print(f"📭 Connexion fermée par {client_id}")
  212. break
  213.  
  214. print(f"📦 Données reçues de {client_id}: {len(data)} bytes")
  215. buffer += data.decode('utf-8')
  216.  
  217. # Traiter les messages complets (séparés par \n)
  218. while '\n' in buffer:
  219. line, buffer = buffer.split('\n', 1)
  220. line = line.strip()
  221.  
  222. if line:
  223. try:
  224. request = json.loads(line)
  225. print(f"📩 Reçu de {client_id}: {request.get('method', 'unknown')}")
  226. response = self._process_request(client_id, request)
  227. if response:
  228. response_str = json.dumps(response) + '\n'
  229. client_socket.sendall(response_str.encode('utf-8'))
  230. print(f"📤 Envoyé à {client_id}: {response.get('result', response.get('method', 'response'))}")
  231. except json.JSONDecodeError as e:
  232. print(f"⚠️ Message JSON invalide de {client_id}: {line[:100]}")
  233. except Exception as e:
  234. print(f"⚠️ Erreur traitement message de {client_id}: {e}")
  235. import traceback
  236. traceback.print_exc()
  237.  
  238. except socket.timeout:
  239. print(f"⏱️ Timeout sur {client_id}")
  240. continue
  241. except Exception as e:
  242. print(f"❌ Erreur recv de {client_id}: {e}")
  243. import traceback
  244. traceback.print_exc()
  245. break
  246.  
  247. except Exception as e:
  248. print(f"❌ Erreur client {client_id}: {e}")
  249. import traceback
  250. traceback.print_exc()
  251. finally:
  252. print(f"🔌 Déconnexion: {client_id}")
  253. if client_id in self.clients:
  254. del self.clients[client_id]
  255. try:
  256. client_socket.close()
  257. except:
  258. pass
  259.  
  260. def _process_request(self, client_id, request):
  261. """Traite une requête Stratum"""
  262. method = request.get("method")
  263. params = request.get("params", [])
  264. req_id = request.get("id")
  265.  
  266. if method == "mining.configure":
  267. # Le Bitaxe demande la configuration (version_rolling, etc.)
  268. return {
  269. "id": req_id,
  270. "result": {
  271. "version-rolling": True,
  272. "version-rolling.mask": "1fffe000"
  273. },
  274. "error": None
  275. }
  276.  
  277. elif method == "mining.subscribe":
  278. self.clients[client_id]["subscribed"] = True
  279. return {
  280. "id": req_id,
  281. "result": [
  282. [["mining.notify", "subscription_id"]],
  283. "extranonce1",
  284. 4 # extranonce2_size
  285. ],
  286. "error": None
  287. }
  288.  
  289. elif method == "mining.authorize":
  290. worker = params[0] if params else "unknown"
  291. self.clients[client_id]["authorized"] = True
  292. self.clients[client_id]["worker"] = worker
  293. print(f"✅ Worker autorisé: {worker} ({client_id})")
  294.  
  295. # Envoyer la difficulté
  296. self._send_difficulty(client_id)
  297.  
  298. # Envoyer le premier job
  299. if self.current_template:
  300. self._send_job(client_id)
  301.  
  302. return {
  303. "id": req_id,
  304. "result": True,
  305. "error": None
  306. }
  307.  
  308. elif method == "mining.submit":
  309. return self._handle_share(client_id, params, req_id)
  310.  
  311. elif method == "mining.suggest_difficulty":
  312. # Le mineur suggère une difficulté
  313. suggested_diff = params[0] if params else 1000
  314. print(f"💡 Difficulté suggérée par {client_id}: {suggested_diff}")
  315. self.clients[client_id]["difficulty"] = suggested_diff
  316. self._send_difficulty(client_id)
  317. return {
  318. "id": req_id,
  319. "result": True,
  320. "error": None
  321. }
  322.  
  323. elif method == "mining.extranonce.subscribe":
  324. return {
  325. "id": req_id,
  326. "result": True,
  327. "error": None
  328. }
  329.  
  330. return None
  331.  
  332. def _send_difficulty(self, client_id):
  333. """Envoie la difficulté au client"""
  334. if client_id not in self.clients:
  335. return
  336.  
  337. difficulty = self.clients[client_id]["difficulty"]
  338. message = {
  339. "id": None,
  340. "method": "mining.set_difficulty",
  341. "params": [difficulty]
  342. }
  343.  
  344. try:
  345. self.clients[client_id]["socket"].sendall(
  346. (json.dumps(message) + '\n').encode('utf-8')
  347. )
  348. except:
  349. pass
  350.  
  351. def _send_job(self, client_id=None):
  352. """Envoie un nouveau job de mining"""
  353. if not self.current_template:
  354. print("⚠️ Pas de template disponible pour envoyer un job")
  355. return
  356.  
  357. self.job_id += 1
  358. job_params = self._create_job()
  359.  
  360. if not job_params:
  361. print("⚠️ Échec de création du job")
  362. return
  363.  
  364. message = {
  365. "id": None,
  366. "method": "mining.notify",
  367. "params": job_params
  368. }
  369.  
  370. clients_to_notify = [client_id] if client_id else list(self.clients.keys())
  371.  
  372. for cid in clients_to_notify:
  373. if cid in self.clients and self.clients[cid]["authorized"]:
  374. try:
  375. message_str = json.dumps(message) + '\n'
  376. self.clients[cid]["socket"].sendall(message_str.encode('utf-8'))
  377. print(f"📤 Job {self.job_id} envoyé à {cid}")
  378. print(f" 📦 Taille: {len(message_str)} bytes")
  379. except Exception as e:
  380. print(f"❌ Erreur envoi job à {cid}: {e}")
  381.  
  382. def _create_job(self):
  383. """Crée un job Stratum depuis le template"""
  384. if not self.current_template:
  385. return None
  386.  
  387. template = self.current_template
  388.  
  389. # Extraire les données du template
  390. prevhash = template.get('previousblockhash', '0' * 64)
  391. # IMPORTANT: Stratum utilise little-endian pour prevhash
  392. prevhash_le = ''.join([prevhash[i:i+2] for i in range(0, len(prevhash), 2)][::-1])
  393.  
  394. height = template.get('height', 0)
  395. version = template.get('version', 1)
  396. nbits = template.get('bits', '1d00ffff')
  397. ntime = template.get('curtime', int(time.time()))
  398.  
  399. # Calculer la difficulté depuis bits
  400. difficulty = template.get('difficulty', 0)
  401. if difficulty == 0:
  402. bits_int = int(nbits, 16)
  403. exp = bits_int >> 24
  404. mant = bits_int & 0xffffff
  405. target = mant * (2 ** (8 * (exp - 3)))
  406. difficulty = (0xffff * 2**208) / target if target > 0 else 0
  407.  
  408. # Construction de la coinbase avec la hauteur encodée correctement
  409. # La hauteur doit être encodée selon BIP34
  410. if height <= 16:
  411. height_script = f"{0x50 + height:02x}"
  412. elif height < 0x80:
  413. height_script = f"01{height:02x}"
  414. elif height < 0x8000:
  415. height_bytes = height.to_bytes(2, 'little')
  416. height_script = f"02{height_bytes.hex()}"
  417. else:
  418. height_bytes = height.to_bytes(4, 'little')
  419. # Trouver la longueur nécessaire
  420. length = 4
  421. while length > 1 and height_bytes[length-1] == 0:
  422. length -= 1
  423. height_script = f"{length:02x}" + height_bytes[:length].hex()
  424.  
  425. # Message personnalisé pour identifier votre pool
  426. custom_message = "Mined with BitAxe on BC2"
  427. custom_hex = custom_message.encode('ascii').hex()
  428.  
  429. # Coinbase script complet: height + message + espace pour extranonce
  430. coinbase_script_prefix = height_script + f"{len(custom_message):02x}" + custom_hex
  431. extranonce_size = 8 # 8 bytes d'extranonce (4 + 4)
  432.  
  433. # Taille totale du script
  434. total_script_size = len(coinbase_script_prefix)//2 + extranonce_size
  435.  
  436. # Coinbase transaction
  437. coinb1 = (
  438. "02000000" + # version 2
  439. "01" + # 1 input
  440. "0000000000000000000000000000000000000000000000000000000000000000" + # prev hash (null)
  441. "ffffffff" + # prev index
  442. f"{total_script_size:02x}" + # script size total
  443. coinbase_script_prefix # height + message
  444. # extranonce sera ajouté ici par le mineur
  445. )
  446.  
  447. # Output de la coinbase
  448. coinbase_value = template.get('coinbasevalue', 5000000000)
  449. value_bytes = struct.pack('<Q', coinbase_value).hex()
  450.  
  451. # Utiliser une vraie adresse si disponible dans coinbaseaux
  452. coinbase_aux = template.get('coinbaseaux', {})
  453.  
  454. coinb2 = (
  455. "ffffffff" + # sequence
  456. "01" + # 1 output
  457. value_bytes + # amount
  458. "19" + # script length (25 bytes)
  459. "76a914" + # OP_DUP OP_HASH160
  460. "0000000000000000000000000000000000000000" + # pubkey hash
  461. "88ac" + # OP_EQUALVERIFY OP_CHECKSIG
  462. "00000000" # locktime
  463. )
  464.  
  465. # Merkle branches - DOIVENT être en little-endian
  466. merkle_branch = []
  467. transactions = template.get('transactions', [])
  468. if transactions:
  469. for tx in transactions[:20]:
  470. txid = tx.get('txid', tx.get('hash', ''))
  471. if txid:
  472. # Convertir en little-endian
  473. txid_le = ''.join([txid[i:i+2] for i in range(0, len(txid), 2)][::-1])
  474. merkle_branch.append(txid_le)
  475.  
  476. # Formats Stratum standard
  477. version_hex = f"{version:08x}" # Big endian hex string
  478. ntime_hex = f"{ntime:08x}" # Big endian hex string
  479.  
  480. print(f"📋 Job {self.job_id}:")
  481. print(f" Height: {height}")
  482. print(f" Difficulty: {difficulty:.2f}")
  483. print(f" Transactions: {len(merkle_branch)}")
  484. print(f" Version: {version_hex}")
  485. print(f" Bits: {nbits}")
  486. print(f" Time: {ntime_hex}")
  487. print(f" Prevhash (LE): {prevhash_le[:20]}...")
  488. print(f" Coinbase script: {coinbase_script_prefix}")
  489. print(f" Coinb1 length: {len(coinb1)//2} bytes")
  490. print(f" Coinb2 length: {len(coinb2)//2} bytes")
  491.  
  492. return [
  493. str(self.job_id), # job_id
  494. prevhash_le, # prevhash en LITTLE ENDIAN
  495. coinb1, # coinb1
  496. coinb2, # coinb2
  497. merkle_branch, # merkle_branch en LITTLE ENDIAN
  498. version_hex, # version
  499. nbits, # nbits
  500. ntime_hex, # ntime
  501. True # clean_jobs
  502. ]
  503.  
  504. def _handle_share(self, client_id, params, req_id):
  505. """Traite une share soumise"""
  506. if client_id not in self.clients:
  507. return {"id": req_id, "result": False, "error": [21, "Unknown worker", None]}
  508.  
  509. current_time = time.time()
  510. client = self.clients[client_id]
  511.  
  512. # Enregistrer la share
  513. client["shares"] += 1
  514. client["last_share"] = current_time
  515. client["share_times"].append(current_time)
  516.  
  517. # Garder seulement les 20 dernières shares pour le calcul
  518. if len(client["share_times"]) > 20:
  519. client["share_times"] = client["share_times"][-20:]
  520.  
  521. worker = client["worker"]
  522. shares = client["shares"]
  523.  
  524. # Calculer le temps moyen entre shares
  525. avg_share_time = None
  526. if len(client["share_times"]) >= 2:
  527. time_diffs = []
  528. for i in range(1, len(client["share_times"])):
  529. time_diffs.append(client["share_times"][i] - client["share_times"][i-1])
  530. avg_share_time = sum(time_diffs) / len(time_diffs)
  531.  
  532. print(f"✨ Share #{shares} de {worker} (Diff: {client['difficulty']})", end="")
  533. if avg_share_time:
  534. print(f" - Temps moyen: {avg_share_time:.1f}s")
  535. else:
  536. print()
  537.  
  538. # Ajuster la difficulté si nécessaire
  539. time_since_retarget = current_time - client["last_retarget"]
  540. if time_since_retarget >= VARDIFF_RETARGET_TIME and avg_share_time:
  541. self._adjust_difficulty(client_id, avg_share_time)
  542.  
  543. return {
  544. "id": req_id,
  545. "result": True,
  546. "error": None
  547. }
  548.  
  549. def _adjust_difficulty(self, client_id, avg_share_time):
  550. """Ajuste la difficulté pour ce client (vardiff)"""
  551. if client_id not in self.clients:
  552. return
  553.  
  554. client = self.clients[client_id]
  555. current_diff = client["difficulty"]
  556.  
  557. # Calculer la nouvelle difficulté basée sur le temps moyen
  558. # Formule: new_diff = current_diff * (avg_time / target_time)
  559. ratio = avg_share_time / TARGET_SHARE_TIME
  560.  
  561. # Appliquer seulement si la variance est significative
  562. if abs(1 - ratio) < VARDIFF_VARIANCE:
  563. return # Pas besoin d'ajuster
  564.  
  565. new_diff = current_diff * ratio
  566.  
  567. # Limiter entre min et max
  568. new_diff = max(VARDIFF_MIN, min(VARDIFF_MAX, new_diff))
  569.  
  570. # Arrondir à un nombre propre
  571. new_diff = round(new_diff / 100) * 100
  572.  
  573. if new_diff != current_diff:
  574. print(f"🎯 Ajustement difficulté pour {client['worker']}:")
  575. print(f" {current_diff} → {new_diff} (temps moyen: {avg_share_time:.1f}s, cible: {TARGET_SHARE_TIME}s)")
  576.  
  577. client["difficulty"] = new_diff
  578. client["last_retarget"] = time.time()
  579.  
  580. # Envoyer la nouvelle difficulté
  581. self._send_difficulty(client_id)
  582.  
  583. def _update_jobs(self):
  584. """Met à jour les jobs périodiquement"""
  585. while self.running:
  586. try:
  587. template = self.rpc.get_block_template()
  588. if template and template != self.current_template:
  589. self.current_template = template
  590. height = template.get('height', '?')
  591. difficulty = template.get('difficulty', 0)
  592. print(f"🔄 Nouveau template de bloc (hauteur: {height})")
  593. print(f" 📊 Template keys: {list(template.keys())}")
  594. print(f" 🎯 Previous hash: {template.get('previousblockhash', 'N/A')[:20]}...")
  595. print(f" 💎 Difficulty: {difficulty}")
  596. print(f" 🔢 Bits: {template.get('bits', 'N/A')}")
  597. print(f" ⏰ Time: {template.get('curtime', 'N/A')}")
  598. self._send_job() # Broadcast à tous les clients
  599.  
  600. except Exception as e:
  601. print(f"⚠️ Erreur mise à jour template: {e}")
  602. import traceback
  603. traceback.print_exc()
  604.  
  605. time.sleep(10) # Vérifier toutes les 10 secondes
  606.  
  607. def stop(self):
  608. """Arrête le serveur"""
  609. print("\n🛑 Arrêt du serveur...")
  610. self.running = False
  611. if self.server_socket:
  612. self.server_socket.close()
  613. for client_id in list(self.clients.keys()):
  614. try:
  615. self.clients[client_id]["socket"].close()
  616. except:
  617. pass
  618. self.clients.clear()
  619.  
  620.  
  621. def main():
  622. print("=" * 60)
  623. print(" Serveur Stratum Bitcoin2 pour Bitaxe Gamma")
  624. print("=" * 60)
  625. print()
  626.  
  627. # Créer la connexion RPC
  628. rpc = Bitcoin2RPC(RPC_USER, RPC_PASSWORD, RPC_URL)
  629.  
  630. # Tester la connexion
  631. print("🔍 Test de connexion au nœud Bitcoin2...")
  632.  
  633. # Tester différentes méthodes RPC
  634. info = None
  635. block_count = rpc.get_block_count()
  636.  
  637. if block_count is not None:
  638. print("✅ Connexion au nœud réussie!")
  639. print(f" Blocs: {block_count}")
  640.  
  641. # Essayer d'obtenir plus d'infos
  642. network_info = rpc.get_network_info()
  643. if network_info:
  644. print(f" Version: {network_info.get('version', 'N/A')}")
  645. print(f" Connexions: {network_info.get('connections', 'N/A')}")
  646.  
  647. mining_info = rpc.get_mining_info()
  648. if mining_info:
  649. print(f" Difficulté: {mining_info.get('difficulty', 'N/A')}")
  650. print(f" Network hashrate: {mining_info.get('networkhashps', 'N/A')} H/s")
  651. else:
  652. print("\n❌ Impossible de se connecter au nœud Bitcoin2!")
  653. print("\n📝 Vérifiez que:")
  654. print(" 1. Bitcoin2-qt (bitcoinII-qt) est en cours d'exécution")
  655. print(" 2. Le fichier bitcoinII.conf contient:")
  656. print(" server=1")
  657. print(f" rpcuser={RPC_USER}")
  658. print(f" rpcpassword={RPC_PASSWORD}")
  659. print(" rpcallowip=127.0.0.1")
  660. print(f" rpcport={RPC_PORT}")
  661. print("\n 3. Le fichier bitcoinII.conf est dans le bon dossier:")
  662. print(" Windows: %APPDATA%\\BitcoinII\\")
  663. print(" Linux: ~/.bitcoinII/")
  664. print("\n⚠️ Redémarrez bitcoinII-qt après avoir modifié bitcoinII.conf")
  665. return
  666. print()
  667.  
  668. # Démarrer le serveur Stratum
  669. server = StratumServer(STRATUM_HOST, STRATUM_PORT, rpc)
  670.  
  671. try:
  672. server.start()
  673. except KeyboardInterrupt:
  674. print("\n\n⌨️ Interruption clavier détectée")
  675. finally:
  676. server.stop()
  677. print("✅ Serveur arrêté proprement")
  678.  
  679.  
  680. if __name__ == "__main__":
  681. main()
  682.  
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment