# Generation signature
The computation of the block's generation signature
generationSignaturei+1 is done by the following steps:
- Choosing the block. Let
hwill be the current blockchain height. If
h≥ 100, then the block at height
h-100will be chosen. Otherwise, the block at height
h-1will be chosen.
- Hashing the chosen block's generation signature
generationSignaturei and miner's account public key
pkusing Blake2b256 (opens new window):
The resulting hash is the generation signature.
The ﬁrst 8 bytes of the resulting 32 bytes hash is converted to a number, referred to as the account hit. The hit from
i-th block affects how soon a
i+100-th block’s generator (current miner) will be able to generate a block after
From version 1.2.0, after activation of feature #15 “Ride V4, VRF, Protobuf, Failed transactions” the generation signature is improved by implementing VRF (opens new window) (A Verifiable Random Function with Short Proofs and Keys) — a pseudo-random function that uses a message and the private key of an account to provide a non-interactively verifiable proof for the correctness of its output.
This improvement will allow resisting stake grinding (opens new window) attacks aimed at influencing block generation randomness to skip miner's opportunity to create a block. In the prior implementation of the generation signature formula (see above), the randomness of a block
N+1is dependent on the generator of the block
Nand is determined for each miner.
The use of VRF makes signature generation unpredictable because of the need to know the private key for calculation. Only the holder of the private key can compute the hash, but verifying the correctness of the hash using the public key from block header is available to anyone.
The VRF contains
calculateVRFfunction, which calculates proof for some message, and
verifyVRFfunction, which verifies proof from
calculateVRFfunction with a message and the public key of the signer.
Considering that a block’s generation signature is equal to
calculateVRFoutput for a previous generation signature with account private key
sk(of generator of
The output of
calculateVRFfunction is a VRF proof, which means that the validity of the signature can be checked. Before VRF implementation, the
generationSignaturei was used in consensus to define the time delay between
i+100blocks for concrete block generator. With VRF, the output of function
generationSignaturei) is used to define the time delay between
i+100blocks for concrete block generator.