Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Announcing new combined topic for F@H. Official LTT F@H FAQ & Guide.

I made my own super fast bitcoin miner, however I need help linking to blockchain.

Go to solution Solved by 2FA,

Look at the source of existing miners to see how they fetch the info, but I will say that finding a novel way of solving a single block that you know the details of already does not make a fast miner, along with the fact that Python is incredibly slow compared to the C or C++ that all the existing miners are written in. If you're only doing it for fun and learning, then just use an API of some blockchain explorer service. I'm not familiar with Bitcoin ones but an ETH equivalent would be something like Etherscan.

Like the title states I made a bitcoin miner that is able to solve Block 286819 in a few seconds, however I had to manually pull information from the linked site. The information required was the previous block, mrkl_root, version, bits, and the difficulty as hex. Like so: 

ver = 2

prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"

mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"

time_ = 0x53058b35 # 2014-02-20 04:57:25

bits = 0x19015f53

# https://en.bitcoin.it/wiki/Difficulty

exp = bits >> 24

mant = bits & 0xffffff

target_hexstr = '%064x' % (mant * (1<<(8*(exp - 3))))

target_str = bytes.fromhex(target_hexstr)

Obviously I don't want to go get this information manually for every single block, I'm using python3 and I also need a way to submit the information as well.

Link to post
Share on other sites

Look at the source of existing miners to see how they fetch the info, but I will say that finding a novel way of solving a single block that you know the details of already does not make a fast miner, along with the fact that Python is incredibly slow compared to the C or C++ that all the existing miners are written in. If you're only doing it for fun and learning, then just use an API of some blockchain explorer service. I'm not familiar with Bitcoin ones but an ETH equivalent would be something like Etherscan.

[Out-of-date] Want to learn how to make your own custom Windows 10 image?

 

Desktop: AMD R9 3900X | ASUS ROG Strix X570-F | Radeon RX 5700 XT | EVGA GTX 1080 SC | 32GB Trident Z Neo 3600MHz | 1TB 970 EVO | 256GB 840 EVO | 960GB Corsair Force LE | EVGA G2 850W | Phanteks P400S

Laptop: Intel M-5Y10c | Intel HD Graphics | 8GB RAM | 250GB Micron SSD | Asus UX305FA

Server 01: Intel Xeon D 1541 | ASRock Rack D1541D4I-2L2T | 32GB Hynix ECC DDR4 | 4x8TB Western Digital HDDs | 32TB Raw 16TB Usable

Server 02: Intel i7 7700K | Gigabye Z170N Gaming5 | 16GB Trident Z 3200MHz

Link to post
Share on other sites

Plus that's a 2014 block, so difficulty would be waaay lower compared to blocks nowadays. Try it on a recent block and see how fast it is.

Crystal: CPU: i7 7700K | Motherboard: Asus ROG Strix Z270F | RAM: GSkill 16 GB@3200MHz | GPU: Nvidia GTX 1080 Ti FE | Case: Corsair Crystal 570X (black) | Storage: 250 GB Crucial BX100 SSD + 2 TB Seagate HDD + 1TB WD Green + 3TB WD Red | PSU: EVGA Supernova G2 1000W | Monitor: Asus VG248QE 24"

Laptop: Dell XPS 13 9360 | CPU: i5 7200U | RAM: 8 GB

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×