-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ECO-chain/develop
Themis Hardfork
- Loading branch information
Showing
13 changed files
with
590 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Themis Hardfork | ||
|
||
## Purpose | ||
The purpose of this hardfork is to sanitize the reward system. | ||
*** | ||
## Description | ||
|
||
The hardfork will take effect from block 870,000 | ||
|
||
Changes: | ||
- Coinstake will be reduced to 5 ECOC | ||
- New max cap is 300 million ECOC | ||
- Each epoch changes every 1 million blocks (approximately one year) | ||
- Each epoch the coinstake will be reduced by 1 ECOC until it reaches 1 ECOC. So each epochs coinstake will be 5-4-3-2-1 ECOC | ||
- After that point the coinstake will be stable at 1 ECOC until it reaches the cap (300 million ECOC) | ||
- Last rewarl block is **47,870,000**. After that point the only reward for stakers will be the transaction fees. | ||
- Multisigners are reduced to 5. The basic reason about this is to reduce the future chaindata size. | ||
*** | ||
## Upgrade instructions | ||
|
||
Nothing special is needed. The steps are taking backup of the wallet, download the binaries and execute the. In case of compiling from source code the process is the same as the previous versions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,108 @@ | ||
// Copyright (c) 2018 The Eco Chain team | ||
// Distributed under the GPLv3 software license, check | ||
// https://www.gnu.org/licenses/gpl-3.0.en.html for details | ||
// https://www.gnu.org/licenses/gpl-3.0.en.html for details | ||
|
||
/* | ||
#include "ecoc.h" | ||
#include "chainparams.h" | ||
|
||
namespace ecoc { | ||
namespace ecoc | ||
{ | ||
int getMultisigners(int height) { | ||
const Consensus::Params& params = Params().GetConsensus(); | ||
const int ThemisHeight = params.ThemisHeight; | ||
|
||
if (height < ThemisHeight + 1) { | ||
return params.nOriginalMPoSRewardRecipients; | ||
} | ||
|
||
return params.nThemisMPoSRewardRecipients; | ||
} | ||
|
||
int getPoSReward(int height, const Consensus::Params& params) | ||
{ | ||
const int ThemisHeight = params.ThemisHeight; | ||
const int lastRewardBlock = lastPoWBlock + params.lastPOSBlock; | ||
const int lastEpoch = ThemisHeight + (4 * rewardSession); | ||
const int ThemisBlockReward = 5; | ||
|
||
/* redundant check */ | ||
if (height > lastRewardBlock) { | ||
return 0; | ||
} | ||
|
||
if (height < ThemisHeight + 1) { | ||
return 50; | ||
} | ||
|
||
if (height > lastEpoch) { | ||
return 1; | ||
} | ||
|
||
int rewardReduction = int((height - (ThemisHeight + 1)) / rewardSession); | ||
return ThemisBlockReward - rewardReduction; | ||
} | ||
|
||
uint64_t getActualSupply(int height) | ||
{ | ||
const Consensus::Params& params = Params().GetConsensus(); | ||
const int ThemisHeight = params.ThemisHeight; | ||
int epochPeriod = rewardSession; | ||
uint64_t actualSupply; | ||
|
||
if (height <= lastPoWBlock) { | ||
actualSupply = height * PoWReward; | ||
} | ||
else if (height <= ThemisHeight) { | ||
actualSupply = lastPoWBlock * PoWReward + (height - lastPoWBlock) * 50; | ||
} | ||
else if (height > ThemisHeight && height <= lastPoWBlock + params.lastPOSBlock) { | ||
actualSupply = lastPoWBlock * PoWReward + (ThemisHeight - lastPoWBlock) * 50; /* actualy supply at themis height*/ | ||
for (int epoch = 1; epoch <= 5; epoch++) { | ||
if (epoch == 5) { | ||
epochPeriod = lastPoWBlock + params.lastPOSBlock - ThemisHeight - 4 * epochPeriod; | ||
} | ||
actualSupply += std::max(0, (6 - epoch) * std::min(epochPeriod, height - ThemisHeight - (epoch - 1) * rewardSession)); | ||
} | ||
} | ||
else { | ||
actualSupply = 300 * 1000 * 1000; | ||
} | ||
|
||
return actualSupply; | ||
} | ||
|
||
void ecocLog(const std::string message) | ||
{ | ||
if (debug) { | ||
LogPrintf("ecoc: %s\n", message); | ||
} | ||
} | ||
|
||
void ecocLogNL(const std::string message) | ||
{ | ||
if (debug) { | ||
LogPrintf("ecoc: %s", message); | ||
} | ||
} | ||
|
||
void ecocLogNL(int i) | ||
{ | ||
if (debug) { | ||
LogPrintf("ecoc: %d", i); | ||
} | ||
} | ||
|
||
void ecocLog(int i) | ||
{ | ||
if (debug) { | ||
LogPrintf("ecoc: %d\n", i); | ||
} | ||
} | ||
|
||
void ecocLogFun(const std::string message) | ||
{ | ||
if (debug) { | ||
LogPrintf("ecoc: Entering function %s\n", message); | ||
} | ||
} | ||
*/ | ||
} // namespace ecoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,46 @@ | ||
// Copyright (c) 2018 The Eco Chain team | ||
// Distributed under the GPLv3 software license, check | ||
// https://www.gnu.org/licenses/gpl-3.0.en.html for details | ||
// https://www.gnu.org/licenses/gpl-3.0.en.html for details | ||
|
||
#ifndef ECOC_H | ||
#define ECOC_H | ||
|
||
#include "util.h" | ||
//#include "libethcore/SealEngine.cpp" | ||
#include "chainparams.h" | ||
|
||
namespace ecoc { | ||
const bool debug = false; | ||
const int LastPoWBlock = 10000 ; // turning block from PoW to PoS | ||
const int BlockTime= 32 ; // block time creation target | ||
const int granularity = 7; | ||
const int consensusMultisigners = 10; | ||
const int coinbaseMaturity = (600*100)/(BlockTime); //600*100/BlockTime = 1875 ; (formula proportional to bitcoin who has 600 secs and 100 blocks maturity) | ||
const std::string ecoUnit = "ECOC"; | ||
const int MinerSleepInSecs = 60; // delay the block creation for a minute | ||
const int StakerPollingPeriod = 5000; //STAKER_POLLING_PERIOD in miliseconds | ||
const int PoWReward = 20000 ; // reward of coins for each block at first phase (PoW) | ||
const int PoSReward = 50 ; // PoS reward, doubling every epoch. After LastPoSBlock blocks reward is zero. | ||
const int maxHalvings = 4 ;// 4 POS epochs(sessions) , doubling until cap. Variable name (maxHalvings) stays unmodified for historical reasons (tribute to bitcoin) | ||
const int rewardSession= 2500000 ; // how many blocks for doubling the PoS reward , about two and a half years | ||
const int LastPoSBlock = 9812500 ; // LastPoWBlock + LastPoSBlock is the block height that gives the last reward (2 billion coins cap reached) | ||
const int blockSizeLimit = 4*1000*1000 ; // blocksize limit 4M | ||
const int blockGasLimit= 20 * blockSizeLimit; // maximum gas per block , set it proportionally to blockSizeLimit | ||
const int minTxGas = 40; | ||
|
||
const std::string genesisBlockMainNet = "0000009cbd44612c6e231a74c6d5ae65dcc4a55fa728cc5aa55f0558bdcc7268"; | ||
const std::string genesisBlockTestNet = "0000005d73ef7042858df0f7fca1459d519ae0a209d68c9bf5701e61dd97fb42"; | ||
const std::string genesisBlockRegTest = "52b4ddc1be5a40a1c5cf3ad2280baa8e7a25b5e3fe02b9d229c476bd0830c8d6"; | ||
const std::string genesisMerkleRoot = "441bfed54efa3a027363d44aa74751180147bbad7e4a55f30213735b83a7d078"; | ||
|
||
inline void ecocLog(const std::string message) { | ||
if (debug) { | ||
LogPrintf("ecoc: %s\n", message); | ||
} | ||
} | ||
|
||
inline void ecocLogNL(const std::string message) { | ||
if (debug) { | ||
LogPrintf("ecoc: %s", message); | ||
} | ||
} | ||
|
||
inline void ecocLogNL(int i) { | ||
if (debug) { | ||
LogPrintf("ecoc: %d", i); | ||
} | ||
} | ||
|
||
inline void ecocLog(int i) { | ||
if (debug) { | ||
LogPrintf("ecoc: %d\n", i); | ||
} | ||
} | ||
|
||
inline void ecocLogFun(const std::string message) { | ||
if (debug) { | ||
LogPrintf("ecoc: Entering function %s\n", message); | ||
} | ||
} | ||
} | ||
|
||
#endif // ECOC_H | ||
const bool debug = true; | ||
|
||
const int lastPoWBlock = 10000; // turning block from PoW to PoS | ||
const int blockTime = 32; // block time creation target | ||
const int granularity = 7; | ||
// const int consensusMultisigners = 10; | ||
const int coinbaseMaturity = (600 * 100) / (blockTime); //600*100/blockTime = 1875 ; (formula proportional to bitcoin who has 600 secs and 100 blocks maturity) | ||
const std::string ecoUnit = "ECOC"; | ||
const int minerSleepInSecs = 60; // delay the block creation for a minute | ||
const int stakerPollingPeriod = 5000; // STAKER_POLLING_PERIOD in miliseconds | ||
const int PoWReward = 20000; // reward of coins for each block at first phase (PoW) | ||
// const int PoSReward = 50; // PoS reward, replaced with GetPosReward(height) at Themis hardfork | ||
// const int maxHalvings = 4; // Number of doubling epochs, removes at Themis hardfork | ||
const int rewardSession = 1 * 1000 * 1000; // how many blocks for reward reduction , about a year | ||
const int blockSizeLimit = 4 * 1000 * 1000; // blocksize limit 4M | ||
const int blockGasLimit = 20 * blockSizeLimit; // maximum gas per block , set it proportionally to blockSizeLimit | ||
const int minTxGas = 40; | ||
|
||
const std::string genesisBlockMainNet = "0000009cbd44612c6e231a74c6d5ae65dcc4a55fa728cc5aa55f0558bdcc7268"; | ||
const std::string genesisBlockTestNet = "0000005d73ef7042858df0f7fca1459d519ae0a209d68c9bf5701e61dd97fb42"; | ||
const std::string genesisBlockRegTest = "52b4ddc1be5a40a1c5cf3ad2280baa8e7a25b5e3fe02b9d229c476bd0830c8d6"; | ||
const std::string genesisMerkleRoot = "441bfed54efa3a027363d44aa74751180147bbad7e4a55f30213735b83a7d078"; | ||
|
||
void ecocLog(const std::string message); | ||
void ecocLogNL(const std::string message); | ||
void ecocLogNL(int i); | ||
void ecocLog(int i); | ||
void ecocLogFun(const std::string message); | ||
|
||
int getPoSReward(int height, const Consensus::Params& params); | ||
int getMultisigners(int height); | ||
uint64_t getActualSupply(int height); | ||
} // namespace ecoc | ||
|
||
#endif // ECOC_H |
Oops, something went wrong.