Skip to content

Ethereum is the popular blockchain to developing smart contracts. This project intend to share some ways to implement a smart contract to a Lotery Game.

Notifications You must be signed in to change notification settings

JeanRiffel/lottery-smart-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lottery Smart Contract

Project Overview

This project serves educational purposes, offering a web application that allows users to place bets on randomly generated numbers using Ether. A smart contract manages the bets, receives Ether, and determines the winning number randomly. The participant with the correct number receives the accumulated Ether sum.

The project is divided into 3 projects:

  • Lottery Smart Contract*: This handle the bets and decided the winner of the bets. Also reward the winner with all money available;
  • Back-end Lottery Smart Contract: This handle the requests from the user and send it to the smart contract.
  • Front-end Lottery Smart Contract: This is the user interface that the use perform actions.

For this project I used

  • Solidity: Solidity is the programming language for writing smart contracts on the Ethereum blockchain. Learn more about Solidity.
  • Ganache: Ganache is employed to run the Ethereum blockchain locally. More details about Ganache can be found.
  • Truffle: Truffle is the chosen framework for smart contract development.

Installation and Execution Instructions

  1. Initialize Truffle project:
npm install -g truffle
truffle init
  1. Create a new Solidity file in the contracts folder.

  2. Compile the Solidity program:

truffle compile
  1. Migrate the smart contract:
truffle migrate
  1. Access the Truffle console:
truffle console

Running the contract

Whether you followed the previous steps: 3, 4 and 5.

You are now at truffle console right, so type these commands:

  • let lottery = await Lottery.deployed()
  • lottery.contractName()

As output you should see the message: The Lottery Contract is OnLine

About

Ethereum is the popular blockchain to developing smart contracts. This project intend to share some ways to implement a smart contract to a Lotery Game.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published