Skip to content
CryptoManiac edited this page Feb 18, 2014 · 29 revisions

Proof-of-stake is term referring to the use of currency itself (ownership) to achieve certain goals. In the NovaCoin proof-of-stake is used to provide mining and transaction processing on a par with proof-of-work.

Novacoin uses the mixed Coin-Age/CoinDayWeight approach to provide proofs of the stake. The proof-of-stake difficulty is adjusted so as to limit the rate at which new blocks can be generated by the network to 10 minutes target spacing rate. Due to the very low probability of successful proof generation, this makes it unpredictable which computer in the network will be able to generate the next solution.

How it's supposed to work?

It's performed through scanning all available inputs in order to find lucky one that satisfies following condition:

SHA256(SHA256(KERNEL)) < CoinDayWeight *  NetworkTarget

Miner has to find a SHA256 hash that is under the target value. Target is derived from network target using CoinDayWeight parameter. The proof is presented by kernel hash and header signature. Each coinstake kernel represented by structure of 6 fields, a some of this fields could be varied pretty freely.

Field Type sizeof Requirements
nStakeModifier unsigned long int 8 Shouldn't be modified manually.
nTimeBlockFrom unsigned int 4 Timestamp for block which provided previous transaction.
nTxPrevOffset unsigned int 4 Offset of previous transaction inside the block.
nTxPrevTime unsigned int 4 Timestamp of previous transaction.
nPrevoutNum unsigned int 4 Output number of previous transaction.
nTimeTx unsigned int 4 Current timestamp.

The hashing result of a valid proof-of-stake value must be lower than block target. Miner tries to find this suitable solution by scanning all available unspent inputs with suitable CoinDayWeight.

How long will it take me to generate a proof-of-stake?

Just like with proof-of-work, no-one can say exactly. But there is an estimation of how long it might take. Calculations are quite similar with proof-of-work, but instead of hash we have coin-day-second here. So, at difficulty 1.0 we need ~ 4294967297 coin-day-seconds to find a block.

Probability of successful block generation during one day could be calculated from available CoinDayWeight using formula:

P = CoinDayWeight * 86400 / (4294967297 * difficulty)

Let's estimate probability for current difficulty (0.23482093):

P Age <= 30 45 60 90 120
Sum -
1 0 0.0013 0.0026 0.0051 0.0077 0.0077
10 0 0.0128 0.0257 0.0514 0.0771 0.0771
100 0 0.1285 0.257 0.514 0.771 0.771

Average block generation time could be calculated as:

T =  4294967297 * difficulty / (CoinDayWeight * 86400)
Days Age <= 30 45 60 90 120
Sum -
1 778.2 389.1 194.55 129.7 129.7
10 77.82 38.91 19.46 12.97 12.97
100 7.78 3.89 1.95 1.3 1.3