W3

Smart Contract Demo Lab

web3.nasirovpe.com

Projects/Solidity Lottery Smart Contract

Simulated demo

Solidity Lottery Smart Contract

A learning-focused Ethereum lottery contract with fixed entry fee, minimum players, manager-only winner selection, events, ETH payout, and security notes about insecure randomness.

SolidityHardhatPayableEvents

What this demonstrates

A simple on-chain lottery pattern: players enter with a fixed fee, a manager picks a winner, and the pool is paid out.

Key Solidity concepts

  • Payable functions and ETH balance handling
  • Arrays of addresses and player tracking
  • Events for transparent state changes
  • Access control (manager-only actions)

Demo scope

The panel below simulates entries and winner selection in the browser only. No wallet, RPC, or blockchain is involved.

Educational contract; not audited. On-chain randomness from block data is insecure for production—use VRF or similar in real deployments.

Entry fee

0.01 ETH

Players

2

  • 0x0000000000000000000000000000000000000065
  • 0x00000000000000000000000000000000000000ca

Activity log

  • Lottery pool initialized (simulation).

Key features

  • Fixed entry fee and minimum player threshold
  • Manager-controlled winner selection flow
  • Event-driven state updates for transparency
  • Educational notes on randomness risks