Profile Picture
Illya Gerasymchuk
Entrepreneur / Engineer

🧡 Let's dive into the technical details of RandoMina: a protocol for provable random number generation on Mina Protocol blockchain blockchain written in 01JS! πŸ”’πŸ”

🧡 Let's dive into the technical details of RandoMina: a protocol for provable random number generation on Mina Protocol blockchain blockchain written in 01JS! πŸ”’πŸ” πŸ’‘ Powering zkLocus πŸ”— GitHub: https://github.com/iluxonchik/randomina/

1️⃣ RandoMina uses Zero-Knowledge proofs to ensure random numbers are provable, fresh, and trustless. It combines: - Network State 🌐 - Sender-Specific Nonce πŸ”’ - Local Seed/Nonce 🌱

2️⃣ To ensure freshness, RandoMina leverages $Mina's VRF (Verifiable Random Function) values, specifically `stakingEpochData.seed.value`. πŸ” This value is updated with each new staking epoch, providing a unique seed for each epoch. πŸ“…

3️⃣ Using `stakingEpochData.seed.value` as part of the PRNG seed ensures that random numbers are tied to the current epoch, preventing manipulation and guaranteeing freshness. 🌿

4️⃣ The Sender-Specific Nonce is derived from the sender's public key, ensuring unique (pseudo)random numbers across the network. 🌍 It's computed by Poseidon-hashing the public key, adding a global uniqueness component. πŸ”‘

5️⃣ The Local Seed/Nonce allows generating multiple random numbers per epoch for each sender. 🎲 By varying this private nonce, an infinite number of pseudo-random numbers can be generated within a single epoch. ♾️

6️⃣ RandoMina's smart contract, `RandoMinaContract`, verifies the computation and ensures the claimed network state matches the current epoch. βœ… It's designed to be used or integrated by other contracts needing secure randomness. 🧩

7️⃣ Here's how RandoMina ensures unique random numbers! πŸ•΅οΈ - Two identities (public keys) will always generate different random numbers πŸ”‘ - Same identity with different local seeds produces unique numbers 🌱 - Same identity across different epochs generates distinct numbers πŸ“…

8️⃣ When two identities generate random numbers using RandoMina: βœ… Sender-Specific Nonce is unique due to different public keys βœ… Combining unique Sender-Specific Nonce with Network State and Local Seed/Nonce ➑️ Always results in different random numbers for each identity! πŸŽ‰

9️⃣ For the same identity, using different Local Seed/Nonce values: πŸ”„ Varying the Local Seed/Nonce πŸ”— While keeping the Sender-Specific Nonce and Network State constant ➑️ Produces unique random numbers for the same identity within an epoch! πŸͺ„

πŸ”Ÿ Across different epochs, the same identity generates distinct random numbers: 🌐 Network State changes with each new epoch πŸ†• Updated Network State is combined with Sender-Specific Nonce and Local Seed/Nonce ➑️ Guarantees diff numbers for the same identity across epochs! ⏰

1️⃣1️⃣ Generating a random number involves: 1. Preparing public (Network State, Sender) and private (Nonce) inputs 2. Generating a proof using `RandomNumberObservationCircuit` 3. Verifying the proof and network state with `RandoMinaContract` Code & Tests: https://github.com/iluxonchik/randomina

1️⃣2️⃣ In summary, RandoMina leverages ZK proofs, $Mina's VRF `stakingEpochData.seed.value`, and a combination of network state, sender info, and local nonces to provide secure, verifiable, and infinite randomness for dAppss 🌟

That's it for technical deep dive into RandoMina and its 01JS implementation on Mina Protocol blockchain ! 🀿 For more details, check out the source code and tests on GitHub. ⭐️ Feel free to ask any questions or share your thoughts! πŸ’¬ πŸ”— https://github.com/iluxonchik/randomina

πŸ’¬