eth coin flip

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

eth coin flip

Created At

ETHGlobal Cannes

Project Description

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.

How it's Made

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.

background image mobile

Join the mailing list

Get the latest news and updates