A reactive onchain roguelite dice battler with optimistic gameplay, verifiable turn settlement, and automatic cross-chain reward delivery via Reactive Contracts.
Video Intro: Watch on YouTube | Online Demo: protomon-yahtzee.vercel.app | Pitch Deck: ProtoMon-demo-day-deck.pptx
Problem • Solution • Reactive Contracts • Deployed Contracts • Workflow • Quick Start • Submission Checklist
ProtoMon targets a specific product gap in onchain games:
- turn-based games want instant local responsiveness
- settlement still needs to be verifiable onchain
- rewards should move automatically across contracts and networks
- a normal offchain watcher or cron job introduces extra trust, extra operations, and extra failure points
Without a reactive layer, the reward workflow would require a separate backend or relayer service to:
- monitor the origin contract for a win event
- detect the correct reward recipient
- submit a follow-up transaction to the destination contract
- handle retries and race conditions centrally
That makes the reward path harder to operate, easier to break, and less trust-minimized.
ProtoMon is a reactive onchain roguelite dice battler:
- players fight a boss with Yahtzee-style dice slots
- the web client provides fast, optimistic battle UX
- the origin contract is the source of truth for turn settlement
- a Reactive Contract listens for
GameWonand automatically emits the destination callback workflow - the destination contract records the badge reward execution
The intended result is a full gameplay loop where battle outcome becomes an onchain event, and the reward side-effect happens automatically from that event.
This repository uses Reactive Contracts as an actual workflow layer, not as a passive deployment target.
contracts/origin/ProtoMonGame.sol
- starts a battle session with
startGame(...) - settles turns with
playTurn(...) - emits
TurnPlayed - emits
GameWonon victory
contracts/reactive/ProtoMonReactiveBadge.sol
- listens for the origin-side
GameWonevent - validates origin chain / contract / topic inputs
- emits the callback request toward the destination reward contract
contracts/destination/ProtoMonBadge.sol
- accepts the callback via
reactiveMint(...) - validates callback sender and authorized Reactive identity (
rvmId) - prevents duplicate reward execution per
gameId - records reward completion and emits
BadgeMinted
This reactive step is the core eligibility point for the hackathon submission: the reward execution is driven by an observed EVM event, not by a manual operator action.
- Web app:
web/- Next.js App Router frontend
- wallet connection via RainbowKit / wagmi
- battle UI, optimistic local state, and API route handlers
- Backend game session layer: inside
web/app/api/game/*- authoritative roll / reroll session state
- dealer proof generation
- Redis-backed session persistence
- Contract layer
- Origin:
ProtoMonGame - Reactive:
ProtoMonReactiveBadge - Destination:
ProtoMonBadge
- Origin:
- Deployment / testing
- Foundry scripts in
script/ - Solidity tests in
test/ - TS/Solidity parity checks in
web/tests/scoring-parity.test.ts
- Foundry scripts in
- Origin: Ethereum Sepolia (
11155111) - Reactive: Reactive Lasna (
5318007) - Destination: Ethereum Sepolia (
11155111)
| Layer | Contract | Address |
|---|---|---|
| Origin | ProtoMonGame |
0x743aAd4ab89EaE037Fce8f69bB8e0937B566C9f1 |
| Reactive | ProtoMonReactiveBadge |
0xD58e8A8f8BB05badDc2D5fe9AC1957d1e1aa90cE |
| Destination | ProtoMonBadge |
0x34bF4ce1CF676c540fd931B5b4E2012E84ebcDb4 |
| Destination auth | authorized rvmId |
0x1662C438F7ACEC993993607fC963e279136acEd6 |
The intended deployed workflow is:
- the frontend creates a game session and starts the origin-side game
- the backend finalizes the current turn and returns a dealer proof
- the frontend submits
playTurn(...)toProtoMonGame ProtoMonGameupdates state and emitsTurnPlayed- on victory,
ProtoMonGameemitsGameWon ProtoMonReactiveBadgereacts toGameWon- the Reactive callback reaches
ProtoMonBadge.reactiveMint(...) - the destination contract records the reward and emits
BadgeMinted
For deployment order and env requirements, see docs/deployment-workflow.md.
| Step | Network | Transaction Hash |
|---|---|---|
Deploy ProtoMonGame |
Ethereum Sepolia | 0x05c25503d28f1cef762424d54c11aea1e57f32ba121ea00f0e9cb6f9f963052 |
Deploy ProtoMonBadge |
Ethereum Sepolia | 0xaac37388f09032e636aef4dfc4db2178defec4e72e5052b0a4a9d1cd9af9f36ca |
Deploy ProtoMonReactiveBadge |
Reactive Lasna | 0x0ee3a7e04bfad6c99594db858ab7c58aac1dbd3f9dffad46bc77b9ef7be34e8d |
setAuthorizedRvmId(...) |
Ethereum Sepolia | 0x25028338ad4d1ec67644afed18483c9794d90691ec3dd4e3d34c253dd230dc5f |
The following live workflow transactions have been confirmed onchain:
| Workflow Step | Status | Transaction Hash |
|---|---|---|
One successful startGame(...) |
Confirmed | 0x645a4194005341e80087cb7de8e3bd8359980c5ba9c65ce8d87b8d960ef4b062 |
One successful playTurn(...) |
Confirmed | 0x4b5f6fbb0f0d125cfdd2a7fb015f9ca0e249b912c6073073dc6bd065cb66de02 |
| One Reactive callback transaction | Confirmed | 0xef81ed4d730b68624e0c1a881d09cb5fe17b3c1682274d076d71c952229ad43 |
One destination reward execution / reactiveMint(...) |
Confirmed | 0xbefc88d8c8f45f22b68a6b4b5edf7cb1686eec2b54acfd4ff4677ee5271a5112 |
ProtoMon-Yahtzee/
├── contracts/
│ ├── destination/
│ │ └── ProtoMonBadge.sol
│ ├── origin/
│ │ └── ProtoMonGame.sol
│ └── reactive/
│ └── ProtoMonReactiveBadge.sol
├── docs/
│ ├── contract-code-review.md
│ ├── deployment-workflow.md
│ ├── parity-workflow.md
│ └── testing-plan.md
├── script/
│ ├── deploy-origin.s.sol
│ ├── deploy-destination.s.sol
│ ├── deploy-reactive.s.sol
│ └── set-destination-rvm-id.s.sol
├── test/
│ ├── ProtoMonBadge.t.sol
│ ├── ProtoMonGame.t.sol
│ └── ProtoMonReactiveBadge.t.sol
└── web/
├── app/
├── components/
├── lib/
├── public/
└── tests/
- Node.js 20+
- pnpm
- Foundry
- Redis or Upstash Redis credentials for backend session storage
git clone <YOUR_FORK_OR_REPO_URL>
cd ProtoMon-Yahtzeeforge testcp web/.env.example web/.env.local
cd web
pnpm installKey values in web/.env.local:
NEXT_PUBLIC_PROTO_MON_GAME_ADDRESS=0x743aAd4ab89EaE037Fce8f69bB8e0937B566C9f1
NEXT_PUBLIC_CHAIN_ID=11155111
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=YOUR_WALLETCONNECT_PROJECT_ID
BACKEND_DEALER_PRIVATE_KEY=YOUR_PRIVATE_KEY
NEXT_PUBLIC_ETH_SEPOLIA_RPC_URL=YOUR_RPC_URL
# Choose one backend session store
# REDIS_URL=redis://127.0.0.1:6379
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=For the current stable local path:
- use the standard wallet sender flow
- keep Redis local if possible for faster iteration
- treat AA/session-key envs as experimental until Pimlico access is fully available
If you want the most stable current local setup, set:
NEXT_PUBLIC_AA_ENABLED=falsecd web
pnpm dev# from repo root
forge test
# from web/
pnpm test
pnpm test:parity
pnpm lint
pnpm build- deployed origin / reactive / destination contracts
- deployment scripts and handoff docs
- Solidity tests for all three contract layers
- TS/Solidity scoring parity checks
- web battle UI with origin contract settlement wiring
- local Redis support for faster development
- production-ready ERC-4337 session-key UX
- final NFT-standard reward contract upgrade, if required beyond reward recording
This section maps the current repository to the hackathon requirements.
| Requirement | Status | Notes |
|---|---|---|
| Effective use of Reactive Contracts | Ready | ProtoMonReactiveBadge reacts to origin events and drives destination reward execution. |
| Full contract code included | Ready | Origin, Reactive, Destination contracts and scripts are in the repo. |
| Origin contract included | Ready | contracts/origin/ProtoMonGame.sol is included. |
| Deployed contract addresses disclosed | Ready | Addresses are listed in this README. |
| Problem and solution explained | Ready | See the Problem / Solution sections above. |
| Post-deployment workflow described | Ready | See the workflow section above. |
| Complete workflow tx hashes attached | Ready | Deployment and live workflow tx hashes are attached in the transaction records section above. |
| Demo video attached | Ready | Public demo video link is attached near the top of this README. |
- David — Design & Full-Stack
- Swen — Smart Contracts & Reactive Workflow
- Reactive Network for the reactive execution model
- Foundry for the Solidity development workflow
- Next.js, wagmi, viem, and RainbowKit for the web stack
- OpenZeppelin and the broader Ethereum tooling ecosystem
This project is released under the MIT License.
