-
Notifications
You must be signed in to change notification settings - Fork 51
Decentralized Validator Sampling
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.
- A validator with a higher voting power should have a higher chance of being chosen than one with a lower voting power
- Every validator should still have a chance to be selected
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.
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 blocks. We then take 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 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.
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.
TBD