wsxdrfv (OP)
Jr. Member
Offline
Activity: 413
Merit: 5
|
|
February 11, 2018, 11:44:31 AM |
|
So bitcoin uses sha256, litecoin scrypt, dash x11.
Where is revision location(source code filename, approx line position) of this algorithm?
Is it widespread and hard to revise? or easy to change?
How change to x11 algorithm? Some site says x11 is best algorithm.
|
|
|
|
bob123
Legendary
Offline
Activity: 1624
Merit: 2481
|
|
February 11, 2018, 01:35:06 PM |
|
So bitcoin uses sha256, litecoin scrypt, dash x11. Where is revision location(source code filename, approx line position) of this algorithm?
Simply google. Those algorithms (SHA, scrypt) weren't invented for those cryptocurrencies. They existed before. SHA: https://en.wikipedia.org/wiki/SHA-2scrypt: https://en.wikipedia.org/wiki/ScryptX11 is concatenated algorithm composed of BLAKE, BMW, Grøstl, JH, Keccak, Skein, Luffa, CubeHash, SHAvite, SIMD and Echo. How change to x11 algorithm? Some site says x11 is best algorithm.
Changing the algorithm would require a hard fork ( https://en.wikipedia.org/wiki/Fork_(blockchain)#Hard_fork). There is no "best" algorithm. Simply because there is no definition of a "best" algorithm. Additionally you should not believe what you read on "some site".
|
|
|
|
t1192002
Newbie
Offline
Activity: 27
Merit: 0
|
|
February 11, 2018, 02:34:06 PM |
|
So bitcoin uses sha256, litecoin scrypt, dash x11. Where is revision location(source code filename, approx line position) of this algorithm?
Simply google. Those algorithms (SHA, scrypt) weren't invented for those cryptocurrencies. They existed before. SHA: https://en.wikipedia.org/wiki/SHA-2scrypt: https://en.wikipedia.org/wiki/ScryptX11 is concatenated algorithm composed of BLAKE, BMW, Grøstl, JH, Keccak, Skein, Luffa, CubeHash, SHAvite, SIMD and Echo. How change to x11 algorithm? Some site says x11 is best algorithm.
Changing the algorithm would require a hard fork ( https://en.wikipedia.org/wiki/Fork_(blockchain)#Hard_fork). There is no "best" algorithm. Simply because there is no definition of a "best" algorithm. Additionally you should not believe what you read on "some site". Thanks for your informative explanation. Just wonder that the work of finding a new block(mining) is it kind of decrypting these algorithm?
|
|
|
|
bob123
Legendary
Offline
Activity: 1624
Merit: 2481
|
Just wonder that the work of finding a new block(mining) is it kind of decrypting these algorithm?
The work which has to be done to find a new block is not directly dependend on the algorithm. Additionally you can't decrypt anything in this scenario. Encryption != Hashing [1] Hashing is a one-way-function. This means: You can (relatively) easy calculate a hash of any value. But you can't get the original value out of the hash. When you are trying to find a new block (mining) you are basically calculating hashes until you find one hash that (for example) begins with 10 zeros. The difficulty adjusts to assure a new block every 10 minutes. You can look at the difficulty as "X zeros have to be at the beginning of the hash". On average there has to be Y hashes calculated until a valid one is found. Thats basically a "probability-game". [1] A more detailed explanation: https://en.wikipedia.org/wiki/Hash_function
|
|
|
|
|
wsxdrfv (OP)
Jr. Member
Offline
Activity: 413
Merit: 5
|
|
February 12, 2018, 03:44:04 AM |
|
So bitcoin uses sha256, litecoin scrypt, dash x11. Where is revision location(source code filename, approx line position) of this algorithm?
Simply google. Those algorithms (SHA, scrypt) weren't invented for those cryptocurrencies. They existed before. SHA: https://en.wikipedia.org/wiki/SHA-2scrypt: https://en.wikipedia.org/wiki/ScryptX11 is concatenated algorithm composed of BLAKE, BMW, Grøstl, JH, Keccak, Skein, Luffa, CubeHash, SHAvite, SIMD and Echo. How change to x11 algorithm? Some site says x11 is best algorithm.
Changing the algorithm would require a hard fork ( https://en.wikipedia.org/wiki/Fork_(blockchain)#Hard_fork). There is no "best" algorithm. Simply because there is no definition of a "best" algorithm. Additionally you should not believe what you read on "some site". Thanks, but what I wondered is where should I revise at bitcoin source code to change its algorithm from sha256 to another?
|
|
|
|
RGBKey
|
|
February 12, 2018, 04:14:20 AM |
|
So bitcoin uses sha256, litecoin scrypt, dash x11. Where is revision location(source code filename, approx line position) of this algorithm?
Simply google. Those algorithms (SHA, scrypt) weren't invented for those cryptocurrencies. They existed before. SHA: https://en.wikipedia.org/wiki/SHA-2scrypt: https://en.wikipedia.org/wiki/ScryptX11 is concatenated algorithm composed of BLAKE, BMW, Grøstl, JH, Keccak, Skein, Luffa, CubeHash, SHAvite, SIMD and Echo. How change to x11 algorithm? Some site says x11 is best algorithm.
Changing the algorithm would require a hard fork ( https://en.wikipedia.org/wiki/Fork_(blockchain)#Hard_fork). There is no "best" algorithm. Simply because there is no definition of a "best" algorithm. Additionally you should not believe what you read on "some site". Thanks, but what I wondered is where should I revise at bitcoin source code to change its algorithm from sha256 to another? It looks like you better have a good idea of what you're doing before you attempt to make your own coin, as that's what it sounds like what you want to do.
|
|
|
|
t1192002
Newbie
Offline
Activity: 27
Merit: 0
|
|
February 12, 2018, 12:58:50 PM |
|
The work which has to be done to find a new block is not directly dependend on the algorithm. Additionally you can't decrypt anything in this scenario. Encryption != Hashing [1] Hashing is a one-way-function. This means: You can (relatively) easy calculate a hash of any value. But you can't get the original value out of the hash. When you are trying to find a new block (mining) you are basically calculating hashes until you find one hash that (for example) begins with 10 zeros. The difficulty adjusts to assure a new block every 10 minutes. You can look at the difficulty as "X zeros have to be at the beginning of the hash". On average there has to be Y hashes calculated until a valid one is found. Thats basically a "probability-game". [1] A more detailed explanation: https://en.wikipedia.org/wiki/Hash_functionThanks you so much man. You deserve a like/thumb up. Which I cant find in this forum lol.
|
|
|
|
hatshepsut93
Legendary
Offline
Activity: 3038
Merit: 2160
|
|
June 30, 2018, 01:32:20 PM |
|
So bitcoin uses sha256, litecoin scrypt, dash x11.
Where is revision location(source code filename, approx line position) of this algorithm?
Is it widespread and hard to revise? or easy to change?
How change to x11 algorithm? Some site says x11 is best algorithm.
I'm not a C++ developer, but I think the SHA256 implementation used by Bitcoin Core client is here: https://github.com/bitcoin/bitcoin/blob/master/src/crypto/sha256.cppI would strongly advice against modifying anything in this or any other hashing algorithm, they were carefully tuned to be as secure as possible, and changing just a few constants can drastically reduce their security. If you want to create a fork of Bitcoin with different algorithm, you'll have to do a lot of work. You will very likely fail if you are not an experienced programmer.
|
|
|
|
|
LighningCashDev
Member
Offline
Activity: 293
Merit: 13
AKA merlin.
|
|
February 11, 2019, 07:58:43 AM Last edit: February 11, 2019, 08:39:33 AM by LighningCashDev |
|
|
|
|
|
ItaCraft
Member
Offline
Activity: 138
Merit: 10
|
|
February 15, 2019, 09:01:59 PM |
|
According to the bitcoin source code, the hash for the block header can be seen from the file src/primitives/block.cpp under uint256 CBlockHeader::GetHash() const { return SerializeHash(*this); }
https://github.com/bitcoin/bitcoin/blob/master/src/primitives/block.cpp#L13Which return the value of SerializeHash(*this), That is declared on the file hash.h /** Compute the 256-bit hash of an object's serialization. */ template<typename T> uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION) { CHashWriter ss(nType, nVersion); ss << obj; return ss.GetHash(); }
And according to the comment above it, /** Compute the 256-bit hash of an object's serialization. */ The SerializeHash will call CHashWriter and return the value of GetHash which is a simple sha256d hashing algorithm result (Please, let me know if I'm wrong, I'm still studying bitcoin code)
|
|
|
|
|