Pages:
Author

Topic: 'CACHE'Project [VALM-Cache difficulty recalculation algorithm, SpamHash Control] - page 8. (Read 8135 times)

sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

  New algorithm for recalculating the difficulty of "VALM-Cache" - logical analysis, mathematically variable.
Code...
Code:
static const int64 nTargetSpacingWorkMaxPow = 12 * nPowTargetSpacing; // 14400
static const int64 nTargetSpacingWorkMaxPos = 12 * nPosTargetSpacing; // 7200
static const int64 nTargetTimespanPow = nTargetSpacingWorkMaxPow * 6 * 12; // 1036800  matrix
static const int64 nTargetTimespanPos = nTargetSpacingWorkMaxPos * 6 * 12; // 518400   matrix

// ppcoin: find last block index up to pindex
const CBlockIndex* GetLastBlockIndex(const CBlockIndex* pindex, bool fProofOfStake)
{
    while (pindex && pindex->pprev && (pindex->IsProofOfStake() != fProofOfStake))
        pindex = pindex->pprev;
    return pindex;
}
const CBlockIndex* GetLastBlockIndexPow(const CBlockIndex* powpindex, bool fProofOfWork)
{
    while (powpindex && powpindex->pprev && (powpindex->IsProofOfWork() == fProofOfWork))
        powpindex = powpindex->pprev;
    return powpindex;
}
const CBlockIndex* GetLastBlockIndexPos(const CBlockIndex* pospindex, bool fProofOfStake)
{
    while (pospindex && pospindex->pprev && (pospindex->IsProofOfStake() != fProofOfStake))
        pospindex = pospindex->pprev;
    return pospindex;
}
Code:
unsigned int GetNextTargetRequiredPos(const CBlockIndex* pospindexLast, bool fProofOfStake)
{
    CBigNum bnTargetLimitPos = bnProofOfStakeHardLimit;

    if (pospindexLast == NULL)
        return bnTargetLimitPos.GetCompact(); // last block
    const CBlockIndex* pospindexPrev = GetLastBlockIndexPos(pospindexLast, fProofOfStake);
    if (pospindexPrev->pprev == NULL)
        return bnInitialHashTarget.GetCompact(); // first block
    const CBlockIndex* pospindexPrevPrev = GetLastBlockIndexPos(pospindexPrev->pprev, fProofOfStake);
    if (pospindexPrevPrev->pprev == NULL)
        return bnInitialHashTarget.GetCompact(); // second block 1
    const CBlockIndex* pospindexPrevPrevPrev = GetLastBlockIndexPos(pospindexPrevPrev->pprev, fProofOfStake);
    if (pospindexPrevPrevPrev->pprev == NULL)
        return bnInitialHashTarget.GetCompact(); // second block 2
    const CBlockIndex* pospindexPrevPrevPrevPrev = GetLastBlockIndexPos(pospindexPrevPrevPrev->pprev, fProofOfStake);
    if (pospindexPrevPrevPrevPrev->pprev == NULL)
        return bnInitialHashTarget.GetCompact(); // second block 3
    const CBlockIndex* pospindexPrevPrevPrevPrevPrev =
                                            GetLastBlockIndexPos(pospindexPrevPrevPrevPrev->pprev, fProofOfStake);
    if (pospindexPrevPrevPrevPrevPrev->pprev == NULL)
        return bnInitialHashTarget.GetCompact(); // second block 4
    const CBlockIndex* pospindexPrevPrevPrevPrevPrevPrev =
                                            GetLastBlockIndexPos(pospindexPrevPrevPrevPrevPrev->pprev, fProofOfStake);
    if (pospindexPrevPrevPrevPrevPrevPrev->pprev == NULL)
        return bnInitialHashTarget.GetCompact(); // second block 5

    int64 nLastCoinSearchTime = GetAdjustedTime();

    if(pospindexPrev->IsProofOfStake() && pospindexPrevPrev->IsProofOfStake() &&
       pospindexPrevPrevPrev->IsProofOfStake() && pospindexPrevPrevPrevPrev->IsProofOfStake())
    {
    nLastCoinPosSearchInterval = ( nLastCoinSearchTime - PosPindexPrevPrevTime ) -
                                                                   ( nLastCoinSearchTime - PosPindexPrevTime );
    nLastCoinPosSearchIntervalPrev = ( nLastCoinSearchTime - PosPindexPrevPrevPrevTime ) -
                                                                   ( nLastCoinSearchTime - PosPindexPrevPrevTime );
    nLastCoinPosSearchIntervalPrevPrev = ( nLastCoinSearchTime - PosPindexPrevPrevPrevPrevTime ) -
                                                                   ( nLastCoinSearchTime - PosPindexPrevPrevPrevTime );
    }

    nUnixCachChainTime = nLastCoinSearchTime - 1 + nNewTimeBlock;

    double nPosTargetSpacingTest = 0;
    if(pospindexPrev->GetBlockTime() > nPowForceTimestamp && pospindexPrev->GetBlockTime() < nPowForceTimestamp + NTest)
       nPosTargetSpacingTest = nPosTargetSpacing / nPosTargetSpacing * 600;
       else
           nPosTargetSpacingTest = nPosTargetSpacing;
    int64 nActualTimeIntervalLongPosVeryFirst = nLastCoinPosSearchInterval;
    if(nActualTimeIntervalLongPosVeryFirst < 0)
       nActualTimeIntervalLongPosVeryFirst = nPosTargetSpacingTest / 100 * nSpamHashControl;
    int64 nActualTimeIntervalLongPosFirst = nLastCoinPosSearchIntervalPrev;
    if(nActualTimeIntervalLongPosFirst < 0)
       nActualTimeIntervalLongPosFirst = nPosTargetSpacingTest / 100 * nSpamHashControl;
    int64 nActualTimeIntervalLongPosSecond = nLastCoinPosSearchIntervalPrevPrev;
    if(nActualTimeIntervalLongPosSecond < 0)
       nActualTimeIntervalLongPosSecond = nPosTargetSpacingTest / 100 * nSpamHashControl;
    double nActualSpacingTotalsPos = ( nActualTimeIntervalLongPosVeryFirst + nActualTimeIntervalLongPosFirst ) / 2;
    double nActualTimeIntervalNvar = nActualTimeIntervalLongPosVeryFirst;

    // cacheproject retarget
    // VALM-Cache /logical analysis - mathematically variable/
    int64 nActualSpacingPos = 0;
    double nVar = nPosTargetSpacingTest / 3;
    int64 nNonAccelerating = 0; // sec +0-
          PosPindexPrevTime = pospindexPrev->GetBlockTime();
          PosPindexPrevPrevTime = pospindexPrevPrev->GetBlockTime();
          PosPindexPrevPrevPrevTime = pospindexPrevPrevPrev->GetBlockTime();
          PosPindexPrevPrevPrevPrevTime = pospindexPrevPrevPrevPrev->GetBlockTime();
          nLastCoinPosTwoInterval = nActualSpacingTotalsPos;
          nActualSpacingPos = ( nActualSpacingTotalsPos + nActualTimeIntervalLongPosSecond ) / 2;
    if(nActualTimeIntervalNvar >= nNonAccelerating && nActualTimeIntervalNvar < nPosTargetSpacingTest - nNonAccelerating)
       nPosTargetSpacingVar = (( nPosTargetSpacingTest - 1 + nVar ) -
                                                              ( nActualTimeIntervalNvar * nVar / nPosTargetSpacingTest ));
       else if
              (nActualTimeIntervalNvar > nPosTargetSpacingTest + nNonAccelerating &&
                                                  nActualTimeIntervalNvar <= nPosTargetSpacingTest * 2)
               nPosTargetSpacingVar = (( nPosTargetSpacingTest + 1 + nVar ) -
                                                  ( nActualTimeIntervalNvar * nVar / nPosTargetSpacingTest ));
               else if
                      (nActualTimeIntervalNvar > nPosTargetSpacingTest * 2)
                       nPosTargetSpacingVar = nPosTargetSpacingTest - nVar + 1;
                       else
                           nPosTargetSpacingVar = nPosTargetSpacingTest;
    double nSTSp = nPosTargetSpacingTest; // 1200 sec
    int64 posUppermin = 0;
    double posUppermax = nSTSp - nNonAccelerating; // 1199 sec
    double posLowermin = nSTSp + nNonAccelerating; // 1201 sec
    int64 posLowermax = nTargetSpacingWorkMaxPos;  // 2400 sec
    if(nActualTimeIntervalLongPosVeryFirst > posLowermin && nActualSpacingTotalsPos < posUppermax)
       nActualTimeIntervalXUXLpos = nActualTimeIntervalLongPosVeryFirst;
       else if(nActualTimeIntervalLongPosVeryFirst > posLowermin && nActualSpacingTotalsPos > posLowermin)
               nActualTimeIntervalXUXLpos = min((double) nActualTimeIntervalLongPosVeryFirst, (double) nActualSpacingTotalsPos);
       else if(nActualTimeIntervalLongPosVeryFirst < posUppermax && nActualSpacingTotalsPos < posUppermax)
               nActualTimeIntervalXUXLpos = max((double) nActualTimeIntervalLongPosVeryFirst, (double) nActualSpacingTotalsPos);
       else if(nActualSpacingTotalsPos < posUppermax && nActualSpacingTotalsPos > nActualSpacingPos)
               nActualTimeIntervalXUXLpos = nActualSpacingTotalsPos;
       else if(nActualSpacingTotalsPos > posLowermin && nActualSpacingTotalsPos < nActualSpacingPos)
               nActualTimeIntervalXUXLpos = nActualSpacingTotalsPos;
               else
                   nActualTimeIntervalXUXLpos = nActualSpacingPos;
    double nNix = nSTSp / 100 * 70;
    double nReverseEffectPos = 0;
    if(nActualTimeIntervalXUXLpos < nNix)
       nReverseEffectPos = nActualTimeIntervalXUXLpos / nNix;
       else if(nActualTimeIntervalXUXLpos > nSTSp && nActualTimeIntervalXUXLpos <= nSTSp + ( nSTSp - nNix))
               nReverseEffectPos = ( nSTSp / nSTSp ) / 2;
       else if(nActualTimeIntervalXUXLpos > nSTSp + ( nSTSp - nNix) && nActualTimeIntervalXUXLpos < posLowermax)
               nReverseEffectPos = (( nSTSp + ( nSTSp - nNix )) / nActualTimeIntervalXUXLpos ) / 2;
               else
                   nReverseEffectPos = 1;
       posUpperLower = ( nSTSp / 2 ) * nReverseEffectPos; // interval sampling 2:1 variable
    if(nActualSpacingTotalsPos < nNix / 1.30 && nActualTimeIntervalLongPosVeryFirst < posUppermax)
       posUpperLower = posUpperLower * (( nNix / 1.30 ) / nActualSpacingTotalsPos );
    double XUXL = nPosTargetSpacingTest / 100 * 4;
    double U = 0;
    double L = 0;
    double XU = XUXL + ( posUppermax * posUpperLower / nSTSp ); // 100.9166 +%
    double XL = XUXL + ( nSTSp * posUpperLower / posLowermin ); // 100.9167 +%
    double nBalance = 1.0;
    double nN = XUXL - ( XUXL / nBalance );
    int64 nTargetTimespanMin = nTargetTimespanPos / XL - 1; // min
    int64 nActualTimeIntervalXU = nActualTimeIntervalXUXLpos;
    int64 nActualTimeIntervalXL = nActualTimeIntervalXUXLpos;
    if(nActualTimeIntervalXU >= posUppermin && nActualTimeIntervalXU < posUppermax)
       U = nN + (( XU - ( nActualTimeIntervalXU * posUpperLower / nSTSp )) / nBalance );
       else U = 1;
    if(nActualTimeIntervalXL > posLowermin && nActualTimeIntervalXL < posLowermax)
       L = XL - ( nSTSp * posUpperLower / nActualTimeIntervalXL );
       else if(nActualTimeIntervalXL >= posLowermax)
               L = XL / 2;
               else L = 1;
    int64 nTargetTimespanControlu = nTargetTimespanPos / U; // min
    int64 nTargetTimespanControll = nTargetTimespanPos / L; // min
    if(nTargetTimespanControlu >= nTargetTimespanMin)
       XUpperPos = U;
       else if(nTargetTimespanControlu < nTargetTimespanMin)
               XUpperPos = XU;
               else
                   XUpperPos = 1;
    if(nTargetTimespanControll >= nTargetTimespanMin)
       XLowerPos = L;
       else if(nTargetTimespanControll < nTargetTimespanMin)
               XLowerPos = XL;
               else
                   XLowerPos = 1;
    CBigNum bnNewPos;
    bnNewPos.SetCompact(pospindexPrev->nBits);
    double nTargetTimespanBn = nTargetTimespanPos / max( XUpperPos, XLowerPos );
    double nInterval = nTargetTimespanBn / nPosTargetSpacingTest;
    if(pospindexPrev->GetBlockTime() > nPowForceTimestamp)
    {
       if(pospindexPrev->GetBlockTime() > nPowForceTimestamp && pospindexPrev->IsProofOfStake())

       bnNewPos *= (( (int64) nInterval - 1) * (int64) nPosTargetSpacingVar + (int64) nActualTimeIntervalXUXLpos +
                                                                                  (int64) nActualTimeIntervalXUXLpos);
       bnNewPos /= (( (int64) nInterval + 1) * (int64) nPosTargetSpacingVar);

       if(bnNewPos > bnTargetLimitPos)
          bnNewPos = bnTargetLimitPos;
       //if(bnNewPos < bnTargetLimitPos + bnTargetLimitPos)
          //bnNewPos = bnTargetLimitPos;
    }
    return bnNewPos.GetCompact();
}

https://github.com/DeffM/CACHeCoin/blob/534d970af686005a46ac7b412835fa9aca4ab885/src/main.cpp#L1149


sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

New version available

CACHE-Project, Reorganization of check functions

Version : v_6.1.1.8
Version of git : v_0.7.5.83
Subversion : v_0.7.6.22


sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

  The idea of using the Hard-fork time management function.

Need function automatically save check point (for example, with a lag of 24 hours). And in the event of an
emergency situation that threatens the entire project, such as a major embezzlement from the exchange,
it is possible to activate one of the Hard-Forks and roll back the blockchain to a saved checkpoint.



Idea with overdone.

It is enough to stop the block chain to analyze the situation and make a decision. But in any case, using the Hard-fork
time management function this operation can be carried out in a few minutes ..


sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

  The idea of using the Hard-fork time management function.

Need function automatically save check point (for example, with a lag of 24 hours). And in the event of an
emergency situation that threatens the entire project, such as a major embezzlement from the exchange,
it is possible to activate one of the Hard-Forks and roll back the blockchain to a saved checkpoint.

sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

  The Hard-fork time management controls the number of coins in the hardfork control address.
When reducing the amount in the address to the set values, the functions are switched on one by one..
Code:
int  nHardForkOneValue = 15 * COIN;
int  nHardForkTwoValue = 10 * COIN;
int  nHardForkThreeValue = 5 * COIN;
bool fHardForkOne = false;
bool fHardForkTwo = false;
bool fHardForkThree = false;
-------------------------
Code:
    if (nValueHardForkControlAddress <= nHardForkOneValue)
    {
        fHardForkOne = true;
        printf(" 'CWallet' - fHardForkOne = true\n");
    }
    if (nValueHardForkControlAddress <= nHardForkTwoValue)
    {
        fHardForkTwo = true;
        printf(" 'CWallet' - fHardForkTwo = true\n");
    }
    if (nValueHardForkControlAddress <= nHardForkThreeValue)
    {
        fHardForkThree = true;
        printf(" 'CWallet' - fHardForkThree = true\n");
    }

  In the transactions to WatchOnlyAddress is displayed:

Credit()
Deposit (taking into account the related addresses of the wallet)
Transactions to myself ()
POW blocks generation ()
POS blocks generation (the full coins amount of WatchOnlyAddress is displayed)



sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

New version available

CACHE-Project, Hard-fork time management function added, Added the ability to view transaction amounts in the monitoring address

Version : v_6.1.1.7
Version of git : v_0.7.5.82
Subversion : v_0.7.6.21


sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information
Hardfork Transaction Driven

  The function of date management Hardfork in some cases, or rather is always, irreplaceable.
The reasons for the time shift of the intended and strictly prescribed HardFork are many.
Exchange did not install the update. Football on TV. Ill child. Any sudden bugs in the code, etc.
In a word, the Hardfork Transaction Driven is a necessary function.
sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information
 
Adding an address for viewing is permissible in two ways.

1. The command from the console - importwatchonlyaddress - with the search for all
    transactions in the address.
2. Make an entry in the address book with a label - watchonlyaddress - to view the transactions from the current time.

 Transactions are displayed with zero values, for information look the tab - detail.

 The balance of the observed address can be viewed with the command - getwatchaddressbalance.

 Initially, the idea was to create a hardfork control function not tied to the exact time. This version of the client is an
intermediate step to the idea.

sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

New version available

CACHE-Project, WatchOnlyAddress function added, Added the ability to monitor one address with a balance check

Version : v_6.1.1.6
Version of git : v_0.7.5.79
Subversion : v_0.7.6.20



sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information
Good luck with the project. I remember cache coin back in the days.

Yes, Cryptsy, Cryptorush, the modest Poloniex and the first network attacks. Smiley

Ah yes... memories.  Smiley

Then everything was based on enthusiasts - now on the money.. Smiley
sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information
legendary
Activity: 3122
Merit: 1003
Good luck with the project. I remember cache coin back in the days.

Yes, Cryptsy, Cryptorush, the modest Poloniex and the first network attacks. Smiley

Ah yes... memories.  Smiley  Good luck with this.  Smiley
sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information
Good luck with the project. I remember cache coin back in the days.

Yes, Cryptsy, Cryptorush, the modest Poloniex and the first network attacks. Smiley

A CLASSIC CRYPTO
+unique algo  Wink
Cool to see it reOrgAnizing and surviving.

Crypto is trying to survive - I'm trying to help her  Smiley
sr. member
Activity: 1246
Merit: 257
Good luck with the project. I remember cache coin back in the days.

Yes, Cryptsy, Cryptorush, the modest Poloniex and the first network attacks. Smiley

A CLASSIC CRYPTO
+unique algo  Wink
Cool to see it reOrgAnizing and surviving.
sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information
sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

New version available

CACHE-Project, The spam hash list is extended to 100 lines. Checks optimization

Version : v_6.1.1.5
Version of git : v_0.7.5.77
Subversion : v_0.7.6.19




hi can you compile new windows qt? i cant sync on old version (

Already easy ... Smiley
newbie
Activity: 28
Merit: 0

New version available

CACHE-Project, The spam hash list is extended to 100 lines. Checks optimization

Version : v_6.1.1.5
Version of git : v_0.7.5.77
Subversion : v_0.7.6.19




hi can you compile new windows qt? i cant sync on old version (
sr. member
Activity: 939
Merit: 261
Data HDD Repair - Recovery of lost information

   For today. All spam is filtered out when executing the 'tx' command on the ProcessMessage level.
Additionally, the spam package hash is saved to the spam list. When re-receiving 'inv' with such data,
the package is blocked based on the stored data.

  Why it is needed. Spam is observed in many networks and projects, especially POS. It hinder the rapid
dissemination of information about new blocks and transactions. As a result, a large number of orphaned
blocks are formed, this creates the possibility of double spending as well as unreasonably high POS reward.

 The presence of spam can be viewed in debug.log
The similarity of this ...

Code:
connection timeout
ERROR: FetchInputs() : 77c01bb195 mempool Tx prev not found d82f384072
stored orphan tx 77c01bb195 (mapsz 1)
ERROR: FetchInputs() : 232e3ad4eb mempool Tx prev not found 7305c2bbb6
stored orphan tx 232e3ad4eb (mapsz 2)
ERROR: FetchInputs() : 8ee218abb3 mempool Tx prev not found 77c01bb195
stored orphan tx 8ee218abb3 (mapsz 3)
ERROR: FetchInputs() : 8d46091608 mempool Tx prev not found 8ce31acefa
stored orphan tx 8d46091608 (mapsz 4)
ERROR: FetchInputs() : d00e372090 mempool Tx prev not found 8d46091608
stored orphan tx d00e372090 (mapsz 5)
ERROR: FetchInputs() : fe0f1a9c0a mempool Tx prev not found 01200c5384
stored orphan tx fe0f1a9c0a (mapsz 6)
ERROR: FetchInputs() : 27712e34e4 mempool Tx prev not found c577996957
stored orphan tx 27712e34e4 (mapsz 7)
ERROR: FetchInputs() : cc41f90986 mempool Tx prev not found c0ea949a19
stored orphan tx cc41f90986 (mapsz 8)
ERROR: FetchInputs() : 5a8a23adb5 mempool Tx prev not found 99ec48c825
stored orphan tx 5a8a23adb5 (mapsz 9)
ERROR: FetchInputs() : 0cc9ee7471 mempool Tx prev not found 5a8a23adb5
stored orphan tx 0cc9ee7471 (mapsz 10)
trying connection 76.121.62.235:8922 lastseen=3.2hrs
connection timeout

Pages:
Jump to: