Livestream Server¶
The 24/7 automated raffle system.
Overview¶
Located at apps/livestream/server, this Node.js daemon runs continuously to:
- Schedule hourly raffles
- Snapshot token holders
- Select winners via TEE randomness
- Transfer NFTs to winners
- Post announcements to social media
Key Components¶
Core (core/)¶
- agent.ts - Main application initialization
- scheduler.ts - Cron-based raffle scheduling
- websocket.ts - WebSocket server for stream overlay
Raffle (raffle/)¶
- manager.ts - Complete raffle lifecycle orchestration
- selection.ts - Winner selection with TEE randomness
- snapshot.ts - Token holder snapshots via RPC
Twitch (twitch/)¶
- chat-monitor.ts - Free entry system for legal compliance
Social (social/)¶
- twitter.ts - Winner announcements
Running Locally¶
Environment Variables¶
Required variables in .env:
HELIUS_RPC_URL- Solana RPC endpointMISS_TOKEN_MINT- $MYS token mint addressAGENT_WALLET_PRIVATE_KEY- Agent wallet for signingTEE_RANDOMNESS_ENDPOINT- TEE randomness service URLTEE_VAULT_ENDPOINT- TEE vault service URLTEE_VAULT_API_KEY- Vault service authentication
Raffle Cycle¶
- Snapshot token holders at :00
- Open 5-min free entry window on Twitch
- Generate verifiable random seed via TEE
- Select winner (token holders + chat entries)
- Transfer NFT to winner via TEE vault
- Announce winner on Twitter
Next Steps¶
- Miss AI - Conversational agent
- Randomness TEE - TEE randomness service