I'm trying to find some actual python code for real bitcoin mining. Anyone got something that works? So far, I only have this script that just simulates it.
import hashlib
import time
def calculate_hash(block_header):
return hashlib.sha256(block_header.encode()).hexdigest()
def mine_block(previous_hash, transactions, difficulty):
nonce = 0
start_time = time.time()
while True:
block_header = f"{previous_hash}{transactions}{nonce}"
block_hash = calculate_hash(block_header)
if block_hash[:difficulty] == '0' * difficulty:
Creating a Bitcoin Miner with Python?
5 replies 71 views
You could just google it and find some stuff. I came across these links:
https://this forum.org/index.php?topic=3546.0
https://github.com/muimota/miniminer
Just a heads up, I haven't tested any of those myself. Not responsible if they suck or are malicious. And can we skip the SEO spam?
Are you serious right now? You're the same person who claimed someone hacked your wallet, right? Why make up that story?
If you wanna build a real mining app in python, you can't really do the SHA256d hashing part yourself. The best you can do is collect the hashes from mining hardware and send them to a pool like ViaBTC.
No matter if it's SEO or ads, that goes against the forum rules.
True, but OP never said anything about making money. Feels like they just wanna promote something while replying.
@julia335, if you're selling something, this should go in the Marketplace section.