Ayinkx/soroban-empires
Acerca de
A fully on-chain turn-based strategy game on Stellar. Soroban smart contracts in Rust, a TypeScript SDK, a React frontend and a Node.js indexer.
Desarrollo web y de aplicacionesCrecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- Recopilando historial
- in 15 days
- Recopilando historial
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Original🌌 Soroban Empires
A fully on-chain strategy game built on the Stellar network. Conquer star systems, mine resources, build fleets, and battle other players — all on-chain, all verifiable, all yours.
🚀 Live on Testnet
The game is deployed and running on Stellar testnet (deployed 12 October 2026, grid size 8×8). You can inspect every contract directly on Stellar Expert:
| Contract | Address | Explorer |
|---|---|---|
galaxy-map |
CBT7KWIY6VGJ7UO4H3EEEJEFEJGFYKBRMORLP6ZZHDIGJNWIIBERQHCD |
View ↗ |
resources |
CCXFTWABMR2464IUGYSCSTHJSLRQY237BXCQLDOOYC7TZR7XGLH47FSL |
View ↗ |
fleet |
CDN4HG6MEGVEON5OXLNBXVISLYA47EFDFI6DWBHS7GNLONGGNBMVXJNF |
View ↗ |
battle |
CDOFURGGF2CCGEKUSWFRMNVA7T25VGOKCQDNJYEP52WYQJUNC65DJXCU |
View ↗ |
Resource tokens (Stellar Asset Contracts, administered by the resources contract so mining only needs the player's signature):
| Asset | Symbol | Contract Address |
|---|---|---|
| Iron | IRON |
CDOA5MBXJUGWT6AJL5AUFSO47VVRGUDWG7AQS2VXJ3G6HMRKUBBLMU33 |
| Energy | NRGY |
CADVDTZWE2XU6YZZLMDZUDV22DCENAJDTZWAJJUJEHVHR5CJAKZ5WUZF |
| Plasma | PLSM |
CDCUCH2UXBHDASSXN2MTW3L4P3ZDL4UAL2YYFI3RI4A6ARACMMOBU3AD |
Network: Test SDF Network ; September 2015 — RPC: https://soroban-testnet.stellar.org
To use these addresses locally, copy .env.testnet into your backend/.env and frontend/.env.
What is Soroban Empires?
Soroban Empires is a turn-based, on-chain strategy game where players compete for control of a procedurally generated galaxy. Every action — claiming a star system, mining resources, building a fleet, initiating a battle — is a transaction on the Stellar blockchain, executed by Soroban smart contracts.
There is no central server controlling game state. No admin key that can alter outcomes. No hidden logic. The galaxy is on-chain, open, and permanent.
Game loop in one sentence: Claim star systems → mine their resources → build fleets → conquer neighbors → dominate the galaxy.
Why Stellar?
- Speed — Stellar finalizes transactions in ~5 seconds. Fast enough for a real game.
- Cost — Transaction fees are fractions of a cent. Players won't be priced out by gas.
- Soroban — A purpose-built smart contract platform with a clean auth model, predictable execution costs, and Rust-based contracts that compile to WASM.
- Native assets — In-game resources are real Stellar assets, not synthetic game tokens. They live on the Stellar DEX and can be traded freely.
- Freighter — Players connect with Freighter, the standard Stellar browser wallet. No new wallet to install for existing Stellar users.
Architecture Overview
┌─────────────────────────────────────────────────────────────────┐
│ Frontend (React) │
│ Freighter Wallet · Vite · TypeScript │
└──────────────────────┬──────────────────┬───────────────────────┘
│ │
Write Path Read Path
│ │
┌──────────────▼──┐ ┌──────────▼──────────────┐
│ TypeScript SDK │ │ Backend API (REST) │
│ (contract calls)│ │ Node.js · Express │
└──────────────┬──┘ └──────────┬───────────────┘
│ │
┌──────────────▼──┐ ┌──────────▼───────────────┐
│ Soroban RPC │ │ PostgreSQL │
│ (Stellar node) │ │ (indexed chain data) │
└──────────────┬──┘ └──────────▲───────────────┘
│ │
┌──────────────▼──────────────────┴───────────────┐
│ Soroban Smart Contracts │
│ galaxy-map · resources · fleet · battle │
└───────────────────────────────────────────────────┘
Write path: Frontend → TypeScript SDK → Soroban RPC → Contracts on-chain
Read path: Frontend → Backend REST API → PostgreSQL (data indexed from chain events)
All game-state mutations happen on-chain. The backend is read-only — it indexes contract events into Postgres for fast queries, leaderboards, and battle history, without the frontend hammering the RPC node.
Smart Contracts
| Contract | Description |
|---|---|
galaxy-map |
Manages the galaxy grid. Tracks star system ownership, coordinates, and attributes. |
resources |
Issues and manages in-game resource tokens (Iron, Energy, Plasma) as Stellar assets. |
fleet |
Handles fleet composition, unit construction, and fleet movement between systems. |
battle |
Resolves combat between fleets using on-chain randomness via Soroban Prng. |
All contracts are written in Rust, compiled to WASM, and deployed to the Stellar network.
Game Mechanics
The Galaxy
The galaxy is a grid of star systems, each with:
- Coordinates (x, y) stored on-chain
- Resource yield — how much Iron, Energy, or Plasma it produces per cycle
- Owner — a Stellar address, or unclaimed (
None) - Defense rating — base defense value, modified by stationed fleet size
Resources
Three resource types, each a native Stellar asset:
| Resource | Symbol | Use |
|---|---|---|
| Iron | IRON |
Fleet construction |
| Energy | NRGY |
Fleet movement & upkeep |
| Plasma | PLSM |
Advanced units & upgrades |
Since they're real Stellar assets, players can trade them on the Stellar DEX, and each player sets up a one-time trustline to hold them (the app offers this after connecting a wallet). Resources are minted by an admin, and owners also mine their systems' yield passively: call resources.mine once per period to collect resource_yield for every full period elapsed since the last claim. The resources contract administers the asset contracts, so mining needs only the player's own signature.
Fleets
Fleets are composed of units, each with attack and defense stats stored in the fleet contract. Players build units by spending resources, then move fleets between adjacent star systems.
Battle
Battle is a separate action from moving — a player explicitly attacks a system owned by someone else by
calling battle.resolve_battle, naming that system's current owner as the defender. There's no location
requirement: an attacker's fleet doesn't need to be at the target system first. The battle contract:
- Reads attacker and defender fleet stats
- Applies combat modifiers (system defense rating, unit types)
- Uses
Prngfor verifiable on-chain randomness - Writes the outcome — winner takes the system, loser fleet is reduced
All battle outcomes are emitted as contract events, indexed by the backend, and queryable via the REST API.
Tech Stack
| Layer | Technology |
|---|---|
| Smart Contracts | Rust · Soroban SDK v22 |
| TypeScript SDK | TypeScript · @stellar/stellar-sdk v17 |
| Frontend | React 18 · Vite 6 · TypeScript |
| Wallet | Freighter (browser extension) |
| Backend | Node.js · Express · TypeScript |
| Database | PostgreSQL |
| Indexer | Soroban event streaming |
| Testing | Vitest · Playwright · axe-core |
| Infra | Docker · Docker Compose |
| CI | GitHub Actions |
Project Structure
soroban-empires/
├── contracts/ # Soroban smart contracts (Rust)
│ ├── galaxy-map/
│ ├── resources/
│ ├── fleet/
│ └── battle/
├── sdk/ # TypeScript SDK
│ └── src/
├── frontend/ # React + Vite frontend
│ └── src/
├── backend/ # Node.js indexer + REST API
│ └── src/
│ ├── indexer/ # Soroban event listener
│ ├── api/ # REST routes
│ └── db/ # Postgres schema & queries
├── scripts/ # Deploy & testnet setup scripts
├── docs/ # Architecture & game mechanics docs
├── .github/ # CI workflows & issue templates
├── docker-compose.yml
├── Cargo.toml # Rust workspace
└── README.md
Getting Started
Prerequisites
- Rust (stable, 1.75+)
- Stellar CLI (
stellarv26+) - Node.js (v20+)
- pnpm (v9+)
- Docker & Docker Compose
- Freighter wallet (browser extension)
1. Clone the repository
git clone https://github.com/Ayinkx/soroban-empires.git
cd soroban-empires
2. Install dependencies
# Install Node.js dependencies (SDK + frontend + backend)
pnpm install
# Install Rust Soroban target
rustup target add wasm32-unknown-unknown
3. Start local infrastructure
docker-compose up -d
This starts a local PostgreSQL instance. The Soroban contracts run on Stellar testnet.
4. Set up testnet & deploy contracts
# Fund a testnet account and deploy all contracts
./scripts/setup-testnet.sh
This script will:
- Create a testnet keypair
- Fund it via Friendbot
- Build and deploy all four Soroban contracts
- Write deployed contract IDs to
.envfiles
5. Start the backend
cd backend
cp .env.example .env # fill in your contract IDs
pnpm dev
6. Start the frontend
cd frontend
pnpm dev
Open http://localhost:5173, connect Freighter, and start claiming star systems.
Running the checks
CI runs the same commands on every push and pull request:
# Formatting and lint (repo root)
pnpm exec prettier --check .
pnpm lint
# SDK, backend and frontend unit tests + type checks
(cd sdk && pnpm test && pnpm exec tsc --noEmit && pnpm run build)
(cd backend && pnpm test && pnpm exec tsc --noEmit)
(cd frontend && pnpm run build && pnpm test && pnpm exec tsc --noEmit)
# Contracts
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test
cargo build --target wasm32-unknown-unknown --release
cargo audit
# Browser tests (Chromium must be installed)
(cd frontend && pnpm exec playwright install chromium)
(cd frontend && pnpm test:e2e)
The backend's full-stack integration test needs Postgres: set INTEGRATION_DATABASE_URL, or have Docker available so it can start the compose service itself.
Contributing
Soroban Empires is actively looking for contributors. Whether you write Rust, TypeScript, or just want to improve documentation — there's a place for you here.
Engineering standards we follow:
- TDD — write the failing test first, then the implementation
- SOLID principles — Single Responsibility above all else
- One function, one job — every function does exactly one thing and its name must describe that thing precisely
Full details in docs/engineering-guidelines.md
Good places to start:
good first issue— Beginner-friendly issues across all layershelp wanted— Larger features open for contributorscontracts— Soroban/Rust issuesfrontend— React/TypeScript issuesbackend— Node.js/indexer issues
Read the full CONTRIBUTING.md before opening a PR.
Documentation
New to the project? Start here:
- Game Mechanics — How the galaxy, resources, fleets, and battles work
- Economy Explainer — Where resources come from and where they go (sources and sinks)
- Testnet vs Mainnet — Network differences, configuration, and fees
- Wallet Setup Troubleshooting — Common Freighter connection issues and fixes
- Engineering Guidelines — Code standards, testing, and architecture
- Architecture — System design and contract relationships
- Mainnet Migration Plan — Roadmap to production launch
Roadmap
- Project architecture & design
-
galaxy-mapcontract — core world state (types, storage,claim_system) -
resourcescontract — resource token issuance (mint, burn, balance) -
fleetcontract — unit management -
battlecontract — combat resolution - TypeScript SDK —
SorobanEmpiresClientRPC setup - SDK — galaxy, fleet, battle, resources modules
- Backend indexer — Soroban event listener
- Backend REST API — full implementation (galaxy, player, fleet, battle)
- Frontend — galaxy map renderer
- Frontend — fleet builder UI
- Frontend — battle log & wallet integration
- Testnet deployment — live, see Live on Testnet above
- Mainnet launch — see Mainnet Migration Plan
License
MIT — free to use, fork, and build on.
Acknowledgements
Built on Stellar and Soroban.
Wallet integration via Freighter.
This project started from Starbound Realms by OlaGreat, used under the MIT License.
Inspired by the vision of a truly on-chain game economy where players own everything.
Explorar proyectos relacionados
Cargando…