Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: De Paashaas on February 05, 2022, 04:01:22 PM



Title: Stratum (or getblocktemplate) Mining Example
Post by: De Paashaas on February 05, 2022, 04:01:22 PM
I'm currently trying to write some mining software. Nothing special, just for the fun of it and by doing so getting a thoroughly understanding of the protocol(s).

I started with the get block template but, yeah, turns out to be too complicated (especially the construction of the coinbase was a dumper...) so I reverted to Stratum (v1). If anyone has a good example of constructing a block from a block template, please be my guest.

While decoding the messages and doing the hash calculations I had some issues with little vs big endian, but managed to get them right eventually using examples I found on the internet. However for the last step (submitting a share) I did not found any example at all. :-(

basically, what I am looking for is an example (can be just a log of an existing miner) that states:

Given this mining notification: (some json)
And receiving this set_difficulty: (some json)
And eventually trying those Nonce and Extranonce2
Your software should submit this: (some json)

I have no special mining equipment, so mining takes forever. I was able to submit one share after running the program for a couple of houres, it was rejected. Propably because I had the difficulty wrong, now it is running all night without a single hit. So debugging to a real system is not an option.


Title: Re: Stratum (or getblocktemplate) Mining Example
Post by: kano on February 06, 2022, 12:12:20 AM
Stratum is for pooled mining, so the whole documentation of it is in the pool thread:
https://bitcointalk.org/index.php?topic=557866.0


Title: Re: Stratum (or getblocktemplate) Mining Example
Post by: Soontech on February 09, 2022, 08:54:04 AM
I'm also learning these new techniques and getting results through trial and error.  I think the process is more important than the result. If you have other problems, could you discuss with me?  I hope you can give me a chance to study together.  You can join me through MDClub.
http://bbs.soontechmining.com/