A multiplayer trading graph betting game where you bet if the graph will go up or down. Sign and send the transaction on every bet using optimism L2 to show how you can do complete on chain betting without spending loads of ETH on gas.
RatTrace is a simple multi-player graph trading game where players can bet against whether the price is going to go higher or lower. Games are started each by the server issuing a start game transaction, and when the players see the chain event for this they can place their bets by placing bet transactions. After a period of time the server issues a stop betting transaction followed by a resolve game transaction where the results of the game are reported in an event and displayed in the client. Random numbers for the game are provided by a commit-reveal scheme. The server generates a large random number 'Reveal Seed' and hashes that to produce the 'Commit seed '. The commit seed is passed in the start game transaction, and the reveal seed passed in the resolve game transaction and verified against the commit seed before it is used. The server includes a faucet to issue test funds so that players can play without needing to go and get any from anywhere else. The full diagram of how it works can be seen here: https://github.com/funfair-tech/lab-rats-scaling-ethereum-monorepo#description
How it's made