Skip to content

Decentralised coin flipping app built for the Ethereum Network, for learning purposes

Notifications You must be signed in to change notification settings

ErnoW/flippin-coin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flippin' Coin

code style: prettier Donate with Ethereum Netlify Status

Live preview: flippincoin.netlify.app

Preview

A Decentralized application build for the Ethereum Network. Part of programming course Ethereum201 on academy.ivanontech.com.

Build with Truffle and React

Prerequirements

  • Have yarn installed
  • Make sure to have Truffle installed globally via npm install -g truffle. It is developped on v5.1.12, so things might break in other versions.
  • Run a local blockchain via Ganache, or Ganache-cli
  • Have MetaMask installed in the browser

Development

git clone

Contracts

cd smart-contracts
yarn install

Deploy to the local blockchain via truffle deploy (or truffle migrate) Use --reset to force a new deploy

Client

cd client
yarn install

Start local server via yarn start On each deploy, make sure to:

  • change in /client/constants.js the COINFLIP_ADDRESS to the deployed contracts address
  • copy the new abi file to /abis.js

test network

Enable / disable, and update the suitable networks in truffle-config.js

Get mmnomonic seedphrase add it to `smart-contracts/.secret``

Deploy

Deploy contracts

To deploy:

  • Run truffle deploy --network <<network>> to migrate to <<network>>
  • Replace the address in client/constants
  • Replace the abi in client/abis/coinFlip.js
  • Make sure to fund the contract

Deploy frontend

Have netlify-cli installed

npm install netlify-cli -g

To deploy:

  • Update supported networkds in client/constants
  • netlify deploy

Tests

Run truffle console to open the truffle console, followed by test Run truffle console --network <<network>> to open the truffle console when deployed to <<network>>

Debugging

Open console (as described in Tests), then call let instance = await CoinFlip.deployed() get an account via let accounts = await web3.eth.getAccounts() call a fucntion like instance.flipCoin({from: accounts[0], value: web3.utils.toWei("0.0001", "ether")}) or instance.deposit({from: accounts[0], value: web3.utils.toWei("0.1", "ether")})

About

Decentralised coin flipping app built for the Ethereum Network, for learning purposes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published