mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
merged
This commit is contained in:
commit
6e0917bb47
12
README.md
12
README.md
@ -11,14 +11,12 @@ What is DarkCoin?
|
||||
|
||||
DarkCoin is a lite version of Bitcoin using X11 as a proof-of-work algorithm.
|
||||
- Super secure hashing algorithm: 11 rounds of scientific hashing functions (blake, bmw, groestl, jh, keccak, skein, luffa, cubehash, shavite, simd, echo)
|
||||
- Block reward is controlled by moore's law: (11111 / (((Difficulty+51)/6) ^ 2))
|
||||
- CPU only mining
|
||||
- Block reward is controlled by moore's law: 2222222/(((Difficulty+2600)/9)^2)
|
||||
- GPU/CPU only mining
|
||||
- Block generation: 2.5 minutes
|
||||
- Difficulty Retargets every 576 blocks
|
||||
- 84 Million Coins Max
|
||||
- Block reward halving every 2 years
|
||||
- Encrypted transaction network: Work In Progress
|
||||
- Anonymous blockchain using coinjoin technology: Work In Progress
|
||||
- Difficulty Retargets every block using Dark Gravity Wave
|
||||
- Est. ~7M Coins in 2015, ~13M in 2020, ~23M in 2030
|
||||
- Anonymous blockchain using DarkSend technology (Based on CoinJoin): Beta Testing
|
||||
|
||||
For more information, as well as an immediately useable, binary version of
|
||||
the DarkCoin client sofware, see http://www.darkcoin.io.
|
||||
|
@ -1,7 +1,7 @@
|
||||
TEMPLATE = app
|
||||
TARGET = darkcoin-qt
|
||||
macx:TARGET = "DarkCoin-Qt"
|
||||
VERSION = 0.8.9.4
|
||||
VERSION = 0.9.0.0
|
||||
INCLUDEPATH += src src/json src/qt
|
||||
QT += core gui network
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
@ -5,8 +5,8 @@ SetCompressor /SOLID lzma
|
||||
|
||||
# General Symbol Definitions
|
||||
!define REGKEY "SOFTWARE\$(^Name)"
|
||||
!define VERSION 0.8.9.4
|
||||
!define COMPANY "DarkCoin project"
|
||||
!define VERSION 0.9.0.0
|
||||
!define URL http://www.darkcoin.io/
|
||||
|
||||
# MUI Symbol Definitions
|
||||
@ -45,13 +45,13 @@ Var StartMenuGroup
|
||||
!insertmacro MUI_LANGUAGE English
|
||||
|
||||
# Installer attributes
|
||||
OutFile darkcoin-0.8.0.0-win32-setup.exe
|
||||
OutFile darkcoin-0.9.0.0-win32-setup.exe
|
||||
InstallDir $PROGRAMFILES\DarkCoin
|
||||
CRCCheck on
|
||||
XPStyle on
|
||||
BrandingText " "
|
||||
ShowInstDetails show
|
||||
VIProductVersion 0.8.9.4
|
||||
VIProductVersion 0.9.0.0
|
||||
VIAddVersionKey ProductName DarkCoin
|
||||
VIAddVersionKey ProductVersion "${VERSION}"
|
||||
VIAddVersionKey CompanyName "${COMPANY}"
|
||||
|
@ -51,11 +51,11 @@ namespace Checkpoints
|
||||
|
||||
static MapCheckpoints mapCheckpointsTestnet =
|
||||
boost::assign::map_list_of
|
||||
( 7, uint256("00000d240854b79313d5430d48717a9591410c5f8fc83dfde9d2d74fe4283385"))
|
||||
( 44, uint256("0000058784a8cdd3b4dc5ce684d24a1d5fecc3d47f9cd71218d04a1a322318a1"))
|
||||
;
|
||||
static const CCheckpointData dataTestnet = {
|
||||
&mapCheckpointsTestnet,
|
||||
1393596594,
|
||||
1393373461,
|
||||
3000,
|
||||
30
|
||||
};
|
||||
@ -69,7 +69,7 @@ namespace Checkpoints
|
||||
|
||||
bool CheckBlock(int nHeight, const uint256& hash)
|
||||
{
|
||||
//if (fTestNet) return true; // Testnet has no checkpoints
|
||||
if (fTestNet) return true; // Testnet has no checkpoints
|
||||
if (!GetBoolArg("-checkpoints", true))
|
||||
return true;
|
||||
|
||||
@ -113,7 +113,7 @@ namespace Checkpoints
|
||||
|
||||
int GetTotalBlocksEstimate()
|
||||
{
|
||||
//if (fTestNet) return 0; // Testnet has no checkpoints
|
||||
if (fTestNet) return 0; // Testnet has no checkpoints
|
||||
if (!GetBoolArg("-checkpoints", true))
|
||||
return 0;
|
||||
|
||||
@ -124,7 +124,7 @@ namespace Checkpoints
|
||||
|
||||
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
|
||||
{
|
||||
//if (fTestNet) return NULL; // Testnet has no checkpoints
|
||||
if (fTestNet) return NULL; // Testnet has no checkpoints
|
||||
if (!GetBoolArg("-checkpoints", true))
|
||||
return NULL;
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
||||
#define CLIENT_VERSION_MAJOR 0
|
||||
#define CLIENT_VERSION_MINOR 8
|
||||
#define CLIENT_VERSION_REVISION 9
|
||||
#define CLIENT_VERSION_BUILD 7
|
||||
#define CLIENT_VERSION_MINOR 10
|
||||
#define CLIENT_VERSION_REVISION 0
|
||||
#define CLIENT_VERSION_BUILD 0
|
||||
|
||||
// Set to true for release, false for prerelease or test build
|
||||
#define CLIENT_VERSION_IS_RELEASE true
|
||||
|
126
src/main.cpp
126
src/main.cpp
@ -1040,6 +1040,26 @@ int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
|
||||
}
|
||||
|
||||
|
||||
double ConvertBitsToDouble(unsigned int nBits){
|
||||
int nShift = (nBits >> 24) & 0xff;
|
||||
|
||||
double dDiff =
|
||||
(double)0x0000ffff / (double)(nBits & 0x00ffffff);
|
||||
|
||||
while (nShift < 29)
|
||||
{
|
||||
dDiff *= 256.0;
|
||||
nShift++;
|
||||
}
|
||||
while (nShift > 29)
|
||||
{
|
||||
dDiff /= 256.0;
|
||||
nShift--;
|
||||
}
|
||||
|
||||
return dDiff;
|
||||
}
|
||||
|
||||
int CMerkleTx::GetBlocksToMaturity() const
|
||||
{
|
||||
if (!IsCoinBase())
|
||||
@ -1194,24 +1214,11 @@ uint256 static GetOrphanRoot(const CBlockHeader* pblock)
|
||||
|
||||
int64 static GetBlockValue(int nBits, int nHeight, int64 nFees)
|
||||
{
|
||||
int nShift = (nBits >> 24) & 0xff;
|
||||
|
||||
double dDiff =
|
||||
(double)0x0000ffff / (double)(nBits & 0x00ffffff);
|
||||
|
||||
/* fixed bug caused diff to not be correctly calculated */
|
||||
if(nHeight > 4500) {
|
||||
while (nShift < 29)
|
||||
{
|
||||
dDiff *= 256.0;
|
||||
nShift++;
|
||||
}
|
||||
while (nShift > 29)
|
||||
{
|
||||
dDiff /= 256.0;
|
||||
nShift--;
|
||||
}
|
||||
}
|
||||
if(nHeight > 4500) dDiff = ConvertBitsToDouble(nBits);
|
||||
|
||||
int64 nSubsidy = 0;
|
||||
if(nHeight >= 5465) {
|
||||
@ -1336,7 +1343,6 @@ unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const
|
||||
}
|
||||
|
||||
unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64 TargetBlocksSpacingSeconds, uint64 PastBlocksMin, uint64 PastBlocksMax) {
|
||||
/* current difficulty formula, megacoin - kimoto gravity well */
|
||||
const CBlockIndex *BlockLastSolved = pindexLast;
|
||||
const CBlockIndex *BlockReading = pindexLast;
|
||||
const CBlockHeader *BlockCreating = pblock;
|
||||
@ -1384,11 +1390,88 @@ unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBloc
|
||||
bnNew *= PastRateActualSeconds;
|
||||
bnNew /= PastRateTargetSeconds;
|
||||
}
|
||||
if (bnNew > bnProofOfWorkLimit) { bnNew = bnProofOfWorkLimit; }
|
||||
|
||||
if (bnNew > bnProofOfWorkLimit) {
|
||||
bnNew = bnProofOfWorkLimit;
|
||||
}
|
||||
|
||||
return bnNew.GetCompact();
|
||||
}
|
||||
|
||||
unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockHeader *pblock) {
|
||||
/* current difficulty formula, darkcoin - DarkGravity, written by Evan Duffield - evan@darkcoin.io */
|
||||
const CBlockIndex *BlockLastSolved = pindexLast;
|
||||
const CBlockIndex *BlockReading = pindexLast;
|
||||
const CBlockHeader *BlockCreating = pblock;
|
||||
BlockCreating = BlockCreating;
|
||||
int64 nBlockTimeAverage = 0;
|
||||
int64 nBlockTimeAveragePrev = 0;
|
||||
int64 nBlockTimeCount = 0;
|
||||
int64 nBlockTimeSum2 = 0;
|
||||
int64 nBlockTimeCount2 = 0;
|
||||
int64 LastBlockTime = 0;
|
||||
int64 PastBlocksMin = 14;
|
||||
int64 PastBlocksMax = 140;
|
||||
int64 CountBlocks = 0;
|
||||
CBigNum PastDifficultyAverage;
|
||||
CBigNum PastDifficultyAveragePrev;
|
||||
|
||||
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); }
|
||||
|
||||
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
|
||||
if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
|
||||
CountBlocks++;
|
||||
|
||||
if(CountBlocks <= PastBlocksMin) {
|
||||
if (CountBlocks == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); }
|
||||
else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / CountBlocks) + PastDifficultyAveragePrev; }
|
||||
PastDifficultyAveragePrev = PastDifficultyAverage;
|
||||
}
|
||||
|
||||
if(LastBlockTime > 0){
|
||||
int64 Diff = (LastBlockTime - BlockReading->GetBlockTime());
|
||||
if(Diff < 0) Diff = 0;
|
||||
if(nBlockTimeCount <= PastBlocksMin) {
|
||||
nBlockTimeCount++;
|
||||
|
||||
if (nBlockTimeCount == 1) { nBlockTimeAverage = Diff; }
|
||||
else { nBlockTimeAverage = ((Diff - nBlockTimeAveragePrev) / nBlockTimeCount) + nBlockTimeAveragePrev; }
|
||||
nBlockTimeAveragePrev = nBlockTimeAverage;
|
||||
}
|
||||
nBlockTimeCount2++;
|
||||
nBlockTimeSum2 += Diff;
|
||||
}
|
||||
LastBlockTime = BlockReading->GetBlockTime();
|
||||
|
||||
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
|
||||
BlockReading = BlockReading->pprev;
|
||||
}
|
||||
|
||||
CBigNum bnNew(PastDifficultyAverage);
|
||||
if (nBlockTimeCount != 0 && nBlockTimeCount2 != 0) {
|
||||
double SmartAverage = (((nBlockTimeAverage)*0.7)+((nBlockTimeSum2 / nBlockTimeCount2)*0.3));
|
||||
if(SmartAverage < 1) SmartAverage = 1;
|
||||
double Shift = nTargetSpacing/SmartAverage;
|
||||
|
||||
int64 nActualTimespan = (CountBlocks*nTargetSpacing)/Shift;
|
||||
int64 nTargetTimespan = (CountBlocks*nTargetSpacing);
|
||||
if (nActualTimespan < nTargetTimespan/3)
|
||||
nActualTimespan = nTargetTimespan/3;
|
||||
if (nActualTimespan > nTargetTimespan*3)
|
||||
nActualTimespan = nTargetTimespan*3;
|
||||
|
||||
// Retarget
|
||||
bnNew *= nActualTimespan;
|
||||
bnNew /= nTargetTimespan;
|
||||
}
|
||||
|
||||
if (bnNew > bnProofOfWorkLimit){
|
||||
bnNew = bnProofOfWorkLimit;
|
||||
}
|
||||
|
||||
return bnNew.GetCompact();
|
||||
}
|
||||
|
||||
|
||||
unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
|
||||
{
|
||||
@ -1402,20 +1485,21 @@ unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const
|
||||
return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
|
||||
}
|
||||
|
||||
|
||||
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
|
||||
{
|
||||
int DiffMode = 1;
|
||||
if (fTestNet) {
|
||||
if (pindexLast->nHeight+1 >= 10) { DiffMode = 2; }
|
||||
if (pindexLast->nHeight+1 >= 5) { DiffMode = 3; }
|
||||
}
|
||||
else {
|
||||
if (pindexLast->nHeight+1 >= 15200) { DiffMode = 2; }
|
||||
if (pindexLast->nHeight+1 >= 34140) { DiffMode = 3; }
|
||||
else if (pindexLast->nHeight+1 >= 15200) { DiffMode = 2; }
|
||||
}
|
||||
|
||||
|
||||
if (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
|
||||
else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }
|
||||
return GetNextWorkRequired_V2(pindexLast, pblock);
|
||||
else if (DiffMode == 3) { return DarkGravityWave(pindexLast, pblock); }
|
||||
return DarkGravityWave(pindexLast, pblock);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user