Bitcoin Institute

minimalistic bitcoin client on D language?

5 messages BitcoinTalk farmer_boy, Hal Finney, grondilu, Satoshi Nakamoto December 10, 2010 — December 11, 2010
farmer_boy December 10, 2010 22:43 UTC Link to this message

Another client is useful, especially since the current Bitcoin client is a big mess. I was shocked that cryptography code looked like this.

Hal Finney (Hal) December 11, 2010 20:08 UTC Link to this message
Quote from: farmer_boy on December 10, 2010, 10:43:43 PM UTC

Another client is useful, especially since the current Bitcoin client is a big mess. I was shocked that cryptography code looked like this.

I’d like to hear some specific criticisms of the code. To me it looks like an impressive job, although I’d wish for more comments. Now I’ve mostly studied the init, main, script and a bit of net modules. This is some powerful machinery.

grondilu December 11, 2010 21:25 UTC Link to this message
Quote from: Hal on December 11, 2010, 8:08:45 PM UTC

I’d like to hear some specific criticisms of the code. To me it looks like an impressive job, although I’d wish for more comments. Now I’ve mostly studied the init, main, script and a bit of net modules. This is some powerful machinery.

I agree.  Actually I’m amazed this is the product of only one person’s work.

Quote from: Hal on December 11, 2010, 8:08:45 PM UTC

I’d like to hear some specific criticisms of the code. To me it looks like an impressive job, although I’d wish for more comments. Now I’ve mostly studied the init, main, script and a bit of net modules. This is some powerful machinery.

That means a lot coming from you, Hal.  Thanks.

farmer_boy December 11, 2010 22:20 UTC Link to this message

Another client is useful, especially since the current Bitcoin client is a big mess. I was shocked that cryptography code looked like this.

Can you be more specific? What exactly makes it a ‘mess’?

There is no object oriented design. Basically there is one big global state and that’s it.

Very specifically line 24 in my SVN chechout contains the following number, but there is no explanation as to why this number is there; I can guess why it is there, but it shouldn’t be my task to figure out why something is there. A comment above this constant should say why exactly it is that value and not some other value, why it is important for the system, etc.

Additionally a comment should state which hashing function is being used. E.g. it should say “The magic constant below is equal to the sha256sum (See, <reference to original definition of this algorithm>) of value <myvalue>. This is done, because <insert reasons>. ”

Code:

uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");

There is also no need to create a 3200 lines long source file. There is just no reason to do that other than to discourage people from making the effort to understand it.

I am sure it is possible to reverse-engineer it in a few months to get it into a state in which one can just read through the whole program in an hour or so, but that’s not the same as it already being in such a state.

Anyway, I hope you see the difference in approach.