- Solidity
- Javascript
- Node.js (Express, Mysql2, Sequelize)
- Truffle
- Ganache
- Metamask
- Clone this repository
- Download Truffle
- Download Ganache
- Configure Ganache using
truffle-config.js
from source directory
In the src directory
- install dependecies:
npm install
- Compile the contract:
truffle compile --all
- Deploy the contract:
truffle migrate
- Navigate to:
client/src/contracts
- Open Roulette.json
- Copy the ABI and Contract Address
- Navigate to
client/src/config.js
- Update
ROU_ABI
andROU_ADDRESS
- Navigate to
bot/index.js
- Update
CONTRACT_ABI
andCONTRACT_ADDRESSS
The bot serves as the casino. The Metamask account used to deploy the contract will serve as the casino.
- Make sure you are in a new terminal window
- Navigate to 'bot' directory, from source folder run:
cd bot
- On this directory, run to install dependecies:
npm install
- Create a new
.env
file and copy contents of.env.example
file into it - Configure
.env
variables- RPC_URL is the network url that your Metamask Account is connected to. You can get ganache's RPC in the top menus where it says
RPC SERVER
- PRIVATE_KEY is the private key of your Metamask Account for the casino (should be different from the player's account)
- ACCOUNT is the account address of the Metamask account
- RPC_URL is the network url that your Metamask Account is connected to. You can get ganache's RPC in the top menus where it says
- On 'bot/index.js' update abi and contract address (copy these from 'client/src/config.js')
- Run command
npm run start
- Casino will deploy the contract
- The bot will check the casino deposit amount and deposit money automatically to ensure that the deposit is not below the minimum
- The bot will first reset the game
- The bot will then generate a random number and random hash, hash them together, and send the commitment has to the contract
- The bot will wait two minutes, then reveal the winning number, the casino will automatically payout
- The bot will reset the game and repeat the process
- Deploy bot
- Bot will deposit 1 ether
- Player will join contract by switching account addresses
- During the betting phase player can place their bets
- Player can remove or see their current bets on the table
- In the cloned the repository files,
server/app/config/db.config.js
should look like this:
module.exports = {
HOST: "freedb.tech",
USER: "freedbtech_rou",
PASSWORD: "1807Mich@3l",
DB: "freedbtech_rousp",
dialect: "mysql",
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
};
this will run the server on a hosted server.
- Create a new terminal window
- Navigate to 'server' directory:
cd server
from src folder - Run
npm install
, this install all the project dependecies. - Run
node server.js
which starts the app backend in development mode. - Open http://localhost:8080 to view it in the browser. The page will show you the message
{"message":"Welcome to Rou application by Lette."}
- Create a new terminal window
- Navigate to 'client' directory: from source folder run
cd client
- Run
npm install
, this install all the project dependecies. npm start
, which starts the app front-end in development mode.- Automatically will open http://localhost:8081 in the browser.The page will reload if you make edits. You will also see any lint errors in the console.
Steps for testing the contract;
Note if you do not have truffle installed, you should follow the steps down below to install truffle on your machine. After installing truffle, you can follow the steps of viewing the available test files for the contract
Steps for testing the contract;
- To begin the testing process, one must run the
testrpc
client from the terminal, which starts the server to connect the contract to the testing file. - Open a new terminal window and run
truffle develop
to deploy the contract. - Then use the command
test
to see all the available tests written in the javascript file. - There should be 12 available test files to view.
Install yarn
if you haven't already:
npm install -g yarn
Download zip file or git clone repo:
git clone https://github.com/trufflesuite/trufflesuite.com.git
Navigate into the directory in terminal:
cd trufflesuite.com/
yarn
In terminal run:
yarn dev
Navigate to localhost:9000/port specified in your terminal
To view Browsersync settings navigate to localhost:3001
In terminal run:
yarn build
Navigate to ./build folder for the compiled files.
- Michael Mayaguari - mgmayagu
- Inna Baryanova - innabaryanova