From 7c712e20bd288c38883ad98328412d5f506556a6 Mon Sep 17 00:00:00 2001 From: grokouser Date: Tue, 10 Jun 2014 20:29:18 -0400 Subject: [PATCH] POS Minting and Combine update. Split is no more. POS minting is in need of an update. In order for YACoin to maintain confidence of it's users, we must adapt to the higher N values (now 15). The problem is that our core holders of YACoin have difficulty managing their coin inputs as their numbers grow. Chunks of coin get split up into tiny insignificant pieces, and the client doesn't have time to check each input for POS block creation. Coins pile up longer then 90 days before they get interest awarded. This is a huge problem, as it makes YACoin fail to deliver on the promise of 5% interest on coins kept between 30 and 90 days. The old rules were designed for a paradigm that no longer exists for YACoin. POS blocks are no longer expected to completely replace POW blocks in some utopia of energy efficiency. There is no longer any need to split coins into tiny pieces in order to generate large numbers of POS blocks in order to "secure the network". To address this issue, new rules are presented that change how coins are managed when POS blocks are minted. First of all, splitting is out. Nobody really needs or wants their coins to be split up. If they do, they can split them up themselves any way they wish using Coin Control. Second, the combine feature will be boosted greatly. Instead of waiting 90 days for a coin input to be eligible for combining, only 31 days will do. And instead of the combine limit being POW reward divided by 3, (which is about 16 now), the combine limit is set to POW reward times 10 (around 550 at the moment). These new rules should lighten the load for clients performing POS minting by about 100X. And small chunks of coin (including new POW minted coins) will be awarded their 5% much sooner after the 30 day waiting period as they get sucked up by other POS blocks. It should be noted that these new "rules" are completely arbitrary and have no effect on block validity. Anybody who can build their own client can change these numbers at will without loosing their coins or getting their POS blocks rejected. And the "secure the network" thing is ancient history. --- src/wallet.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index 34663a913cc..695b07b5442 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1395,10 +1395,11 @@ bool CWallet::CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& w // ppcoin: create coin stake transaction bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64 nSearchInterval, CTransaction& txNew) { - // The following split & combine thresholds are important to security - // Should not be adjusted if you don't understand the consequences - static unsigned int nStakeSplitAge = (60 * 60 * 24 * 90); - int64 nCombineThreshold = GetProofOfWorkReward(GetLastBlockIndex(pindexBest, false)->nBits) / 3; + // Keep combining coins until 10 times POW reward is reached. + int64 nCombineThreshold = GetProofOfWorkReward(GetLastBlockIndex(pindexBest, false)->nBits) * 10; + // Minimum age for coins that will be combined. + unsigned int nStakeCombineAge = 60 * 60 * 24 * 31; + // Keep a table of stuff to speed up POS mining static map mapMiningStuff; @@ -1523,8 +1524,6 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int nCredit += pcoin.first->vout[pcoin.second].nValue; vwtxPrev.push_back(pcoin.first); txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); - if (block.GetBlockTime() + nStakeSplitAge > txNew.nTime) - txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); //split stake if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : added kernel type=%d\n", whichType); fKernelFound = true; @@ -1556,7 +1555,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int if (pcoin.first->vout[pcoin.second].nValue > nCombineThreshold) continue; // Do not add input that is still too young - if (pcoin.first->nTime + nStakeMaxAge > txNew.nTime) + if (pcoin.first->nTime + nStakeCombineAge > txNew.nTime) continue; txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second)); nCredit += pcoin.first->vout[pcoin.second].nValue;