Full Game Dojo telegram SDK SDK A fully on-chain memory card matching game built on Starknet using the Dojo framework, integrated with Telegram Mini Apps for seamless user experience through Account Abstraction. Team 3/ Memorabilia Link https://github.com/Talent-Index/memorabilia Play the game on telegram : https://t.me/memorabilia_game_bot/memorabilia_game
A fully on-chain memory card matching game built on Starknet using the Dojo framework, integrated with Telegram Mini Apps for seamless user experience through Account Abstraction. The game features a custom Dojo Telegram SDK that enables gasless transactions and real-time game state updates.
- Install dependencies:
# Install frontend dependencies
cd frontend
npm install
# Install SDK dependencies
cd ../dojo-telegram-sdk
npm install- Start the game:
# Run in demo mode (no contracts required)
./scripts/run_local_demo.sh --demoFor full blockchain mode, see DEPLOYMENT_GUIDE.md for contract deployment steps.
- Project: @memorabiliadojo
- Ahmed @ahmedabdikadir914 - ahmedabdikadir914@gmail.com
- Leonard @tweenhaven35 - tweenhaven35@gmail.com
- Daniel @mwihoti - DanielMwihoti@gmail.com
- Kelly @gakikelly - gakikelly403@gmail.com
- Peter Maina @mainapeter - mainapeterkanyuki@gmail.com
- Rosemary @rozypopyl - Rozypopyl6@gmail.com
- Memory card matching game with multiple difficulty levels
- Real-time game state updates via Torii indexer
- Gasless transactions using Account Abstraction
- Telegram Mini App integration
- Custom Dojo Telegram SDK for easy integration
- On-chain leaderboard and achievements
- Smart Contracts: Cairo (Dojo framework)
- Frontend: React + Vite + Tailwind
- Blockchain: Starknet (Katana for local development)
- Integration: Telegram Mini Apps API
- SDK: Custom Dojo Telegram SDK
- Indexing: Torii for real-time updates
- Greeting System: Proof-of-concept for gasless interactions
memorabilia/
├── src/
│ ├── models/ # Data models
│ │ ├── user_account.cairo
│ │ ├── game_state.cairo
│ │ ├── card.cairo
│ │ ├── leaderboard.cairo
│ │ └── session_policy.cairo
│ ├── systems/ # Game systems (smart contracts)
│ │ ├── account_registry.cairo
│ │ ├── game_system.cairo
│ │ ├── greeting_system.cairo
│ │ └── leaderboard_system.cairo
│ ├── utils/ # Utility functions
│ │ ├── card_generator.cairo
│ │ ├── random.cairo
│ │ └── scoring.cairo
│ └── tests/ # Test suite
├── scripts/
│ └── deploy.sh # Deployment script
└── Scarb.toml # Project configuration
-
Install Dojo (v1.0.0-alpha.6 or later)
curl -L https://install.dojoengine.org | bash dojoup -
Install Scarb (Cairo package manager)
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh
-
Clone the repository:
git clone <repository-url> cd memorabilia
-
Build the project:
sozo build
-
Run tests:
sozo test
-
Start a local Katana node (Starknet devnet):
katana --disable-fee
-
In another terminal, deploy the contracts:
chmod +x scripts/deploy.sh ./scripts/deploy.sh katana
-
Note the world address from the deployment output
- Register Account: Authenticate via Telegram and create on-chain account
- Start Game: Choose difficulty level (Easy/Medium/Hard)
- Play: Flip cards to find matching pairs
- Win: Match all pairs to complete the game
- Compete: Your score is submitted to the global leaderboard
Your score is calculated based on:
- Base Score: 10,000 points
- Difficulty Multiplier:
- Easy: 10x (1,000 bonus)
- Medium: 15x (1,500 bonus)
- Hard: 20x (2,000 bonus)
- Time Bonus: Faster completion = higher score
- Move Penalty: Extra moves reduce your score
Star Ratings:
- ⭐⭐⭐ 3 Stars: Within 10% of optimal moves
- ⭐⭐ 2 Stars: Within 50% of optimal moves
- ⭐ 1 Star: Completed
// Register new account
register_account(telegram_id, owner_public_key, session_public_key) -> ContractAddress
// Update session key
update_session_key(telegram_id, new_session_key)
// Get account info
get_account(telegram_id) -> UserAccount// Start new game
start_game(difficulty: u8) -> u32 // Returns game_id
// Flip a card
flip_card(game_id: u32, card_index: u8)
// Check if flipped cards match
check_match(game_id: u32) -> bool
// Get game state
get_game(game_id: u32) -> GameState
// Abandon game
abandon_game(game_id: u32)// Submit score after game completion
submit_score(game_id, telegram_id, score, difficulty, moves, time)
// Get leaderboard entry by rank
get_leaderboard_entry(rank: u32) -> LeaderboardEntry
// Get player statistics
get_player_stats(player: ContractAddress) -> PlayerStats
// Get player's current rank
get_player_rank(player: ContractAddress) -> u32// Set greeting message (gasless transaction demo)
set_greeting(message: ByteArray)
// Get greeting
get_greeting(user: ContractAddress) -> ByteArrayRun the full test suite:
sozo testRun specific test file:
sozo test test_game_system- ✅ Game System: Start game, flip cards, match checking, win conditions
- ✅ Account Registry: Registration, session keys, policies
- ✅ Leaderboard: Score submission, rankings, player stats
- ✅ Utilities: Card generation, shuffling, scoring
Memorabilia uses Account Abstraction to provide a seamless user experience:
- Telegram Authentication: Users authenticate via Telegram
- Account Creation: On-chain account is created automatically
- Session Keys: Temporary keys for gasless transactions
- Session Policies: Define allowed contracts and methods
- Gasless Gaming: Players don't need to manage gas fees
./scripts/deploy.sh katana./scripts/deploy.sh sepolia./scripts/deploy.sh mainnet- Telegram ID (key)
- Owner public key
- Session public key
- Account address
- Activity tracking
- Game statistics
- Game ID (key)
- Player address
- Difficulty level
- Card array
- Match tracking
- Score and timing
- Card ID
- Value (for matching)
- Flip state
- Match state
- Position
- Rank (key)
- Player info
- Score details
- Game metadata
- Total games
- Win statistics
- Best scores
- Performance metrics
- Models: Define data structures stored on-chain
- Systems: Smart contracts containing game logic
- Utils: Helper functions for calculations
- Tests: Comprehensive test coverage
- Define models in
src/models/ - Implement systems in
src/systems/ - Add utilities in
src/utils/ - Write tests in
src/tests/ - Update
src/lib.cairoto include new modules
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
- Sprint 1: Account Abstraction & Authentication
- Sprint 2: Core Game Logic
- Sprint 3: Leaderboard System
- Sprint 4: Telegram Mini App Integration
- Sprint 5: Advanced Features (Power-ups, Tournaments)
- Sprint 6: NFT Rewards & Achievements
- NFT Rewards: Mint NFTs for achievements
- Tournaments: Competitive events with prizes
- Power-ups: Special abilities during gameplay
- Social Features: Challenge friends, share scores
- Multiple Themes: Different card designs
- Daily Challenges: Special game modes
Built with ❤️ using Dojo on Starknet