Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: remotemass on September 13, 2013, 01:57:36 PM



Title: And the next code line is: ?
Post by: remotemass on September 13, 2013, 01:57:36 PM
I am starting this thread for us to keep active with an ongoing challenge, to comment one of the 12,222 lines of code in the original version of Satoshi's bitcoin client code (bitcoin-0.1.0), namely the line numbered with: ('next block hash in decimal' mod '12222').
Please commit to comment about it only during the time within blocks creation so that when a new block is created we move on to discuss about the next line we are faced with. This will prevent the discussion in this thread to become too much of a mess and keep us focused on the here and now of the code line we are faced with.
If some of us could please help others keeping this thread updated in terms of telling simply what is the next code line we got so that others can focus entirely on commenting about it, it could make our lives easier.
Please contextualize your code comments of the new line of code being analysed and discussed as much as possible so that this thread can become an interestingly active and valuable resource.
I fear this thread may not gain traction, but let's see. I will try to do my part contributing a bit to it now and then.
I think we shoud start with the 12,222 lines of code of the original client (http://pastebin.com/MfABqyJd) and maybe later consider other versions, with other threads, perhaps.
Again, let's try to focus on the code line drawing we are on right at this moment, and try to let go of what was missed in the previous ones.
This little rule is just a guideline and you may override it if you think it makes sense, of course.
Will you help?


Title: Re: And the next code line is: ?
Post by: remotemass on September 13, 2013, 02:24:34 PM
http://www.stringfunction.com/hex-decimal.html
http://www.calculatorpro.com/calculator/modulo-calculator/

Block #257748 hash in decimal: 227538544328062966004888208644466284604660868282826408848828

227538544328062966004888208644466284604660868282826408848828 mod 12222 = 196

Line 196 is:         BN_clear_free(this);


Can you comment a bit on this line of code, please?


Title: Re: And the next code line is: ?
Post by: joshlang on September 13, 2013, 02:51:45 PM
http://www.stringfunction.com/hex-decimal.html
http://www.calculatorpro.com/calculator/modulo-calculator/

Block #257748 hash in decimal: 227538544328062966004888208644466284604660868282826408848828

227538544328062966004888208644466284604660868282826408848828 mod 12222 = 196

Line 196 is:         BN_clear_free(this);


Can you comment a bit on this line of code, please?

BN_clear_free(this);   // sets the memory for the bignumber to all zeroes and frees the memory, thereby saving many trees and dolphins in the process.


Title: Re: And the next code line is: ?
Post by: chriswilmer on September 13, 2013, 03:18:40 PM
this is a great idea! watching this thread


Title: Re: And the next code line is: ?
Post by: remotemass on September 13, 2013, 03:31:41 PM
Block #257757 hash in decimal:

115419387065509120046808062824008482828448080082064264248062

115419387065509120046808062824008482828448080082064264248062 mod 12222 = 7730

Line 7730 is:     {

Can you contextualize it a bit, please?


Title: Re: And the next code line is: ?
Post by: remotemass on September 13, 2013, 03:47:08 PM
Block #257761 => Line 7916

template<typename K, typename T>


Title: Re: And the next code line is: ?
Post by: remotemass on September 13, 2013, 05:05:40 PM
Block #257771 => Line 9436

nPrice = nPriceIn;


Title: Re: And the next code line is: ?
Post by: grue on September 13, 2013, 05:26:54 PM
this is a pointless thread, reminiscent of the "count to 2100000 with pictures" thread. no sane software developer will comment every single line. tell me, what is the purpose of posts like these?
BN_clear_free(this);   // sets the memory for the bignumber to all zeroes and frees the memory, thereby saving many trees and dolphins in the process.
Block #257771 => Line 9436

nPrice = nPriceIn;
Block #257761 => Line 7916

template<typename K, typename T>
anyone anyone who took a high school course in programming will know what they mean.

if you want to comment every line, fine. do it on the source file themselves and upload it to a github repo or your own site. don't spam the forums in a vain attempt to boost your post count.


Title: Re: And the next code line is: ?
Post by: remotemass on September 13, 2013, 05:46:17 PM
I suppose you say the same thing about Sanskrit sutras.  >:(
Your attitude is arrogant and offensive, although I don't want to take it personally.
I really don't think you are the master of the universe and know what is the best for everybody in the community. Besides, there are not just developers in this community, in case you don't know.


Title: Re: And the next code line is: ?
Post by: grue on September 13, 2013, 06:55:32 PM
I suppose you say the same thing about Sanskrit sutras.  >:(
this is a forum, not a religious scripture

Your attitude is arrogant and offensive, although I don't want to take it personally.
please get a better argument rather than appealing to tone (https://en.wikipedia.org/wiki/File:Graham%27s_Hierarchy_of_Disagreement.svg)

I really don't think you are the master of the universe and know what is the best for everybody in the community. Besides, there are not just developers in this community, in case you don't know.
I never claimed I was "the master of the universe and know what is the best for everybody in the community". Instead of strawmaning, how about you actually refute some of my arguments?


Title: Re: And the next code line is: ?
Post by: remotemass on September 13, 2013, 07:28:43 PM
I never claimed I was "the master of the universe and know what is the best for everybody in the community". Instead of strawmaning, how about you actually refute some of my arguments?

In the same way that whole books can be written about a single sutra in a religious scripture, many things can certainly be said about a single line of code. I find it unbelivable that you really think that "everybody will know what this means" is really the best thing that can be said to shed some light on such a dense and difficult to understand code program.

What I mean is that your attitude of "I am a staff Member and can kick you out of this forum if I want" is really not what is expected from a leading position of a community with such a free and open spirit.
I really don't like this kind of suppressive attittude and expected more from a staff member of this forum. Would it bother you that much that this became a popular thread? Why? Are you against the joy, fun and engaging of others? I wonder.

Don't you see this would indeed be interesting for people that want to have a better appreciation of the bitcoin client code and are finding it really difficult to harvest light out of the darkness?

It's really narrow-minded to think nothing of relevant can be said. Of course, you may say: "there's nothing to be said about this". "Everyone that can read code will get it".
Sure... NOT!


Title: Re: And the next code line is: ?
Post by: deepceleron on September 14, 2013, 12:13:09 AM
Original Bitcoin code is decently commented compared with many commits these days. What is missing is a script and protocol overview and design document.


Title: Re: And the next code line is: ?
Post by: remotemass on September 18, 2013, 06:32:13 PM
O GRITO DO TANGO