Bitcoin Forum
July 03, 2024, 07:12:10 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Need Math for Halving Interval and Subsidy  (Read 144 times)
marvic4 (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
September 05, 2020, 07:41:07 AM
Last edit: September 05, 2020, 11:21:23 AM by marvic4
 #1

I Need a math here,

max_coin is 30M
30% premine,
30 Years reward goal,
Tragetspacing is 2 * 64 (128 sec)

So, I need to calculate Halving Interval (blocks)
consensus.nSubsidyHalvingInterval = ??


As per above data, how to modify this GetBlockSubsidy()


Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    if(nHeight <= consensusParams.nLastBigReward)
       ( return xxxxx * COIN;) --------Sample

    int halvings = (nHeight - consensusParams.nLastBigReward - 1) / consensusParams.nSubsidyHalvingInterval;
    // Force block reward to zero when right shift is undefined.
    if (halvings >= xxx) --------------Sample
        return 0;

    CAmount nSubsidy = xxx * COIN; -----------------Sample
    // Subsidy is cut in half every xxxxxx blocks which will occur approximately every 4 years.
    nSubsidy >>= halvings;
    return nSubsidy;
}


Thanks,
pooya87
Legendary
*
Offline Offline

Activity: 3500
Merit: 10697



View Profile
September 05, 2020, 10:09:16 AM
 #2

when you keep getting stuck on basic things such as creating genesis block, mining a new block, setting block rewards, total supply,... (according to your post history) then maybe it is a sign that you are on a wrong path and should start by first learning what each of these topics you struggle with are and why they are designed like that instead of just trying to change variables and see which one works to create a new altcoin that has been created thousands of times before in the same exact way.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
marvic4 (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
September 05, 2020, 11:20:53 AM
 #3

when you keep getting stuck on basic things such as creating genesis block, mining a new block, setting block rewards, total supply,... (according to your post history) then maybe it is a sign that you are on a wrong path and should start by first learning what each of these topics you struggle with are and why they are designed like that instead of just trying to change variables and see which one works to create a new altcoin that has been created thousands of times before in the same exact way.

Thanks, for reading my previous posts, I am aware of basic things how to fork a coin(Older versions, few coins launched). But not expert Like YOU.
 
Those forked coins have lots of problems (newer versions ). I used to have Genesis tool generators,  which work for some coins and won't work most of the coins. That is main thing (tool generator)

That is the reason why i ask a question here. If your not interested in answering it is fine.

Now I asked simple Math,  Some one will help. I do help many devs.

Thanks.
vjudeu
Hero Member
*****
Offline Offline

Activity: 754
Merit: 1777



View Profile
September 05, 2020, 12:55:58 PM
 #4

Exactly 7391250, but you can round it to 7400000.
4 years = 126144000 seconds
126144000/600 = 210240 blocks per halving
30 years = 946080000 seconds
946080000/128 = 7391250 blocks per halving

Quote
30% premine
Ouch. It will fail.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
marvic4 (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
September 05, 2020, 01:42:24 PM
 #5

Exactly 7391250, but you can round it to 7400000.
4 years = 126144000 seconds
126144000/600 = 210240 blocks per halving
30 years = 946080000 seconds
946080000/128 = 7391250 blocks per halving

Quote
30% premine
Ouch. It will fail.

Thanks,   
odolvlobo
Legendary
*
Offline Offline

Activity: 4368
Merit: 3279



View Profile
September 06, 2020, 01:46:12 AM
 #6


Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    ...
    // Force block reward to zero when right shift is undefined.
    if (halvings >= xxx) --------------Sample
        return 0;
    ...
}

That should be the following regardless of any of the parameters:

Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    ...
    // Force block reward to zero when right shift is undefined.
    if (halvings >= sizeof(nSubsidy) * CHAR_BIT)
        return 0;
    ...
}

In Bitcoin Core, they use the literal 64, which is ok until something changes and then it becomes a bug.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
marvic4 (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
September 06, 2020, 03:43:07 AM
 #7


Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    ...
    // Force block reward to zero when right shift is undefined.
    if (halvings >= xxx) --------------Sample
        return 0;
    ...
}

That should be the following regardless of any of the parameters:

Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    ...
    // Force block reward to zero when right shift is undefined.
    if (halvings >= sizeof(nSubsidy) * CHAR_BIT)
        return 0;
    ...
}

In Bitcoin Core, they use the literal 64, which is ok until something changes and then it becomes a bug.

Thanks for replay.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!