Protocol Architecture & Flow
Learn how TicketFi guarantees safety, verifiable randomness, and instant reward distribution via Solana smart contracts.
1. Room Initialization
Admin spawns room with designated Prize Target & Platform Fee
2. Ticket Purchase Flow
Users buy tickets; SOL or USDC escrows in Vault PDA
3. Switchboard TEE VRF Commit
Request randomness with commit-reveal protocol
4. Settle & Distribute Payouts
Winner gets Prize, remaining fee splits to Treasury & Stakers
Simulator Stage • 1. Room Initialization
The administrator invokes initialize_raffle_room specifying a winner prize target (e.g., 10.00 SOL or USDC equivalent for RWA / BTC rooms). The program configures the platform fee on top, setting the total vault collection target (e.g., 14.00 SOL). The unique Room Vault PDA is derived as an isolated escrow for this room.
Deep Technical Protocol Specifications
Understand the exact on-chain mathematical structures, validation rules, and escrow designs behind TicketFi.
Event Room PDA
Each event chamber is a Program Derived Address (PDA) holding the room configuration, status details, pricing, and ticket sales logs.
["room", room_id.to_le_bytes()]- Saves current tickets count on-chain.
- Ensures isolation of room indices.
- Calculates the vault PDA authority.
Escrow Vault PDA
A unique system account containing the SOL deposited during ticket purchases. The smart contract has sole authority to claim or distribute funds.
["vault", raffle_room_key.as_ref()]- Completely isolates room escrow funds.
- Never stores funds in a shared admin account.
- Only unlocked atomically on `settle_draw`.
Ticket PDA
Each ticket purchased creates a deterministic account holding the user's key. This represents a literal ticket leaf in the room's draw pool.
["ticket", room_key.as_ref(), ticket_index.to_le_bytes()]- Registers buyer public key & timestamp.
- Validated on-chain during settle verification.
- Index matches Switchboard raw random index.
