Skip to content

blocklottery/Blocklottery.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlockLottery.net - Decentralized Ecosystem

Welcome to the official repository for blocklottery.net, a production-grade, highly scalable, and secure decentralized lottery ecosystem deployed on the Base Mainnet.

The system utilizes an advanced multi-contract architecture, separating core business logic (Factory/Child Pattern) from the data presentation layer (Renderer Pattern) to maximize gas efficiency and optimize frontend performance.


🏗️ System Architecture Overview

The ecosystem is split into two major layers:

┌────────────────────────────────────────────────────────┐ │ Frontend (DApp UI) │ └───────────────────────────┬────────────────────────────┘ │ Reads Rendered Data / Visuals ▼ ┌──────────────────────────────────────────────────────────────────────────────┐ │ BlockLotteryRenderer (0xEFacB328e28287e11D38f94a838C2A285143A8b9) │ ├──────────────────────────────────────────────────────────────────────────────┤ │ 📝 Formats, aggregates & renders on-chain data/views │ └───────────────────────────┬──────────────────────────────────────────────────┘ │ Queries State & Historical Data ▼ ┌────────────────────────────────────────────────────────────────────────────┐ │ BlockLotteryFactory (0x8454a5aF29f8cD981881Be6960F4bddb4Bd4cf5b)│ ├────────────────────────────────────────────────────────────────────────────┤ │ 🏭 Spawns & controls individual BlockLottery contracts │ └───────────────────────────┬────────────────────────────────────────────────┘ │ Deploys / Manages Instances ▼ ┌────────────────────────────────────────────────────────┐ │ BlockLottery Instance (Child) │ ├────────────────────────────────────────────────────────┤ │ 🎟️ Handles ticket sales, verification, and payouts │ └────────────────────────────────────────────────────────┘

1. Core Engine Layer (BlockLotteryFactory & BlockLottery)

  • Factory Contract: Acts as the central registry and deployer. It spawns independent, isolated BlockLottery game instances dynamically.
  • Customization: Every lottery instance can be customized with dynamic ticket pricing, specific token pools, custom end-times, and reward distributions.
  • Cryptographic Security: Integrates OpenZeppelin's ECDSA library. This ensures that user entries, state transitions, or winner selections are validated using secure, off-chain admin signatures to prevent front-running and exploit vectors.

2. Presentation & View Layer (BlockLotteryRenderer)

  • On-Chain Rendering: Decoupled from the main logic contract to save deployment and execution gas.
  • Data Aggregation: Aggregates multi-contract states, user ticket history, and pool statistics into optimized view functions, significantly reducing RPC node overhead for the web interface.
  • Scalability: Allows the look, metadata structure, or frontend data delivery mechanism to be updated or upgraded without altering the immutable historical lottery data.

🌐 Deployment Details (Base Mainnet)

Contract Name Purpose Contract Address
BlockLotteryFactory Logic Layer / Game Spawner 0x8454a5aF29f8cD981881Be6960F4bddb4Bd4cf5b
BlockLotteryRenderer Presentation Layer / Data Lens 0xEFacB328e28287e11D38f94a838C2A285143A8b9

🛠️ Technical Specifications

  • Language: Solidity 0.8.19
  • Framework Compatibility: Hardhat / Foundry / Remix IDE
  • Dependencies: OpenZeppelin Contracts (Access Control, Cryptography/ECDSA, Enumerable Maps)
  • EVM Target: Base / Paris (Compatible with 0.8.19 compilation targets)

Key Smart Contract Features Implemented:

  • Zero-Trust Admin Validation: Uses cryptographic signature verification to approve operations.
  • Gas-Optimized Loops: Uses EnumerableSet to keep track of generated lotteries safely without hitting gas block limits.
  • Decoupled Architecture: Separation of Concerns (SoC) between state modification and data rendering.

📦 How to Compile & Verify

Both codebases are fully flattened and verified on Blockscout. They contain all required inline dependencies (OpenZeppelin libraries) and can be easily loaded into any IDE.

  1. Copy the source code from the verified explorer tabs into your local files (e.g., BlockLotteryFactory.sol and BlockLotteryRenderer.sol).
  2. Set the compiler version to 0.8.19+commit.7dd6d404.
  3. Enable optimization if matching production deployment metrics.

📜 License

This ecosystem is open-source and licensed under the MIT License.

About

A smart contract factory that deploys customizable, decentralized lottery contracts with flexible entry fees and prize pools using Chainlink VRF system to ensure fair Draw

Topics

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors