CREESTL / PokerGame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Poker DApp

This repository contains contracts of poker game

Prerequisites 📃

  • Install Node.js
  • Clone this repository
  • Navigate to the directory with the cloned code
  • Install Hardhat with npm install --save-dev hardhat
  • Create a MetaMask wallet
  • Create a file called .env in the root of the project with the same contents as .env.example
  • Copy your private key from MetaMask to .env file
BTTC_PRIVATE_KEY=***your private key from MetaMask***

⚠️DO NOT SHARE YOUR .env FILE IN ANY WAY OR YOU RISK TO LOSE ALL YOUR FUNDS⚠️


Next steps will show you how to build and deploy the contract 💻.

1. Build

npx hardhat compile

2. Test

npx hardhat test

Move to the "Deploy" step only if all tests pass!

3. Deploy

а) Donau test network
Make sure you have enough test BTT tokens for testnet. You can get it for free from faucet.

npx hardhat run scripts/deploy.js --network donau

b) BTTC main network
Make sure you have enough real BTT tokens in your wallet. Deployment to the mainnet costs real BTT!

npx hardhat run scripts/deploy.js --network bttc

Deployment script takes more than 1.5 minutes to complete. Please, be patient.

After the contracts get deployed you can find their addresses and (addresses + ⚠️private keys⚠️) of some wallets used in deployment in the deployOutput.json file. You have to provide these wallets with some BTT / test BTT in order to call contracts' methods from them. Keep in mind that if you are deploying to mainnet then you have to keep your private keys secret or you risk to loose all your real BTT. But if you are deploying to testnet you might not be worried so much because you can get more test BTT from the faucet any time.

Also if you want some other address to be the owner of deployed contracts then you can use random wallet generator script:

npx hardhat run scripts/createOwnerWallet.js

Make sure to save wallet's address and private key that will be printed in the terminal! They are not saved to any file!
Then you can provide a freshly created wallet with some real / test BTT and place its private key into .env file instead of a previous private key imported from MetaMask. Run deployment scripts after that.

Please note that all deployed contracts are not verified on either BttcScan or BttcTestScan. You have to do it manually!

About


Languages

Language:JavaScript 40.8%Language:Solidity 39.3%Language:TypeScript 19.9%