Skip to content

Mike-Zelixon/coinflip-vrf

Repository files navigation

🪙 CoinFlip VRF (Sepolia)

This is a provably fair coin flip smart contract powered by Chainlink VRF v2.5 and deployed on the Sepolia testnet. Players bet ETH, the result is determined by verifiable randomness, and winners receive double their wager.

🧠 Why This Project

Built as a demonstration of on-chain randomness, gas-aware contract design, and end-to-end dApp deployment using:

  • Chainlink VRF v2.5 (subscription + callback model)
  • Solidity ^0.8.19
  • Hardhat + Ethers.js
  • Etherscan contract verification
  • Real contract interaction via Etherscan UI

⚙️ Contract Details

  • Network: Sepolia
  • Contract Address: 0x7F6f67b649E20E0229b4a095Fc837b2795110224
  • VRF Coordinator: 0x9DdfaCa8183c41ad55329BdeeD9F6A8d53168B1B
  • KeyHash: 0x787d74caea10b2b357790d5b5247c2f63d1d91572a9846f780606e4d953677ae

🔄 How It Works

  1. User calls flipCoin(uint8 guess) with ETH:
    • 0 = Heads
    • 1 = Tails
  2. Chainlink VRF v2.5 triggers a randomness request
  3. The contract receives the result via fulfillRandomWords()
  4. If the guess matches the random result, the user wins 2x their bet

Note: randomness is funded using LINK via a Chainlink subscription

🚀 Tech Stack

  • Solidity
  • Hardhat
  • Chainlink VRF v2.5
  • Etherscan Verification
  • Sepolia testnet

📦 Setup Instructions

git clone https://github.com/Mike-Zelixon/coinflip-vrf.git
cd coinflip-vrf
npm install

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published