Project Overview

The client approached us with the goal of building a high-performance, Telegram Mini App that seamlessly bridges social interaction with decentralized finance. The platform was designed as a fully integrated Multichain Crypto Raffle Platform, enabling users to participate in crypto raffles and physical prize draws directly within the Telegram interface. By using multiple blockchain networks — Solana, BNB Chain, and Base — the platform lets users move between features seamlessly, without needing external wallets or jumping between different services.

A distinctive aspect of this project was its unconventional starting point: a significant portion of the initial codebase had been generated using AI tools. While this accelerated early development, it introduced critical challenges in terms of code quality, security, and production readiness. Our team took ownership of this AI-generated foundation, conducting a comprehensive audit, refactoring core components, and reinforcing the architecture to meet the strict requirements of a live financial application.

Particular focus was placed on ensuring system stability during the transition from prototype to production. This meant carefully checking how the raffle works, making sure all fund transactions are secure, and fixing even rare edge-case issues that could put users’ money at risk. The end result is a robust, scalable Blockchain Social Gaming Platform capable of operating reliably in a high-stakes, real-money environment.

Region: United Kingdom

Industry: Social Gaming & Prize Competition Ecosystem

Timeline: 2.5 Weeks

Challenges

Building this multichain social gaming and automated raffle platform came with a number of technical and operational challenges that had to be addressed to ensure security, scalability, and a smooth launch into production.

  • Refining AI-Generated Foundations: While AI tools accelerated initial development, the generated code required deep auditing, restructuring, and optimization to meet production-grade security standards and properly handle financial edge cases.
  • The “Go-Live” Hurdle: Transitioning from an AI-assisted prototype to a stable, live environment demanded rigorous validation of raffle logic and transaction flows to eliminate any risk of user fund loss during launch.
  • Web3 Accessibility: Simplifying user onboarding across multiple blockchain networks — Solana, BNB Chain, and Base — while maintaining a seamless in-app experience within Telegram.
  • Non-Custodial Security: Designing a system where users retain full control over their private keys through secure, encrypted export mechanisms without exposing the platform to unauthorized withdrawals.
  • Complex Economic Logic: Implementing automated, cross-chain fund distribution logic to accurately allocate revenues between prize pools, loyalty jackpots, and platform shares in real time.

Our Solution

To transform the AI-generated prototype into a production-ready system, we implemented a scalable three-tier architecture that combines a resilient backend, a user-friendly Telegram Mini App, and a secure multichain infrastructure. This approach allowed us to stabilize the core logic, enhance performance, and ensure the platform could reliably operate in a real-money environment.

At the foundation, we conducted a comprehensive audit of the AI-generated codebase, significantly refining the Python-based Telegram bot responsible for real-time interactions. Particular attention was given to improving stability, handling edge cases, and ensuring the accuracy of dynamically generated visuals such as jackpot progress indicators and win notifications. This hardening phase was critical to making the system production-ready.

The onboarding experience was streamlined through one-click wallet creation using Privy, enabling users to instantly access both Solana and EVM-compatible wallets. On the frontend, we integrated a Next.js 14 Mini App to support complex Web3 Raffle Ecosystem interactions requiring a visual interface: to maintain a non-custodial model, we implemented HPKE encryption (ChaCha20-Poly1305), allowing users to securely export their private keys while ensuring that sensitive data is never stored server-side. The interface unifies asset management across BNB Chain and Base, delivering a seamless cross-chain experience.

Finally, we engineered an automated economic engine that governs the entire raffle lifecycle. Draws are triggered autonomously once ticket thresholds are met on each chain, eliminating the need for manual intervention. In parallel, a loyalty system powered by a “chip” mechanism tracks user activity across all supported networks, contributing to a weekly cross-chain jackpot that enhances engagement and retention.

Key Features

  • Multichain Compatibility: Full support for Solana (Ed25519) and EVM-based networks (secp256k1), including BNB Chain and Base.
  • 2-Tier Referral System: Deep-link referral engine that rewards users with bonus “chips” for both direct and indirect invitations.
  • Physical Prize Module: Custom logic for non-crypto raffles (e.g., cars, gadgets), where the majority of ticket revenue is allocated to cover physical asset costs.
  • Win-Back Automation: A retention mechanism that incentivizes inactive users with increased entry multipliers after the pre-configured amount of days of inactivity.
  • Advanced Admin Bot: Dedicated Telegram-based interface for managing raffle parameters, adjusting ticket pricing, and exporting financial reports.
  • Security Guardrails: We added built-in protections such as daily withdrawal limits, rate limiting, and secure session verification (HMAC-SHA256) to keep user funds safe and maintain the integrity of the platform.

Technology Stack

We selected a reliable and scalable technology stack to support high-performance interbank settlements, secure blockchain operations, and seamless integration with traditional banking infrastructure.

Backend

  • Python 3.10+, python-telegram-bot

Frontend

  • Next.js 14, TypeScript, Tailwind CSS

Blockchain

  • solana-py, Web3.py, solders, eth-account

Wallet/Auth

  • Privy (Embedded Wallets), @hpke/core

Database

  • PostgreSQL (Supabase)

Security

  • HMAC-SHA256, ChaCha20-Poly1305 Encryption

Media Generation

  • Pillow (PIL) for dynamic jackpot and win images

Team

  • Project Manager: Oversaw the transition from prototype to production and managed the go-live roadmap.
  • Fullstack/Blockchain Developer: Refined the existing AI-generated codebase, developed Telegram bots, and secured the cross-chain wallet infrastructure.
  • DevOps Engineer: Designed the deployment pipeline and cloud infrastructure to ensure a stable, high-availability launch.
  • QA Engineer: Performed thorough functional and security testing, with a focus on validating financial logic and ensuring accurate payouts across all three supported chains.

Results

The final platform delivered measurable improvements in performance, usability, and reliability, successfully meeting the demands of a live Web3 Raffle Ecosystem:

  • Successful Launch: Despite the challenges of refining AI-generated code, the platform went live smoothly, ensuring a stable environment for real-money crypto raffles.
  • Frictionless Onboarding: Users can start participating in blockchain raffles in seconds without external wallet extensions through one-click wallet creation using Privy.
  • Complete Transparency: Every transaction and raffle result is verifiable via blockchain explorers such as Solscan, BscScan, and BaseScan.
  • Autonomous Operation: The system fully automates the raffle lifecycle — from ticket sales to prize distribution — enabling continuous 24/7 operation with minimal manual oversight.

Get in Touch with Us

Please enter your name.
Please enter a subject.
Please enter a message.
Please agree to our Terms and Conditions and the Privacy Policy.

This site uses technical cookies and allows the sending of 'third-party' cookies. By continuing to browse, you accept the use of cookies. For more information, see our Privacy Policy.