From Peercoin Wiki
Revision as of 17:04, 23 June 2015 by River
The CheckStakeKernelHash function code can be found in the kernel.cpp file (v0.4.0ppc).
ppcoin kernel protocol coinstake must meet hash target according to the protocol: kernel (input 0) must meet the formula hash(nStakeModifier + txPrev.block.nTime + txPrev.offset + txPrev.nTime + txPrev.vout.n + nTime) < bnTarget * nCoinDayWeight this ensures that the chance of getting a coinstake is proportional to the amount of coin age one owns. The reason this hash is chosen is the following: nStakeModifier: (v0.3) scrambles computation to make it very difficult to precompute future proof-of-stake at the time of the coin's confirmation (v0.2) nBits (deprecated): encodes all past block timestamps txPrev.block.nTime: prevent nodes from guessing a good timestamp to generate transaction for future advantage txPrev.offset: offset of txPrev inside block, to reduce the chance of nodes generating coinstake at the same time txPrev.nTime: reduce the chance of nodes generating coinstake at the same time txPrev.vout.n: output number of txPrev, to reduce the chance of nodes generating coinstake at the same time block/tx hash should not be used here as they can be generated in vast quantities so as to generate blocks faster, degrading the system back into a proof-of-work situation.
|nBits||unsigned int||The POS target we want to check against|
|blockFrom||const CBlock&||The block the stake coins are originating from|
|nTxPrevOffset||unsigned int||The tx offset in originating block|
|txPrev||const CTransaction&||The related tx in originating block|
|prevout||const COutPoint&||The stake OutPoint from originating tx|
|nTimeTx||unsigned int||The coinstake tx time|
|hashProofOfStake||uint256&||The returned calculated hash|
|fPrintProofOfStake||bool||Flag for logging|
|bool||true if the stake kernel hash was successfully checked, otherwise false|
- What is the GetKernelStakeModifier function and what is it used for?
- The GetKernelStakeModifier function is described in detail here
Feel free to add your own questions in this FAQ