Tycoon is a Monopoly-style board game where players buy, sell, and trade properties, collect rent, build monopolies, and compete for on-chain prizes. Gameplay runs in real time through a web app; stakes, registration, payouts, and rewards are enforced by Soroban smart contracts on Stellar.
| Surface | Description |
|---|---|
| Play vs Humans (PvP) | Create or join a room with a short game code. Optional USDC entry stake. Last player standing wins the pot. |
| Play vs AI | Solo player vs AI opponents. Wallet registration required; no stake. |
| Agent vs Agent | Up to 8 autonomous agents per match. Backend advances turns; agents resolve via callback URL or hosted logic. |
| Arena & Tournaments | Bracket-style competitions with entry fees held in escrow and prizes distributed on-chain. |
| Shop & Perks | In-game collectibles and vouchers redeemable for the TYC reward token or usable as perks (Jail Free, Instant Cash, Lucky 7, etc.). |
| On-chain (Soroban) | Off-chain (backend + DB) |
|---|---|
| Player registration & usernames | Board state, dice rolls, property ownership during play |
| Game create / join / leave (pending) | Turn order, Chance/Community Chest cards, trades |
| USDC stakes & prize payouts | Chat, matchmaking, AI/agent orchestration |
| TYC vouchers & collectibles (NFT-like) | Leaderboards, notifications, tournament brackets |
| Tournament escrow (fees + prize pool) | Anti-cheat, turn validation, set_turn_count for perk eligibility |
| House fee (5%) & rank-based payout math | Socket/WebSocket live updates to clients |
This hybrid model keeps Stellar transactions cheap and fast while preserving trustless money flows.
- Low fees & fast finality — ideal for join/leave, stake, and payout flows.
- Native USDC — Circle-issued USDC on Stellar is a first-class asset for entry stakes and prizes.
- Soroban — Rust/WASM smart contracts with a mature SDK and test harness.
- Wallet ecosystem — Freighter, Albedo, xBull, and WalletConnect-compatible flows via
@stellar/stellar-sdk. - Global reach — Stellar’s payment rails align with mobile-first and remittance-friendly UX.
┌─────────────────────────────────────────────────────────────────┐
│ Next.js Frontend │
│ Board UI · Waiting room · Wallet connect · Tx signing │
│ @stellar/stellar-sdk · Freighter / Albedo / WC │
└───────────────────────────┬─────────────────────────────────────┘
│ REST + WebSocket
┌───────────────────────────▼─────────────────────────────────────┐
│ Node.js Backend │
│ Game engine · Agents · Tournaments · Shop webhooks │
│ Soroban RPC client · Game controller keypair │
└───────────────────────────┬─────────────────────────────────────┘
│ Soroban invoke / submit
┌───────────────────────────▼─────────────────────────────────────┐
│ Stellar / Soroban │
│ Tycoon Game · Reward System · Tournament Escrow · TYC Token │
└─────────────────────────────────────────────────────────────────┘
| Contract | Responsibility |
|---|---|
tycoon_game |
register_player, create_game, join_game, leave_pending_game, exit_game, remove_player (backend-only), set_turn_count, views (get_game, get_user, get_game_by_code) |
tycoon_rewards |
Mint/redeem TYC vouchers, mint/buy/burn collectibles, shop stock, pause/unpause |
tycoon_tournament_escrow |
create_tournament, register, fund_prize_pool, lock, finalize, cancel |
tycoon_token |
TYC issuance (SEP-41-style token interface on Soroban) |
tycoon_lib |
Shared types: GameStatus, GameType, payout tiers, validation helpers |
Payout rules (staked games):
- House: 5% of pot when the winner exits.
- Distributable (95%): Rank 1 → 50%, Rank 2 → 30%, Rank 3 → 20%.
- Top 3: USDC + TYC voucher + random collectible (rank 1 gets higher strength).
- Rank 4+: Consolation TYC voucher only.
min_turns_for_perks: Backend callsset_turn_countonce a player crosses the threshold; voluntary exit uses stored count.
| Asset | Role |
|---|---|
| USDC | Entry stakes, tournament fees, shop purchases, prize pools |
| TYC | Rewards, shop, vouchers, daily bonuses |
USDC uses the canonical Stellar USDC issuer (testnet/mainnet config per environment). TYC is deployed as a Soroban token contract controlled by the reward system and game contracts.
A dedicated Stellar keypair (server-side only) is authorized on-chain to:
remove_player_from_game(game_id, player, turn_count)— vote-out / stall removalset_turn_count(game_id, player, count)— perk eligibility- Tournament
lock/finalize/cancel
All controller transactions are serialized in a single queue to avoid sequence-number collisions under load.
- Next.js (App Router) + TypeScript + Tailwind CSS
@stellar/stellar-sdk— build, sign, and submit transactions@stellar/freighter-api(and optional Albedo) — wallet connection- Soroban contract bindings — generated from contract spec JSON (
soroban contract bindings typescript)
- Connect wallet → derive Stellar public key (G-address).
- Register → sign
register_player(username); receive welcome TYC voucher. - Create game → set players (2–8), stake, public/private + code → on-chain create + backend room.
- Join game → enter code → approve USDC (if staked) →
join_game. - Play → roll, buy, rent, trade, develop via backend; UI updates over WebSocket.
- Win / exit →
exit_gameon-chain; USDC + rewards land in wallet.
A lightweight Minipay-style shell can target Stellar-compatible in-app wallets using the same SDK and deep-link signing patterns.
- Node.js + Express REST API
- PostgreSQL — games, players, trades, tournaments, users
- Soroban RPC —
soroban-rpcon testnet/mainnet stellar-sdkServer — horizon optional for payment history; primary path is Soroban simulation + submission
Central service for all Soroban invokes from the API:
| Env variable | Purpose |
|---|---|
STELLAR_NETWORK |
testnet | mainnet |
STELLAR_SOROBAN_RPC_URL |
Soroban RPC endpoint |
TYCOON_STELLAR_GAME_CONTRACT_ID |
Deployed tycoon_game contract ID (C-address) |
TYCOON_STELLAR_REWARDS_CONTRACT_ID |
Reward system contract ID |
TYCOON_STELLAR_TOURNAMENT_ESCROW_ID |
Tournament escrow contract ID |
TYCOON_STELLAR_TYC_TOKEN_ID |
TYC token contract ID |
STELLAR_USDC_ASSET_CODE / STELLAR_USDC_ISSUER |
USDC trustline params for client hints |
BACKEND_GAME_CONTROLLER_STELLAR_SECRET |
Controller keypair (never commit) |
- REST endpoints unchanged at the HTTP layer (
/api/games,/api/trades,/api/tournaments, …) withchain: "STELLAR"on records. - WebSocket channels for board updates, chat, and waiting-room presence.
- Agent runner polls or subscribes to active Stellar-chain agent games when
ENABLE_AGENT_GAME_RUNNER=true.
- Scaffold Soroban workspace (
cargo install soroban-cli) - Implement
tycoon_libtypes and payout math in Rust unit tests - Deploy
tycoon_token+tycoon_gameto Stellar testnet - CLI scripts: register, create game, join, exit (happy path)
- Backend:
stellarContract.jswith simulated + submitted invokes
- USDC deposit/withdraw in game contract (SEP-41 token transfers)
-
tycoon_rewards: vouchers, collectibles, shopbuy_collectible - Backend:
set_turn_count,remove_player_from_game - Frontend: Freighter connect, register, create/join staked game
- Wire board UI to Stellar wallet hooks and Soroban contract bindings
- Waiting room, property actions, trades (off-chain + socket)
- Victory flow + on-chain prize claim
- Play vs AI registration gate
-
tycoon_tournament_escrowdeploy + bracket finalize - Agent registry (on-chain agent metadata + callback URL)
- Agent vs Agent runner on Stellar chain tag
- Leaderboard & public profiles
- External audit or structured internal review
- Mainnet deploy, multisig admin, contract upgrade policy (if using admin pattern)
- Monitoring: failed invokes, sequence gaps, escrow balance alerts
- Documentation, env templates, runbooks
# Rust + Soroban
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install soroban-cli --locked
# Node.js >= 18
node -v
# Stellar testnet account with XLM for fees (Friendbot on testnet)stellar/
├── contracts/
│ ├── tycoon_game/
│ ├── tycoon_rewards/
│ ├── tycoon_tournament_escrow/
│ ├── tycoon_token/
│ └── tycoon_lib/
├── scripts/
│ ├── deploy_testnet.sh
│ └── invoke_register.sh
└── README.md
cd stellar
soroban contract build
cargo test
soroban contract deploy \
--wasm target/wasm32v1-none/release/tycoon_game.wasm \
--source-account DEPLOYER_SECRET \
--network testnetsoroban contract bindings typescript \
--contract-id <C...> \
--network testnet \
--output-dir ../frontend/lib/stellar/bindings# Backend
cd backend && cp .env.example .env # add STELLAR_* vars
npm install && npm run dev
# Frontend
cd frontend && cp .env.example .env.local
npm install && npm run dev- Secrets: Controller secret key and deployer keys live only in server env / CI secrets — never in the repo.
- Trustlines: Clients must trust USDC issuer and TYC token before receiving payouts.
- Simulation first: Every invoke is simulated via Soroban RPC before submission; surface revert reasons to the UI.
- Admin keys: Use multisig or separate cold admin for
set_backend_controller,pause, and emergency withdraw. - Rate limits: API throttling on create/join to prevent spam rooms.
| Milestone | Done when |
|---|---|
| MVP | Two wallets register, join a staked game on testnet, play to completion, winner receives USDC on-chain |
| Rewards | Top-3 exit receives voucher + collectible; shop purchase works with TYC or USDC |
| Tournament | 4+ players pay entry fee; escrow finalizes prizes to declared winners |
| Agents | Agent vs Agent match runs end-to-end without a browser client |
| Mainnet | Public launch with monitored contracts and documented addresses |
| Contract | Testnet ID | Mainnet ID |
|---|---|---|
| Tycoon Game | C... |
C... |
| Reward System | C... |
C... |
| Tournament Escrow | C... |
C... |
| TYC Token | C... |
C... |
- Soroban documentation
- Stellar developers
- SEP-41: Soroban Token Interface
- Freighter wallet
- Stellar Laboratory — build and inspect transactions
Same as the parent Tycoon repository.