Solidity, Node Js, React Js, Java Script, HTML, CSS, Bootstrap.
#Truffle #IPFS #Metamask #Ethers
Chainlink Oracle, Openzzeplin
The chainlink oracle its one of some safe way to generate random number inside blockchain.
The openzzeplin its a design patters tested more thousand time by blockchain community they have some contracts we can use to reach goals.
This is a project that uses chainlink random number, when all tickets are sold, he calls this chainlink oracle contract and brings that random number, after three handred seconds, you can claim your reward, you win an erc20 token coin as a reward when the winner asks for his reward, automatically after the system resets and is ready for the next lottery
In the video below part that connect, you need to wait 2 or 3 seconds to loads, it needs to call the blockchain and query to bring up the information, you are free to buy how many tickets you want,when all tickets are purchased, the contract automatically calls the chainlink contract pays 0.1 LINK token as a fee which is requested by chainlink for providing a secure form of "random number".
conect.mp4
When all tickets are sold, you can see the Claim tab change and show the winning wallet. To claim your reward, you must wait three handred seconds, why so long? this happen because blochain have some delay, each blockchain has a certain time to process transactions like rinkeby network 2 to 5 minutes,kovan 2 minutes, after wait you get an erc20 token coin as a reward.
if you are going to test this code, first look at the response time in the chainlink documentation, each network has different times to bring a random number.
When you claim your reward automatically, it will reset the tickets and be ready for a new lottery…