The MILLIONSY VRF

MILLIONSY
3 min readDec 9, 2021

--

Transparency and security are the two most important factors to the winner selection process. They make sure that no single party could unfairly affect the final results.

The fact that it’s not easy to access a random manipulation-resistant source on-chain in a verifiable manner. For example, while Onchain RNG (Random Number Generator) solutions can easily be subject to miner manipulation, off-chain RNG solutions, on the other hand, are opaque and hard to integrate.

In The MILLIONSY Lottery, we use our own VRF (Verifiable Random Function) which is familiar to Chain Link to generate a random winning number on Solana blockchain. Basically the random winning number is obtained from the Seed Numbers Library (SNL).

This SNL is generated Onchain using the following 2 steps:

1. The MILLIONSY Lottery system will generate a pre-seed library and push it on the Onchain. This pre-seed library is a predefined PseudoRandom Number Generator (PRNG).

2. Pre-seed will be combined with Solana’s Blockhash at the time the winning number is generated (Blockhash data that is still unknown when the request is made):

/// Creates a new PRNG. The two inputs, seed and increment,
/// determine what you get; increment basically selects which
/// sequence of all those possible the PRNG will produce, and the
/// seed selects where in that sequence you start.
///
/// Both are arbitrary; increment must be an odd number but this
/// handles that for you
pub fn new_inc(seed: u64, increment: u64) -> Self {
let mut rng = Self {
state: 0,
inc: increment.wrapping_shl(1) | 1,
};
// This initialization song-and-dance is a little odd,
// but seems to be just how things go.
let _ = rng.rand_u32();
rng.state = rng.state.wrapping_add(seed);
let _ = rng.rand_u32();
rng
}

To see the full algorithm, check this link.

This combination creates a final library of seed numbers, called Seed Numbers Library (SNL). The SNL will change continuously because the nature of Blockhash data is time-continuous.

When a winning number is selected from SNL, this number is basically verified by validator node. This allows neither the offchain nor the Validator or anyone else to know the final result (the winning number). The whole combine process is done and got the final result on the Onchain. So this combination is used to generate both a random number and a cryptographic proof. The MILLIONSY Lottery smart contract will only accept the random number input if it has a valid cryptographic proof, and the cryptographic proof can only be generated if the VRF process is tamper-proof.

By letting any user having the ability to independently audit the integrity of the RNG to verify that it’s unbiased, unpredictable, and manipulation, MILLIONSY wants to send a strong statement that the important role of fairness and transparency to our random number draws is undeniable.

In conclusion, in this phase, we only have been using MILLIONSY’s VRF to bring transparency and security to The MILLIONSY Lottery but in the near future its potential of becoming a standalone oracle on the Solana blockchain is very promising. If you have a project running on Solana and have problems with VRF, feel free to contact us for help.

Stay safe connected

Follow our official social media accounts to stay up to date. Beware of any clones webpages and channels which are not our official link below.

Website | Twitter | Telegram| Telegram channel | Docs

Animation

Youtube | Instagram | Tiktok | Sticker

--

--

MILLIONSY
MILLIONSY

Written by MILLIONSY

The first ever Lottery platform on Solana. Website: millionsy.io

No responses yet