This project is an Ethereum private network playground with a dice guessing mini-game smart contract, it also demonstrate setting up private Ethereum network, deploying smart contract on the network, finally interact with Ethereum smart contract with a simple web-based DAPP.
The smart contract include an ERC223 standard token, a crowdsale which accept ETH and distribute the ERC223 token and a mini dice game in which players can bet with the ERC223 token they holding.
-
Clone git repo
git clone https://github.com/shawn-cx-li/ethereum-dice-game.git
-
Start the first node. The first node can be boosted from either a cloud server or the local machine, map the docker port 30303 with local port 30303, and expose TCP 30303 in security setting
-
Run other nodes, boostrap it to the first node
cd ethereum-demo/scripts
RPC_PORT=8545 ./runnode.sh node1
-
Run node console
docker exec -ti ethereum-node1 geth attach
-
Import key in node (in the console)
web3.personal.importRawKey("","")
-
Set your key as miner beneficiary account
miner.setEtherbase("Address")
-
Start mining
miner.start(1)
- Search and install Metamask in
chrome app store
- Create a wallet in metamask
- Export private key
- install dependencies
cd ethereum-demo
npm install
-
Install truffle
npm install -g truffle
-
Generate smart contract artifacts
tuffle compile
-
Run DAPP
npm run dev