Skip to content

🃏🎮A NFT(ERC721) card game build on Ethereum, Truffle, Ganache and hosting on IPFS.

License

Notifications You must be signed in to change notification settings

wittyCodeX/nifty-game

Repository files navigation

Non-fungible token game

This project is a crypto card game that uses OpenZepplin.

The contract is compiled and deployed under the ERC-721 non-fungible token standard with truffle framework. After deploying onto the Ethereum blockchain, users will be able to play the game by interacting with the smart contract through DAPP’s front-end interface.

Acquiring game card: Users can acquire game cards using ETH. Every game card will have a game point on it, which will be used to determine the winner later in the game.

Playing the game: Once entered the game, players will need to choose a card to play for the round. Each round, the smart contract will randomly decide either card with larger or smaller point wins the round. At the same time, the smart contract will also randomly generate a number in order to compete with the player. Winner of the game will be able to win the bet put in.

ERC-721 Token

ERC-721 non-fungible token: ERC-721 is a free, open standard that describes how to build non-fungible or unique tokens on the Ethereum blockchain. While most tokens are fungible (every token is the same as every other token), ERC-721 tokens are all unique (with unique ID).

Reference

Contracts

You can find contract detail under contracts/ directory:

Technical stack

Frontend

  • React
  • Redux
  • Saga
  • Web3(MetaMask)

UI

  • Sass
  • Material-UI

Smart contract/Solidity

  • Truffle

Test environment/Private chain

  • ganache

Requirements

  • NodeJS 8.0+ recommended.
  • Windows, Linux or Mac OS X.

How To Install Dependencies

First install required dependencies:

You'll need local ethereum node, I recommend ganache-cli. You can install it from npm.

npm install -g ganache-cli

Install truffle:

npm install -g truffle

Then install contract dependencies:

npm install

How To Test

First make sure that local ethereum node is running. Execute:

ganache-cli --gasLimit 0xffffffffff -p 8545

Now you can compile and deploy contracts:

truffle compile && truffle migrate

Run contract tests:

truffle test

Playground

We already deployed contracts to Ropsten network. You can play with them RIGHT NOW.

Contract Token address Transaction hash
CryptoHerosGame 0x0B6211662d7fcAa5B0DF771dBE49996c4b08d3C9 0xd09a7c09e70a8d9d9933138ca5b54757b64fe3f076defc0a8cb1bf3e9eb75889
CryptoHerosToken 0xf70F7d4e063E50B68a08db043f6345ea68A446bE 0xd6f3989edb1df46325ab4df12fbc6efbde10088ca18e1e2cee866ce03d66751d

Card List

See CARD.md for more information.

Contributing

See CONTRIBUTING.md for how to help out.

Licence

See LICENSE for details.

About

🃏🎮A NFT(ERC721) card game build on Ethereum, Truffle, Ganache and hosting on IPFS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 76.5%
  • CSS 22.3%
  • HTML 1.2%