We wanted to see if deterministic pseudo random numbers generation (DPRNG) was possible with the Lisk SDK. Spoiler: it is possible!
What it does
Gives the blockchain the ability to use random numbers. Which can be used in games like casino games. We added two games, blackjack and a lottery as example use of the RNG module.
How we built it
The DPRNG is made as module, it can generate pseudo random numbers based on a seed. This makes it deterministic, which is required to make it work with blockchain where every node needs to be able to generate the same state from blocks and transactions. With a reducer other modules can request these pseudo random numbers, given a block height, the range of numbers, the quantity of random numbers, and optionally an extra seed (to make it possible to generate different sets of random numbers in the same block.)
Challenges we ran into
The biggest challenge was time, we started too late, 4 days before the submission deadline we started building and thinking of the concept.
Accomplishments that we're proud of
Making a functional Pseudo Random Number Generator on a blockchain. Which is lightweight and could be extended further to make games based on RNG possible to run on blockchain tech.
What we learned
How to use blockchain to our advantage in creating decentralized fair random numbers.
What's next for Lisk Casino
We want to add some more games, but the RNG module will get its own package to be used by the whole Lisk ecosystem