shadowproject / shadow

ShadowCore integration/staging tree
MIT License
95 stars 60 forks source link

Where can I find implementation of Proof of Stake? #81

Closed urza closed 7 years ago

urza commented 7 years ago

Hi, could you please point me to files, where Proof of Stake in Shadowcash is implemented? Where exactly in code is the calculation who gets reward?

Also is there some formal paper describing the algorithm?

I was only able to find some release notes/blogs/reddit comments from which I understand that when staking, you get reward 0.286 sdc, and frequency of rewards depends on the amount you stake. But how is the frequency calculated exactly?

Thanks

kewde commented 7 years ago

The issue system is used for tracking development, please refrain from using it for asking questions. You can ask these on the forum or in chatrooms.

Search for stake, pos, proof, etc in the source code and all relevent files will come up. You could look at BlackCoin's history for a clearer high level overview. They also have a paper on PoSv2.0, v3.0 only has minimal changes which you can also find on the internet.

urza commented 7 years ago

Thanks for your answer, however I actually did both of these before asking this question.

  1. The blackcoin paper on PoSv2 is very abstract, does not mention implementation details at all, just the mathematical principles.
  2. I searched your code base for "stake", "reward", etc, but it gave too many results fo find the real place where it is implemented.

Could you just please point me to place where the calculation/decision is made? There should be a single place in code, where it is decided that staking user gets a reward, right?

I believe that it is a valid issue for opensource project to ask about it's source-code.

kewde commented 7 years ago

I just did a search on "stake" and it took me about 20 seconds to find what you want, please put more effort into your research and make sure you have the right tools, a good editor such as Sublime goes a long way.

It is in chainparams.cpp, CChainParams::GetProofOfStakeReward.

This is a workplace for project development, not a classroom.

urza commented 7 years ago

Thank you for your 20 seconds effort. Much appreciated.

Best of luck in your welcoming community.