Author

Topic: Github code (Read 365 times)

newbie
Activity: 9
Merit: 0
December 29, 2017, 06:33:53 PM
#4
its a trade off.

Do you want faster code or more compact executable?

In this app i would not have cared about size, but about speed.

newbie
Activity: 2
Merit: 0
December 29, 2017, 04:27:30 PM
#3
Try looking at the Go implementation, it is well commented and "clean":

https://github.com/btcsuite/btcd
staff
Activity: 3458
Merit: 6793
Just writing some code
December 28, 2017, 01:12:22 AM
#2
Is it agreed that bitcoin code is inherently very inefficient.
No, it is not agreed. Firstly, there is no "bitcoin code". There are multiple implementation of the Bitcoin consensus rules. If you are referring to Bitcoin Core, it can sometimes be inefficient but there is nothing inherent about consensus implementations for Bitcoin being inherently inefficient.

To me it appears much code is duplicated unnecessarily.
Bitcoin Core certainly has code duplication, but it is much better than it was in the past and it has become much more efficient.

Ultimately, to me, bitcoin's code is still pre-beta, with minimal comments and few modules.
Bitcoin Core may still be like that, but that is only one implementation.

Can someone please advise which .cpp file states which hashing algorithm, the coin is using. ie what differs between sha265 hashed coin's code vs an equihash.
There is not one place that specifies a hash function that is used; rather every time the hash function is used, the function itself is directly called. It's not like there are some UsePoWHash or UseConsensusHash functions.

The files that you are looking for are probably src/chainparams.cpp, src/validation.cpp, and the files under src/consensus/. However many other source files include consensus related things.

Take bitcoin gold for example. How does their wallet know how to interpret both equihash and sha265, depending on which block is being interrogated.
Presumably there is a swtich. Simply an if statement; if after activation height, use equihash, else use sha256d.

Bitgoin gold has significantly more lines of code than bitcoin. Is this purely to allow the blockchain to cope with two completely different hashes?
Yes.

I can recall older coins changing algorithm over the years, though most did a 1 to 1 swap at an exchange. To me that is cheating. Obviously it cant be done eg Bitgoin gold, though is an algorithm change mid blockchain difficult to implement?
Not necessarily.
member
Activity: 115
Merit: 10
December 08, 2017, 07:26:02 PM
#1
Perhaps this is too simplistic for this board, though hopefully you can help me. I'm currently trying to interpret general crypto code, as a basic coder. Is it agreed that bitcoin code is inherently very inefficient. To me it appears much code is duplicated unnecessarily. Ultimately, to me, bitcoin's code is still pre-beta, with minimal comments and few modules.

Can someone please advise which .cpp file states which hashing algorithm, the coin is using. ie what differs between sha265 hashed coin's code vs an equihash.

Take bitcoin gold for example. How does their wallet know how to interpret both equihash and sha265, depending on which block is being interrogated.
Bitgoin gold has significantly more lines of code than bitcoin. Is this purely to allow the blockchain to cope with two completely different hashes?

I can recall older coins changing algorithm over the years, though most did a 1 to 1 swap at an exchange. To me that is cheating. Obviously it cant be done eg Bitgoin gold, though is an algorithm change mid blockchain difficult to implement?
Jump to: