Bitcoin Forum
May 11, 2024, 04:47:07 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Stratum (or getblocktemplate) Mining Example  (Read 152 times)
De Paashaas (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
February 05, 2022, 04:01:22 PM
 #1

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.
1715446027
Hero Member
*
Offline Offline

Posts: 1715446027

View Profile Personal Message (Offline)

Ignore
1715446027
Reply with quote  #2

1715446027
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
kano
Legendary
*
Offline Offline

Activity: 4494
Merit: 1808


Linux since 1997 RedHat 4


View Profile
February 06, 2022, 12:12:20 AM
 #2

Stratum is for pooled mining, so the whole documentation of it is in the pool thread:
https://bitcointalk.org/index.php?topic=557866.0

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
Soontech
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 09, 2022, 08:54:04 AM
 #3

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/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!