This audit traces the VTA difficulty algorithm through src/main.cpp:
target spacing, the block-1000 transition, retarget interval, lookback,
timespan bounds, target calculation and consensus enforcement.
Source comments are reported as source evidence, not as measured security guarantees.
The source defines nTargetSpacing = 60 seconds.
Before block 1000, the source uses a 2.4-hour target timespan, corresponding to 144 blocks.
nDiffChangeTarget is 1000; the source switches to the revised difficulty protocol at that height.
After the transition, nTargetTimespanRe is 60 seconds and nIntervalRe is 1.
The retarget calculation looks back by the applicable interval, with a special first-retarget case.
The revised algorithm bounds the actual timespan to 75%–150% of the target before calculating the new target.
The legacy path bounds the actual timespan to 25%–400% of the target.
The new target is derived from the previous target and bounded actual timespan, with a proof-of-work-limit cap.
AcceptBlock() requires the candidate block nBits to equal GetNextWorkRequired(previous block, block).
CheckProofOfWork() validates the target range and checks the block hash against the claimed target.
ComputeMinWork() contains separate behavior for the pre- and post-transition protocol.
The source contains a comment describing a difficulty-manipulation fix, but source code alone is not a measured security guarantee.
No current network-wide dataset is used here to claim observed retarget accuracy or stability.
nBits to match GetNextWorkRequired(). CheckProofOfWork()
then validates the target and hash.
Primary source: github.com/virtacoin/VirtaCoinProject/blob/master/src/main.cpp