liuyishengalan / blockchain-project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hardhat Project - Lotto on blockchain

Video Demo is here

Deploy this contract on Sepolia

Detailed guide is here

Remember to create a .env file with the following content:

SEPOLIA_API_URL = "https://eth-sepolia.g.alchemy.com/v2/[THE-API-KEY]"
SEPOLIA_PRIVATE_KEY = 'METAMASK-PRIVATE-KEY'

Since the smart contract is deployed for 1-week long duration, we setup a specific version of the contract for testing purposes.

  • contracts/Lotto_test_version.sol is for testing
  • contracts/Lotto.sol is for deploying

The round duration is set to shorter time for testing purposes.

Next, run the following commands:

npm install
npx hardhat test 
npx hardhat run scripts/deploy.ts --network sepolia

You will see a deployed message with the contract address. Copy the address and paste it in the lotto.ts file in the frontend folder.

Check the frontend readme under the directory frontend to see how to run the frontend.

About


Languages

Language:TypeScript 52.9%Language:Solidity 29.8%Language:JavaScript 15.2%Language:HTML 1.6%Language:CSS 0.4%