moved to http://research.web3.foundation/en/latest/polkadot/BABE/

BLOCK PRODUCTION (BABE)

Overview of BABE

BABE stands for 'Blind Assignment for Blockchain Extension'. In BABE, we deploy Ouroboros style block production with some changes in the slot-leader selection and best-chain selection.

In Ouroboros Praos [2], each party is selected to produce a block in a slot with the probability proportional to the party's stake. In our block production, it is the same if parties are not offline in the slots that they supposed to produce a block. However, if they were offline, then they are punished by having less chance to be selected in the future slots.

In Ouroboros [1] and Ouroboros Praos [2], the best chain (valid chain) is the longest chain. In Ouroboros Genesis, the best chain can be the longest chain or the chain which is forked long enough and denser than the other chains in some interval. The details related to Ouroboros protocol are here. We have a different approach for the best chain selection based on GRANDPA and longest chain.

We have two versions of BABE. The first version is almost the same as Ourobooros Praos [2]. We give it in this file. The second version is here which solves the problem related to offline parties as explained above.

BABE

In BABE, we have sequential non-overlaping epochs (), each of which contains a number of sequential slots () up to some bound . We randomly assign each slot to a party, more than one parties, or no party at the beginning of the epoch. These parties are called a slot leader. We note that these assignments are private. It is public after the assigned party (slot leader) produces the block in his slot.

Each party has at least two type of secret/public key pair:

We favor VRF keys being relatively long lived, but parties should update their associated signing keys from time to time for forward security against attackers causing slashing. More details related to these key are here.

Each party keeps a local set of blockchains . These chains have some common blocks (at least the genesis block) until some height.

We assume that each party has a local buffer that contains the transactions to be added to blocks. All transactions are signed with the account keys.

The first version which is almost the same as Ouroboros Praos can be conveniently used with GRANDPA validators who are supposed to be online all the time. The second version is designed for more general users which can be offline time to time.

BABE with GRANDPA Validators Ouroboros Praos

In this version, we do not worry about offline parties because GRANDPA validators are online by design. Therefore, we do not consider the security problems such as speed up attacks. It is almost the same as Ouroboros Praos except chain selection rule and the slot time adjustment.

We give some parameters probability related to be selected as a slot leader in this version before giving the protocol details. As in Ouroboros Praos, we define probability of being selected as

where is the relative stake of the party and is a constant. Improtantly, the function is that it has the 'independent aggregation' property, which informally means the probability of being selected as a slot leader does not increase as a party splits his stakes across virtual parties.

We use to set a threshold for each party :

where is the length of the VRF's first output.

BABE with GRANDPA validators consists of three phases:

1. Genesis Phase

In this phase, we manually produce the unique genesis block.

The genesis block contain a random number for use during the first epoch for slot leader assignments, the initial stake's of the stake holders () and their corresponding session public keys , ) and account public keys ().

We might reasonably set for the initial chain randomness, by assuming honesty of all validators listed in the genesis block. We could use public random number from the Tor network instead however.

TODO: In the delay variant, there is an implicit commit and reveal phase provided some suffix of our genesis epoch consists of every validator producing a block and all produced blocks being included on-chain, which one could achieve by adjusting paramaters.

2. Normal Phase

In normal operation, each slot leader should produce and publish a block. All other nodes attempt to update their chain by extending with new valid blocks they observe.

We suppose each party has a set of chains in the current slot in the epoch . We have a best chain selected in by our selection scheme, and the length of is .

Each party produces a block if he is the slot leader of . If the first output () of the following VRF is less than the threshold then he is the slot leader.

Remark that the more has stake, the more he has a chance to be selected as a slot leader.

If is the slot leader, generates a block to be added on in . The block should contain the slot number , the hash of the previous block , the VRF output , transactions , and the signature . updates with the new block and sends .

ss

In any case (being a slot leader or not being a slot leader), when receives a block produced by a party , it validates the block with . should check the followings in order to validate the block:

If the validation process goes well, adds to . Otherwise, it ignores the block.

At the end of the slot, decides the best chain with the function 'BestChain' (described below).

3. Epoch Update

Before starting a new epoch, there are certain things to be updated in the chain. Stakes of the parties (Session keys) * Epoch randomness

If a party wants to update his stake for epoch , it should be updated until the beginning of epoch (until the end of epoch ) for epoch . Otherwise, the update is not possible. We want the stake update one epoch before because we do not want parties to adjust their stake after seeing the randomness for the epoch .

The new randomness for the new epoch is computed as in Ouroboros Praos [2]: Concatenate all the VRF outputs in blocks starting from the first slot of the epoch to the slot of ( is the epoch size). Assume that the concatenation is . Then the randomness in the next epoch:

This also can be combined with VDF output to prevent little bias by the adversaries for better security bounds.

Best Chain Selection

Given a chain set an the parties current local chain , the best chain algorithm eliminates all chains which do not include the finalized block by GRANDPA. Let's denote the remaining chains by the set . Then the algorithm outputs the longest chain which do not for from more than blocks. It discards the chains which forks from more than slots.

We do not use the chain selection rule as in Ouroboros Genesis [3] because this rule is useful for parties who become online after a period of time and do not have any information related to current valid chain (for parties always online the Genesis rule and Praos is indistinguishable with a negligible probability). Thanks to Grandpa finality, the new comers have a reference point to build their chain so we do not need the Genesis rule.

Relative Time

It is important for parties to know the current slot for the security and completeness of BABE. Therefore, we show how a party realizes the notion of slots. We assume that slot time is greater than the network propogation time.

Each party has a local clock and this clock does not have to be synchronized with the network. When a party receives the genesis block, it stores the arrival time as as a reference point of the beginning of the first slot. We are aware of the beginning of the first slot is not same for everyone. We assume that this difference is negligible comparing to .

Now, we consider parties who join BABE after genesis block released because these parties do not know the current slot when they join. These parties have to wait for at least number of valid blocks in order to determine approximately beginning and end of the slot. Assume that a party joins the network and then decides the best chain whose header generated in slot . stores the arrival time of blocks after . Let us denote the stored arrival times by corresponds to blocks including slot numbers . Remark that these slot numbers do not have to be consecutive since some slots may be empty or the slot leader is offline. deduces that the current slot given that is in a time interval which includes .

Another critical timing issue is 'when to release the block'. In order to find a good block release time so that it arrives everyone before end of the slot, each party follow the same strategy as newly joining party. Assume that the party is a slot leader in and the computes as above. Then the function gives the release time given as an input.

Possible candidates for are average, maximum...

Then the party releases the block at time where is the estimaged network latency.

Informal Security Analysis

BABE with Grandpa validators is the same as Ouroboros Praos except the chain selection rule and relative time based slot-time extraction.

Since we do not use the longest chain rule only, the security bounds shown in Ouroboros Praos is not be the same. However, it seems that we have better selection rule comparing to longest chain rule. So, we have probably have better security bounds than Ouroboros Praos. Hence, if we show that we achieve their assumption related to timing with our relative time algorithm, it seems it is not harmful to use their security bounds in order to find good parameters for security.

Informally, the following important results are shown in Ouroboros Praos [2] with dynamic stakes for security:

The formal statement that shows the above results is: Ouroboros Praos satisfies persistence with parameter and liveness with parameter in a period with slots with the epoch size in the -semisynchronnous execution with probability

assuming that where is the relative stake of honest parties, fixed parameters are , .

Here, is the common prefix parameter, is maximum delay in the network in term of slot number, is the life time of the protocol, is the maximum stake shift over slots. is the number of corrupted parties and is the maximum number of random-oracle queries for a party. This can be considered as the hashing power (bruth forcing the hash).

If we use VDF in the randomness update for the next epoch, disappers in because we have completely random value which do not depend on hashing power of the adversary.

These results are valid assuming that the signature scheme with account key is EUF-CMA (Existentially Unforgible Chosen Message Attack) secure, the signature scheme with the session key is forward secure, and VDF realizing is realizing the functionality defined in [2].

We want to have and close to 1 so ( or close to 0).

If lifetime increases the value should increase too to have . In addition, if increases the decreases. value is very critical because after blocks later a block is added with very high probability to all honest parties' blockchain. We would like to have it as small as possible to have short time to finalize the blocks.

We fix the life time of the protocol as seconds and maximum delay in the network seconds. Then we find the life time of the protocol and maximum delay in terms of slot. We consider the adversaries hashing power is in each slot (which can also change depending on the slot time but for simplicity we use this parameter as an average power for all slot times). We note that changes on number of corruption () do not significantly affect . (Of course dramatical changes affects). Given , we find the common prefix parameter for some slot times . As it can be seen in the graph we have smaller common prefix parameter if we use VDF in the randomness update. In addition, even if we increase the slot time, does not change much.

The more generic version of BABE with any participants are here.

References

[1] Kiayias, Aggelos, et al. "Ouroboros: A provably secure proof-of-stake blockchain protocol." Annual International Cryptology Conference. Springer, Cham, 2017.

[2] David, Bernardo, et al. "Ouroboros praos: An adaptively-secure, semi-synchronous proof-of-stake blockchain." Annual International Conference on the Theory and Applications of Cryptographic Techniques. Springer, Cham, 2018.

[3] Badertscher, Christian, et al. "Ouroboros genesis: Composable proof-of-stake blockchains with dynamic availability." Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security. ACM, 2018.