Randomness is core to the fair execution of many dApps. However, generating secure and private entropy in a decentralized manner is a very difficult task.
Secret-RNG, built on
@SecretNetwork
, solved this puzzle and this feature is now coming to the wider
#Cosmos
#IBC
.
1/n ๐งต๐
2/n
First let's cover where randomness is essential for blockchain
#dApps
/
#web3
, use cases:
1. On-chain games with random components like gambling, damage calculation, loot boxes, boss drops etc.
2.
#NFT
- unordered minting, trait randomization, identity numbering and more.
3/n
3. DAOs/
#defi
- wallet initialization, task assigning, unordered voting/liquidations, order book ordering etc.
Now let's understand how these random numbers are generated and what is still left to improve.
4/n
We can separate randomness/entropy like this:
- True random (Nature, lava lamps)
One can not predict a future event from past events, generation is non-deterministic
- Pseudo-random (Computer algorithms)
Deterministic generation and previous events give away information
5/n
In a pure
#blockchain
environment generating True randomness is not deemed possible. This is the case because blockchains are deterministic in nature, meaning there is no quality entropy (like lava lamps etc.) to use as input seed for a Random Number Generator (RNG).
6/n
Every RNG with the same seed will provide the same sequence of numbers, hence we call these operations pseudo-random. The RNG is only as secure/random as the entropy used to determine the seed.
If I know the seed (like the system time at init) I know the ordered output.
7/n
Even if a RNG is initialized from something not available/known to any observers one could start predicting the sequence.
With every public output an RNG provides, it becomes easier and easier for any observer to hard force and learns the seed that initialized the RNG.
8/n
Hopefully this helps to understand why randomness can be a problem in blockchain. If I launch a public p-RNG and mint NFTs with this output then one knows the order of the NFTs coming out.
Same applies to damage calculation and more, these need RNG not predictable by users.
9/n
So how does blockchain currently solve this?
On blockchains like
#Ethereum
this is currently solved by using off-chain data, specifically the
#Chainlink
-vrf oracle.
This off-chain solution is not tied to the deterministic blockchain entropy and provides better randomness.
10/n
However, off-chain solutions are not optimal as they are "trusted", require fees besides gas and extra infrastructure.
#Secret
-RNG aims to solve RNG on-chain by being Secure, Decentralized and .....
#Private
#IBC
contracts is bringing this feature to the entire
@cosmos
11/n
๐ Secure
Secret-RNG is a smart contract on the
@SecretNetwork
that works in 2 txs. The first will create a random number and the second will retrieve it.
This makes it so one can not error out the transaction on purpose if the output is not desirable (eg. voting usecase).
12/n
๐ฅ๏ธ Decentralized
The code for the RNG is immutable on the
@SecretNetwork
blockchain and can be called by anyone.
Every interaction with the contract will change the initialization seed inside the contract, better securing the next number.
More usage == better randomness
13/n
๐ต๏ธ Private
The contract state on
@SecretNetwork
is private which means no one can ever know the seed used to create the RN, making Secret-RNG a "True Random" generator.
Interactions with contracts are also private securing the RN output when sharing the RN is not needed.
14/n
Cross-chain interoperable smart contracts over
#IBC
are coming to
@Cosmos
โ๏ธ and
@SecretNetwork
enabling hundreds of developers and projects access to better on-chain RNG.
Any contract on
@JunoNetwork
@osmosiszone
etc can call
#Secret
-rng and get a secure random number!
15/n
@scrt_labs
is aiming to make this process as simple as possible by providing an interface much like
@chainlink
does for
#EVM
chains but then on-chain.
Using encrypted sends of these RN even more use-cases will open up currently only possible on
@SecretNetwork
- $SCRT
17/n
Are you an interested developer and want to check out
#Secret
-RNG? Give
@scrt_labs
a follow, we are happy to help out!
Getting started guide for Secret Contracts:
Github Secret-RNG: