"use client"; import Image from "next/image"; import Link from "next/link"; import { Address } from "@scaffold-ui/components"; import type { NextPage } from "next"; import { hardhat } from "viem/chains"; import { useAccount } from "wagmi"; import { BugAntIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline"; import { useTargetNetwork } from "~~/hooks/scaffold-eth"; const Home: NextPage = () => { const { address: connectedAddress } = useAccount(); const { targetNetwork } = useTargetNetwork(); return ( <>

Welcome to Scaffold-ETH 2 (Speedrun Ethereum Challenge: Dice game extension)

Connected Address:

Speedrun Ethereum Challenge: 🎲 Dice Game

challenge banner

🎰 Randomness is tricky on a public deterministic blockchain. The block hash is an easy to use, but very weak form of randomness. This challenge will give you an example of a contract using the block hash to create random numbers. This randomness is exploitable. Other, stronger forms of randomness include commit/reveal schemes, oracles, or VRF from Chainlink.

🧤 Every time a player rolls the dice, they are required to send .002 Eth. 40 percent of this value is added to the current prize amount while the other 60 percent stays in the contract to fund future prizes. Once a prize is won, the new prize amount is set to 10% of the total balance of the DiceGame contract.

🧨 Your job is to attack the Dice Game contract! You will create a new contract that will predict the randomness ahead of time and only roll the dice when you′re guaranteed to be a winner!

💬 Meet other builders working on this challenge and get help in the{" "} Telegram Group

SpeedrunEthereum.com !

Tinker with your smart contract using the{" "} Debug Contracts {" "} tab.

Explore your local transactions with the{" "} Block Explorer {" "} tab.

); }; export default Home;