Creating a Bitcoin Miner with Python?

5 replies 411 views
0xM1nerSenior Member
Posts: 1 · Reputation: 820
#1Jul 5, 2019, 05:09 AM
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:
13 Reply Quote Share
gang2015Member
Posts: 693 · Reputation: 62
#2Jul 6, 2019, 08:50 PM
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?
6 Reply Quote Share
wallet21Senior Member
Posts: 166 · Reputation: 1361
#3Jul 7, 2019, 09:23 PM
Are you serious right now? You're the same person who claimed someone hacked your wallet, right? Why make up that story?
6 Reply Quote Share
0xNodeMember
Posts: 680 · Reputation: 80
#4Jul 8, 2019, 01:22 AM
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.
8 Reply Quote Share
gang2015Member
Posts: 693 · Reputation: 62
#5Jul 9, 2019, 12:50 PM
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.
10 Reply Quote Share
0xNodeMember
Posts: 680 · Reputation: 80
#6Jul 9, 2019, 07:02 PM
@julia335, if you're selling something, this should go in the Marketplace section.
3 Reply Quote Share

Related topics