Course Content
Blockchain Series #1
About Lesson

Welcome to this brand new course about blockchain. In this course and the next ones we will make you familiar with all you need to know about blockchain and also will teach you some of the latest blockchain coding skills, So that you can enter the fascinating world of decentralized applications.

In this video, we will learn about simple lottery smart contract. The smart contract presented in this video is a simple lottery contract built on the Ethereum blockchain. It serves as a decentralized platform for conducting lotteries with transparent and auditable results. The contract allows participants to enter the lottery by sending Ether to the contract’s enter function. The addresses of the participants are stored in the players array. The contract includes a pickWinner function that can only be called by the manager, who is the address that deployed the contract. The pickWinner function randomly selects a winner from the list of players and assigns the winner’s address to the winnerAddress variable. Once a winner is determined, the players array is reset to prepare for the next round. The getPlayers function enables anyone to view the list of participants. This smart contract is useful in scenarios where a fair and transparent lottery system is required, such as fundraising events, raffles, or other games of chance conducted on the blockchain.

GitHub Repository:

Join the conversation