← Back to home

eth coin flip

2 players stake ETH, flip a coin on-chain, winner takes all!

Problem Statement

CoinFlip dApp is a simple decentralized application where two players connect their Ethereum wallets, each chooses heads or tails, stakes an equal amount of ETH, and the smart contract randomly flips a coin to decide the winner. The winner automatically receives the total pot (minus gas).It’s trustless, transparent, and runs fully on-chain! Perfect as a fun demo for simple escrow + randomness logic.

Solution

Smart Contract:Built in Solidity, deployed with Hardhat.Uses pseudo-randomness (for demo — use Chainlink VRF for mainnet!).Uses ReentrancyGuard for basic security.Frontend:Built with Next.js, React, Wagmi, and Viem.Connect wallets using MetaMask Connector.Users pick sides, stake ETH, and call joinGame.Shows live status, transaction confirmations, and winner info.Network:Deploy on Ethereum Sepolia testnet (or Goerli, or local Hardhat).Easily extendable for real randomness and multi-room support.

Hackathon

ETHGlobal Cannes

2025

Contributors