A Miner That Won't Melt Your Phone, from Kozmonot20

A Miner That Won't Melt Your Phone, from Kozmonot20

●2 ●12
calendar_today • schedule2 min read

Alright, here’s some code from Kozmonot20 that allows for mining without destroying anything:
import socket
import hashlib
import urllib.request
import json
import time
import threading # Çekirdek kontrolü için eklendi

--- KULLANICI AYARLARI ---

USERNAME = "KENDI_DUCO_KULLANICI_ADIN"
MINER_NAME = "StealthPhone_V2"

def get_mining_pool():

try:
    response = urllib.request.urlopen("https://duinocoin.com").read().decode()
    pool_data = json.loads(response)
    return pool_data["ip"], pool_data["port"]
except:
    time.sleep(5)
    return get_mining_pool()

def thread_miner_logic(thread_id):

"""Her bir çekirdeğin arkada bağımsız ve güvenli çalışmasını sağlayan fonksiyon."""
print(f"🕵️♂️ Hayalet Çekirdek-{thread_id} arka planda devreye girdi...")

while True:
    try:
        ip, port = get_mining_pool()
        soc = socket.socket()
        soc.connect((ip, int(port)))
        soc.recv(100) 
        
        while True:
            soc.send(f"JOB,{USERNAME},LOW,KozmoSecretKey".encode())
            job_data = soc.recv(1024).decode().rstrip("\n").split(",")
            
            if len(job_data) < 3:
                break
                
            previous_hash = job_data
            expected_hash = job_data
            difficulty = int(job_data)
            
            start_time = time.time()
            
            # --- AKILLI FREN SİSTEMİ ---
            for nonce in range(100 * difficulty + 1):
                hash_result = hashlib.sha1((previous_hash + str(nonce)).encode()).hexdigest()
                
                # Güvenlik Freni: Her 800 tahminde bir işlemciyi 30 milisaniye dinlendir
                if nonce % 800 == 0:
                    time.sleep(0.03) 
                
                if hash_result == expected_hash:
                    end_time = time.time()
                    elapsed_time = end_time - start_time
                    hashrate = nonce / elapsed_time if elapsed_time > 0 else 0
                    
                    soc.send(f"{nonce},{hashrate:.0f},Python Stealth V2,{MINER_NAME}".encode())
                    feedback = soc.recv(100).decode().rstrip("\n")
                    
                    if feedback == "GOOD":
                        print(f"🟢 [Çekirdek-{thread_id}] Blok Kazıldı! Telefon hala buz gibi. 🧊")
                    
                    # Blok arası dinamik bekleme: 1.5 saniye mola işlemciyi tamamen soğutur
                    time.sleep(1.5) 
                    break
                    
    except Exception as e:
        time.sleep(5)

def start_stealth_v2():

print("🪐 Kozmonot20 Geliştirilmiş Güvenli Madencilik Laboratuvarı v2.0")
print("🔒 Telefon Sağlığı: %100 Güvende | İşlemci Yükü: Minimum\n")

# 🚨 GÜVENLİK SINIRI: Sadece 2 thread (iş parçacığı) açıyoruz. 
# Telefonun 8 çekirdeğinden sadece 2'sini yormadan kullanır, bataryayı asla şişirmez!
for i in range(2):
    t = threading.Thread(target=thread_miner_logic, args=(i+1,))
    t.start()
    time.sleep(0.5) # Thread'ler aynı anda yüklenmesin diye araya minik bir gecikme koy

if name == "main":

start_stealth_v2()

Want more #programming & #python deep dives?

Join 5,942+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

Your Tech Stack Isn’t Your Ceiling. Your Story Is

Karol Modelski - Apr 9

A Message From Our Founder: On the Winding Down of LaaSy™

Ken W. Algerverified - Oct 29

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Frameworks Are Institutional Memory

Ken W. Algerverified - Sep 17

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23
chevron_left
772 Points • 14 Badges
6Posts
0Comments
3Connections
I am a comedy/technical writer and coder, cosmonaut20.

Related Jobs

Commenters (This Week)

2 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!