# RANDPA

Finality mechanism

RANDPA is a mechanism for the quick finalization of blocks.

Built on the basis of the pBFT protocol, it allows to agree on the finalization of a chain of several blocks at once in one round.

The idea of ​​finalizing in a round a chain of blocks is based on the GRANDPA protocol.

## Description

There are rounds in RANDPA just as in pBFT ( see the description of the pBFT protocol). A round consists of several steps to ensure the security of the protocol. There is process in each round of the protocol for determining the final chain. To achieve this, each node sends a “confirmation” of the chain, which it considers relevant, and at the same time, the node collects this information from other nodes. As soon as the protocol collects a sufficient number of confirmations for a certain prefix subchain (achievement of supermajority), the round is considered to be successfully completed and finality is reached for the subchain that has been found.

## Characteristics

### Number of network transfers:

$O(n^2)$
• where n is the number of active validators (block producers).

### Round duration:

$T= 2*tblock$
• where tblock is the block generation time.

## Implementation in DAObet

RANDPA in DAObet is implemented as a separate plugin (randpa_plugin).

The algorithm runs in a separate dedicated thread. Network messages are forwarded through a modified network plugin (net_plugin). To activate RANDPA, users must enable the appropriate plugin. The plugin supports work in two modes:

• validator mode (producer)

• full node mode (full-node)

In validator mode, the plugin is actively involved in achieving finality, and in full node mode, the plugin only receives the final evidence of finality. The modes will switch automatically, i.e. if a signature-provider is specified in the node config and the key specified in it is in the list of active validators, then the plugin works in validator mode, in any other case the plugin is in full node mode.