Bitcoin Forum
May 13, 2024, 11:07:04 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can someone point me to the entry point where mining code lives?  (Read 824 times)
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 09, 2013, 04:59:38 PM
 #1

I've been working my way through a lot of information as I setup hardware, learn about finance, dig into the mechanics etc.
I'm a programmer at heart and have been desiring a deeper understanding of the underlying code responsible for mining.
I've lived most my life doing back-end, so I get a bit lost in UI programming Wink any help pointing me to the underlying code would be greatly appreciated.

I've already through the P2P discovery bit, but I'm really more interested in the following code locations:

  • Where does new difficulty get calculated?
  • Where is the code that propagates new difficulty to the mining nodes?
  • Where is the code that deals with nuts and bolts of mining live? (Blockchain processing)

Any help or assistance would be hugely appreciated as I would love to knock the green off my understanding of the overall process Smiley

Also I will be sequence diagramming this code (and probably some other code) and documenting the functions.  I would be happy to share this with the dev community. Is there a preferred place or should I just use the regular bitcoin wiki?

I may also be doing local classes for developers (and some non-developers) and possible some online courses.  I will most likely be putting the curriculum into public domain.

Thanks Smiley



1715598424
Hero Member
*
Offline Offline

Posts: 1715598424

View Profile Personal Message (Offline)

Ignore
1715598424
Reply with quote  #2

1715598424
Report to moderator
You get merit points when someone likes your post enough to give you some. And for every 2 merit points you receive, you can send 1 merit point to someone else!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715598424
Hero Member
*
Offline Offline

Posts: 1715598424

View Profile Personal Message (Offline)

Ignore
1715598424
Reply with quote  #2

1715598424
Report to moderator
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
May 09, 2013, 05:07:18 PM
 #2

Did you read the sticky at the top of this board?

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 09, 2013, 05:14:07 PM
 #3

Did you read the sticky at the top of this board?

Yes did I miss something there? I didn't see where mining code was identified.  I read the specifications, but my understanding is the literal implementation of the code is where the facts live.  I'm hoping to map the facts of the code to the protocol specifications.


I looked again I assume you mean the "Satoshi Client Operation: Overview", but I'm still not seeing where it references mining.  Smiley let me know if I tarded out or something, as I'm a bit sleepy today and that is entirely possible Smiley
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 09, 2013, 05:19:31 PM
 #4

It did just occur to me that maybe what I'm looking for is actually in the open source mining clients combined with where the bitcoin client validates the proper block chain when a solution collision occurs.  Is this true? Maybe all I need from the bitcoin client is the solution collision/split resolution code? combined with some digging into mining clients? Anybody familiar with this?
jonytk
Member
**
Offline Offline

Activity: 106
Merit: 10



View Profile
May 09, 2013, 08:19:57 PM
Last edit: May 09, 2013, 09:24:09 PM by jonytk
 #5

Endlessa, with 17 posts...
post your credentials, or you are just another alt-developer or 4chan troll trying to hack a coin to make it proffitable.

If you are a proffessor, i think you need to lurk moar... i remember there's some wiki, satoshi pdf and threads explaining everything.

Use the Search first! You will find nice articles. or just look at the sourcecode!

Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 09, 2013, 08:52:10 PM
 #6

I am new without a doubt. I did make the mistake of thinking the forum was here to ask for help.  I guess I went to the wrong place.  Don't worry I will search the code I have the source, was just hoping some kind person would be helpful to people trying educate the community at large.  I thought this "community" project might be supportive of a community question. I was hoping someone might have a link set they'd share so I don't spend ages reproducing something somebody might have to share. . . .ya know like built on the shoulders of giants and all. No worries, I'll just use cpp2dia and keep the whole thing to myself.  thanks for being a dick.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
May 09, 2013, 08:56:46 PM
 #7

Endlessa, with 17 posts...
post your credentials, or you are just another alt-developer or 4chan troll trying to hack a coin to make it proffitable.

If you are a proffessor, i think you need to lurk moar... i remember there's some satoshi pdf and threads explaining everything.
Search or just look at the sourcecode!

That's a bit rude, don't you think?  Why do you care why he wants to learn more about the source?

Did you read the sticky at the top of this board?

Yes did I miss something there? I didn't see where mining code was identified.  I read the specifications, but my understanding is the literal implementation of the code is where the facts live.  I'm hoping to map the facts of the code to the protocol specifications.

I looked again I assume you mean the "Satoshi Client Operation: Overview", but I'm still not seeing where it references mining.  Smiley let me know if I tarded out or something, as I'm a bit sleepy today and that is entirely possible Smiley

As far as I know, those articles (links at the bottom to the others) are the best guide to the source that anyone has written up so far.  I'm not sure if they will tell you where to look exactly, but I had hoped that they may at least get you pointed in the right direction.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 09, 2013, 09:05:44 PM
 #8

Quote

As far as I know, those articles (links at the bottom to the others) are the best guide to the source that anyone has written up so far.  I'm not sure if they will tell you where to look exactly, but I had hoped that they may at least get you pointed in the right direction.

Awesome thanks, at least I know I'm in the right spot. From the code I've been reading so far it seems that the mining programs use JSON RPC with bitcoind then apply the appropriate hashes and merkle tree structure to it, check to see if it's a viable solution. if it is, they then JSON RPC submit the new block to submitblock. continue processing, the next block while waiting for confirmation.  Does it sound like I'm on the right track?
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 09, 2013, 09:07:58 PM
 #9

Quote
it seems that the mining programs use JSON RPC

*it seems that the mining programs use JSON RPC to get the last block, then they assemble a set of transaction to build a new block to hash against.  The Nonce is the incrementor to change the hash while searching for a compliant hash result? right? maybe Wink.
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 09, 2013, 10:37:49 PM
 #10

Anyone looking to understand this in the future, here is the link I was looking for and it should get you started.

https://bitcointalk.org/index.php?topic=108854.0

twobits
Sr. Member
****
Offline Offline

Activity: 574
Merit: 250



View Profile
May 09, 2013, 11:49:48 PM
 #11

I think at this point the mining code has been ripped out of the current versions.  It may be easier conceptional to go back to a version that was all in one to see the mining all in one source base.

█████                █████      ███████             
█████                ███    █████████████       
█████                ██  █████████████████   
█████                █  ██████              ██████ 
█████                    ████                      ████ 
█████████████  █████                        ████
█████████████  █████                        ████
█████████████  █████                        ████
█████                    █████                             
█████                █  ██████              ███████
█████                ██  ███████████    █████ 
█████                ███    █████████    ████   
█████                █████      ███████    ██
███
███
███
███
███
███
███
███
███
HyperQuant.net
Platform for Professional Asset Management
███
███
███
███
███
███
███
███
███
WhitePaper
One-Pager
███
███
███
███
███
███
███
███
███
Telegram 
Facebook
Twitter
Medium
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
█████                █████      ███████             
█████                ███    █████████████       
█████                ██  █████████████████   
█████                █  ██████              ██████ 
█████                    ████                      ████ 
█████████████  █████                        ████
█████████████  █████                        ████
█████████████  █████                        ████
█████                    █████                             
█████                █  ██████              ███████
█████                ██  ███████████    █████ 
█████                ███    █████████    ████   
█████                █████      ███████    ██
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!