Your onchain game doesn’t need to be slow We built Monad2048 - a fully onchain version of 2048 - to show how to build fast and button-mashable gameplay while keeping all game logic on chain If you're building responsive, high-throughput dapps, this thread is your blueprint 🧵
Cast image embed
Monad avatar
Monad2048 runs entirely onchain: every move is a transaction and is validated by a smart contract. No servers involved. Play the game at 2048.monad.xyz and read about the build process at
Monad 2048
2048.monad.xyz
Monad 2048
2048: A Guide to Building High Performance Games on Monad
blog.monad.xyz
2048: A Guide to Building High Performance Games on Monad
6
28
122
Monad avatar
We aimed to prevent cheating while keeping moves instant. A deterministic seed generates new tiles, discouraging cheating without slowing gameplay. Here’s how we designed it. Contracts:
GitHub - monad-developers/2048-contracts: Smart contracts that let you play a game of 2048 entirely onchain on Monad testnet.
github.com
GitHub - monad-developers/2048-contracts: Smart contracts that let you play a game of 2048 entirely onchain on Monad testnet.
1
4
35
Monad avatar
The Monad2048 contract stores the 4x4 board in one uint256. Each tile’s value is encoded in 8 bits. This function reads a tile’s value:
Cast image embed
1
3
30
Monad avatar
Gameplay works in two steps: 1. startGame: Submit four initial boards to begin, and a seed. 2. play: Submit a move and the resultant board. The seed is used in a deterministic formula to determine where new tiles spawn upon new moves.
1
3
20
Monad avatar
The frontend uses Privy for creating player wallets, which avoids repeated popup confirmation for each move. We update the interface instantly after a move, sending transactions in the background. If a transaction fails, we revert to the last valid board.
1
1
20
Monad avatar
For rapid transactions, we manage nonce locally and avoid unnecessary RPC calls (e.g. in simulations). Transactions are signed with viem but sent directly to the RPC. This prevents large delays between client and chain state. To skip simulations safely, test client transaction inputs beforehand.
1
2
17
Monad avatar
Errors are handled by resetting to the last valid board and showing a notification. We store failed boards and pick the lowest-scoring one to resume. We allow to player to re-sync their board and resume their game by fetching the latest board from the smart contract.
1
3
16
Monad avatar
The key takeaway is to explore how you can eliminate latency in your code, wherever possible. Use techniques like optimistic UI updates, re-syncing with chain state, etc. Monad Testnet blocks are as fast as the blink of an eye; strive to make your app updates at least as fast.
1
3
18
Monad avatar
Full blog post here:
2048: A Guide to Building High Performance Games on Monad
blog.monad.xyz
2048: A Guide to Building High Performance Games on Monad
2
3
19
Nounish Prof ⌐◧-◧🎩 avatar
Stuck here — it’s not recognizing my wallet
Cast image embed
1
1
YES2Crypto 🎩 🟪🟡 avatar
It says to login via google. Will there be a "login w/Farcaster". I would rather not use google.
4
9
mistershot🧬 avatar
Same here!
Ake  🧬 avatar
Cool & many ideas for gaming, rewards, and gamification options... works fine...sure will be soon connected to warplet and other wallets...
Cast image embed
1
6
mistershot🧬 avatar
How you connected your wallet? Is it possible after connecting with google?
3
Ake  🧬 avatar
no, that's why I wrote hope will be added...as it's a first test and you get test tokens directly from faucet to play the game
1
ABUNABIL.base.eth avatar
We need this game as a mini app on Warpcast
2
ASM🟪 avatar
Gmonad
1
Ifewasabi avatar
Niceee really wish it was available as a mini app on Warpcast though
1
Renatov avatar
Building together!
1
galdino avatar
So fast, but I’m noob lmao
Cast image embed
1
pmonad avatar
on it! @monad
Faizal avatar
I love this game
Arsenelupin0.base.eth avatar
Monad is everything
Stan ☯︎ avatar
Love 2048
Ibrahim Alhassan avatar
Lfg! Gmonad