Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Decentralized Validator Sampling

Sorawit Suriyakarn edited this page Jul 14, 2020 · 2 revisions

Motivation

When selecting the algorithm to use in selecting validators to respond to oracle data request, there are two mains characteristics that we would like to incorporate.

  1. A validator with a higher voting power should have a higher chance of being chosen than one with a lower voting power
  2. Every validator should still have a chance to be selected

Validator Selection

Once we have a selection space, we have to select a specific validator from that list. To do this, we make use of a random number generator.

Random Number and Seed Generation

As with most random number generator, our number generation proces require the use of a seed. In this specific case, our seed comprise of two components:

  • A list of blockHashes
  • The requestID of the request the validators are being chosen for

In the case of the list of blockHashes, we will use the blockHashes of the previous n blocks. We then take 32/n bytes from each of the hashes and concatenate them. The purpose of this is so that any potentially malicious validators looking to influence the seed, and in turn the validator selected, through intentionally constructing certain blockHashes on the blocks they proposed can only control n/32 of the seed. The 8 in the denominator comes from the fact that, once we have the combined blockHash portion of the seed, we further concatenate that with the requestID of the current request, which is an 8-byte integer.

Randomly Selecting a Validator

After we have used our concatenated seed to generate a random number, we then use that value to select the validator for that round.

To do so, we again assume that the validators in the selection space is sorted in descending order. Then, we imagine that we have a cumulative scale running across that list, with the values bei the validator's voting power. With that, the specific range in which our random number falls in along that cumulative scale determine which validator is ultimately chosen for that round. An example of a selection is shown below.

Setup

Random Number Selection

Selection using a Random Number

Validator Selection

Simulation Statistics

TBD