hanzopgp / DecentralizedCasino

Decentralized solidity casino on ethereum blockchain using smart contract. Frontend Reactjs/Tailwindcss app to interact with it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decentralized Casino

Table of contents

  1. Presentation
  2. Project architecture
  3. How to install
  4. Features
  5. Links

Presentation

This is a decentralized application (dapp) built on ethereum blockchain using smart contract and solidity language. After doing cryptozombies tutorial, watching the source code and taking notes, we are building our first dapp. The goal is to build a casino (dice game, crash game...) on the blockchain, the source code will be public so the users can see if the games are rigged. Thanks to the blockchain technology, the source code won't ever be able to change once the contracts are deployed. This means there will be no way to scam our users. The final goal is to make that app fully secured (paiments, exploits...) and optimised (so the gas fees won't be too expensive).

Project architecture


DecentralizedCasino/
├── dapp/
│   	├── contracts/                 (Contains all the backend in solidity)
│       │       ├── games/ 	       (Contains game model)   
│       │       ├── lib/               (Contains libs like safemath, ownable...)
│       │       ├── token/             (Contains the token files of the casino)
│       │       ├── Casino.sol         (Main solidity file)
│       │       ├── Utility.sol        (Contains utility functions)               
│   	├── migrations/                (Contains the js code to deploy our contracts)
│       ├── test/                      (Contains js tests files ran by truffle test command)
│       ├── build/                     (Contains the json files after being compiled for our tests)
│       ├── client/                    (Contains our frontend application)
│       │        ├── src/              (Contains contracts build and react files)
│       │        │     ├── contracts/  (Contains the json files of the compiled contracts)
│       │        │     ├── components/ (Contains the react components)
│       │        │     └── App.js      (Main javascript file of the app)
│       │        └── public/           (Contains the public frontend element like index.html)
│       └── truffle-config.js          (Contains the config for truffle, like the host and port)
├── README.md		          
├── MEMO.txt
├── TODO.txt
└── LICENCE  

How to install

  • Open a terminal
  • git clone https://github.com/hanzopgp/DecentralizedCasino
  • npm install npm@latest -g (Installs node package manager)
  • npm install -g truffle (Installs truffle so we can compile and migrate)
  • npm install -g hd-wallet (Installs hd-wallet)
  • npm install -g ethereumjs-testrpc(Installs testrpc so we can test our frontend app)
  • npm install -g tailwind(Installs tailwind so we can do a quick css design)
  • cd DecentralizedCasino/dapp
  • truffle unbox truffle-box-react (Don't override anything ! Installs the truffle box in the project)
  • cd client
  • npm install (Installs all the dependencies)
  • npx tailwindcss-cli@latest build -o tailwind.output.css (Builds the css files)
  • cd ..
  • truffle develop (Launch truffle console)
  • migrate (Compilse and migrates your contracts)
  • Open a new terminal in client/
  • npm run start (Runs your local server for the frontend application)
  • It should open a new window "localhost:3000"
  • You can now use the decentralized casino application !

Features

  • Frontend application to interact with deployed contracts in React
  • Frontend application style with Tailwindcss
  • Backend casino in Solidity
  • Truffle tests with JavaScript
  • Deploying local blockchain thanks to Truffle/Ganache/Node
  • Gas optimisation (external, view, memory, uint struct...)
  • Security (SafeMath, Ownable, ERC721...)
  • Payable functions
  • Tokens as credits for the games (Using ERC721)

Links

About

Decentralized solidity casino on ethereum blockchain using smart contract. Frontend Reactjs/Tailwindcss app to interact with it.

License:MIT License


Languages

Language:Solidity 52.1%Language:JavaScript 44.0%Language:HTML 2.4%Language:CSS 1.4%