# # Generation signature

**Generation signature** is the variable in the average block generation time formula. It is used to check whether the current generating node is eligible to generate the next block.

The computation of the block's generation signature `generationSignature`

_{i+1} is done by the following steps:

- Choosing the block. Let
`h`

will be the current blockchain height. If`h`

≥ 100, then the block at height`h-100`

will be chosen. Otherwise, the block at height`h-1`

will be chosen. - Hashing the chosen block's generation signature
`generationSignature`

_{i}and miner's account public key`pk`

using Blake2b256 (opens new window):`generationSignature`

_{i+1}=`Blake2b256`

(`generationSignature`

_{i},`pk`

)

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 `i+99`

-th block.

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+1`

is dependent on the generator of the block`N`

and 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`calculateVRF`

function, which calculates proof for some message, and`verifyVRF`

function, which verifies proof from`calculateVRF`

function with a message and the public key of the signer.

Considering that a block’s generation signature is equal to`calculateVRF`

output for a previous generation signature with account private key`sk`

(of generator of`i+1`

-th block):

`generationSignature`

_{i+1}=`VRFproof`

=`calculateVRF`

_{sk}(VRF_{i})

The output of`calculateVRF`

function is a VRF proof, which means that the validity of the signature can be checked. Before VRF implementation, the`generationSignature`

_{i}was used in consensus to define the time delay between`i+99`

and`i+100`

blocks for concrete block generator. With VRF, the output of function`verifyVRF`

(`pk`

_{i},`generationSignature`

_{i}) is used to define the time delay between`i+99`

and`i+100`

blocks for concrete block generator.