In this tutorial we will be walking through building and deploying a decentralized lottery smart contract using Hardhat. In this decentralized app, or dApp, anyone can choose a number 1-10000 and pay the ticket price to enter into a weekly lottery. The ticket sales revenue is collected into the pot in the contract. After 7 days, the contract will allow anyone to start the drawing. The contract will then call the API3 QRNG for a truly random number generated by quantum mechanics. The pot will be split amongst all users that chose this winning number. If there are no winners, the pot will be rolled over to the next week.
By the end of this tutorial you should be able to:
Deploy a decentralized lottery smart contract to the Goerli testnet that uses Quantum Randomness.
Who is this tutorial for?
Developers with a basic understanding of the Solidity and Javascript languages that would like to expand their knowledge of building with smart contracts and API3 first-party oracles.
In Part 1, we create a centralized lottery smart contract. In Part 2, we decentralize our lottery by integrating the API3 QRNG.