🎲 I Built an On-Chain Coin Flip Game on Abstract
Abstract is the hottest new Layer 2 blockchain for Ethereum crafted by Lucas Netz.
Instead of just testing simple transactions, I wanted to really experiment.
So I created a smart contract for an on-chain coin flip game.
Here's how I did it 👇
1️⃣ Getting Sepolia ETH
I started by grabbing some Sepolia ETH from Alchemy's faucet:
🔗 Alchemy Faucet
Ethereum Sepolia FaucetA fast and reliable Ethereum Sepolia testnet faucet for blockchain developers.https://www.alchemy.com/faucets/ethereum-sepolia
2️⃣ Bridging to Abstract Testnet
Next, I bridged those ETH to the Abstract testnet using their official portal:
🔗 Abstract Testnet Bridge
Abstract Portal | View balances, transfer and bridge tokensAbstract Portal allows you to view your balances, transfer tokens and bridge assets between Abstract and Ethereumhttps://portal.testnet.abs.xyz/bridge
3️⃣ Building the Smart Contract
Using Hardhat, I wrote my smart contract.
Honestly, Abstract’s documentation made the process surprisingly smooth.
Major kudos to the team for that!
4️⃣ Deployment Success 🎉
After some tweaks, compiling, deploying, and verifying, my smart contract was live!
Here's the deployed contract:
🔗 Smart Contract on Abstract Explorer
Abstract Block ExplorerAbstract Block Explorer provides all the information to deep dive into transactions, blocks, contracts, and much more. Deep dive into Abstract and explore the network.https://explorer.testnet.abs.xyz/address/0x64Ab185143B89717c7D67bF086237b5f149d3487#transactions
5️⃣ How It Works
Since the contract is verified, the source code is available.
Anyone can interact with it directly on-chain.
To play, simply call the flip function.
Choose your ETH bet amount and pick true (heads) or false (tails).
6️⃣ A Work in Progress
This is just the start!
I'll rebuild this project with a much better user interface and expand its functionality.
Stay tuned for updates.
Want to see the full process?
I documented everything in this YouTube video:
📽️ How I Built an On-Chain Coin Flip Game
What should I build next?
Let me know your ideas 👇