Arch Lottery is a local development stack for the Arch Network, featuring a sample Lottery smart contract. This project helps developers experiment with Arch Network transactions, UTXO handling, and smart contract execution in a test environment.
Before getting started, ensure you have the following installed:
- Rust (latest stable version)
- Docker (for local Arch Network deployment)
- C++ Compiler (
gccorclang) - Solana CLI (for Solana-compatible tooling)
⚡ Optional: You can use VS Code or another IDE for Rust development and debugging.
The Arch Lottery example demonstrates a simple Raffle smart contract on the Arch Network. You can also explore the smart contract code here: arch-lottery-smart-contract/examples/raffle
- Clone the repository
git clone https://github.com/2-rust/arch-lottery.git
cd arch-lottery- Build the Lottery program
cargo build-sbfThis compiles the Rust smart contract into SBF (Solana Binary Format) for local execution.
- Run tests / execute transactions
# Return to the raffle directory and run test
cd .. && cargo test -- --nocaptureThis simulates a lottery transaction on the local Arch Network, showing program execution, account updates, and UTXO handling.
arch-lottery/
├─ examples/raffle/ # Sample lottery smart contract
├─ local-network/ # Scripts for spinning up local Arch testnet
├─ Cargo.toml # Rust project configuration
└─ README.md # Documentation
- Lottery Smart Contract: Handles entry, winner selection, and payout logic.
- Arch Network Local Stack: Simulates blockchain environment locally using Docker and Rust programs.
- UTXO Model: Each transaction updates unspent outputs, ensuring accurate state management.
- Modify the raffle smart contract to add custom logic (e.g., weighted entries, multiple winners).
- Experiment with transactions on the local network.
- Integrate frontend or CLI to interact with the Lottery smart contract.
- Deploy on a testnet when ready.