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.
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
- Network: Sepolia
- Contract Address:
0x7F6f67b649E20E0229b4a095Fc837b2795110224
- VRF Coordinator:
0x9DdfaCa8183c41ad55329BdeeD9F6A8d53168B1B
- KeyHash:
0x787d74caea10b2b357790d5b5247c2f63d1d91572a9846f780606e4d953677ae
- User calls
flipCoin(uint8 guess)
with ETH:0
= Heads1
= Tails
- Chainlink VRF v2.5 triggers a randomness request
- The contract receives the result via
fulfillRandomWords()
- If the guess matches the random result, the user wins 2x their bet
Note: randomness is funded using LINK via a Chainlink subscription
- Solidity
- Hardhat
- Chainlink VRF v2.5
- Etherscan Verification
- Sepolia testnet
git clone https://github.com/Mike-Zelixon/coinflip-vrf.git
cd coinflip-vrf
npm install