Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: centurionMiner on April 28, 2017, 11:11:08 AM



Title: Structure of cryptocoin-source
Post by: centurionMiner on April 28, 2017, 11:11:08 AM
I'm quite new to crypto, and i start studying/develop some tool to ease the trading/mining.

Can someone more expert than me tell us How a coin i structured?

I mean the "high-level" chart for designed/develop a coin and where that info are stored in the source.

Specifically:

1) Where is the difficulty retarget system?

3) Where are the "hot" info like : number of coin produced on time, algo, stake, ecc ecc


Title: Re: Structure of cryptocoin-source
Post by: achow101 on April 28, 2017, 01:13:31 PM
I'm quite new to crypto, and i start studying/develop some tool to ease the trading/mining.

Can someone more expert than me tell us How a coin i structured?

I mean the "high-level" chart for designed/develop a coin and where that info are stored in the source.
It depends on what version of the Bitcoin Core source that the coin you are working on forked from. The names of each file is fairly self explanatory and should be obvious as to what it does. The only not so obvious one is main.cpp. main.cpp contains all of the processing of network messages and validation of blocks and transactions. If they forked from Core 0.14.0+, main.cpp does not exist. Rather it has been split into validation.cpp and net_processing.cpp. You can probably guess what the stuff in those files do.

Specifically:

1) Where is the difficulty retarget system?
It is either located in main.cpp or pow.cpp, depending on the version of Bitcoin Core that the coin was forked from. The name of the function is CalculateNextWorkRequired.

3) Where are the "hot" info like : number of coin produced on time, algo, stake, ecc ecc
Those are the blockchain parameters, hence they would be located in the chainparams.cpp file.


Title: Re: Structure of cryptocoin-source
Post by: centurionMiner on April 28, 2017, 03:14:47 PM
Thank you master, all clear now 8) :D
 If someone going to reply and add info about where the information about a coin are stored in the source, I update the post with the coin description and file link