|
| 1 | +# ADR-0004: Use Soroban (Stellar) Over EVM-Compatible Chains |
| 2 | + |
| 3 | +**Date:** 2025-07-24 |
| 4 | +**Status:** Accepted |
| 5 | +**Deciders:** StellarHunts core team |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +StellarHunts awards on-chain NFT badges when players complete puzzle |
| 12 | +levels. The team needed to select a smart-contract platform to host: |
| 13 | + |
| 14 | +1. **Game contract** — question lifecycle, answer validation (SHA-256), |
| 15 | + player level progression. |
| 16 | +2. **NFT badge contract** — per-level badge minting with role-gated |
| 17 | + authorization. |
| 18 | + |
| 19 | +The two primary candidates were **Soroban on Stellar** and an |
| 20 | +**EVM-compatible chain** (Ethereum mainnet, Polygon, or Base). |
| 21 | + |
| 22 | +| Criterion | Soroban / Stellar | EVM (Ethereum / Polygon) | |
| 23 | +|-----------|-------------------|--------------------------| |
| 24 | +| Transaction fees | Sub-cent on Stellar | Variable (gwei spikes on mainnet; low on L2s) | |
| 25 | +| Finality | ~5 s (Stellar consensus) | ~12 s ETH / ~2 s Polygon | |
| 26 | +| Smart contract language | Rust (soroban-sdk) | Solidity / Vyper | |
| 27 | +| Tooling maturity | Growing (Stellar CLI, soroban-cli) | Very mature (Hardhat, Foundry, OpenZeppelin) | |
| 28 | +| NFT standards | Custom (no ERC-721 equivalent yet) | ERC-721 / ERC-1155 well established | |
| 29 | +| Wallet ecosystem | Freighter, Lobstr, Albedo | MetaMask, WalletConnect (broad) | |
| 30 | +| Developer community | Smaller, niche | Large, extensive resources | |
| 31 | +| Educational alignment | Matches project's Stellar-learning theme | Generic blockchain knowledge | |
| 32 | + |
| 33 | +The project's **educational mission** is to teach players about |
| 34 | +blockchain technology — specifically the Stellar ecosystem. Using Soroban |
| 35 | +keeps the on-chain layer consistent with the subject matter being taught. |
| 36 | + |
| 37 | +## Decision |
| 38 | + |
| 39 | +StellarHunts uses **Soroban smart contracts on the Stellar network** for |
| 40 | +all on-chain game logic and NFT badge minting. |
| 41 | + |
| 42 | +- Contracts are written in **Rust** using `soroban-sdk 22.x`. |
| 43 | +- The workspace lives in `onchain/` with a Cargo workspace manifest. |
| 44 | +- Two production contracts exist: |
| 45 | + - `stellar_hunts` — game logic |
| 46 | + - `stellar_hunts_nft` — badge minting |
| 47 | +- Local development and CI use Stellar Testnet; |
| 48 | + `STELLAR_MODE=mock` allows the backend to run without a live network. |
| 49 | +- Answer privacy is preserved on-chain via `env.crypto().sha256()` — |
| 50 | + no plaintext answers are stored in contract state. |
| 51 | + |
| 52 | +## Consequences |
| 53 | + |
| 54 | +### Positive |
| 55 | +- Aligns with the project's educational goal of teaching Stellar/Soroban |
| 56 | +- Very low and predictable transaction fees |
| 57 | +- Fast finality reduces wait time after puzzle completion |
| 58 | +- Rust's type system and Soroban's sandboxed WASM runtime provide strong |
| 59 | + safety guarantees |
| 60 | +- `STELLAR_MODE=mock` lets the backend be developed and tested without |
| 61 | + a live network dependency |
| 62 | + |
| 63 | +### Negative / Trade-offs |
| 64 | +- Smaller developer community means fewer tutorials and third-party |
| 65 | + tooling compared to EVM |
| 66 | +- No standardized NFT interface (ERC-721) — badge ownership queries use |
| 67 | + a custom `has_level_badge` function |
| 68 | +- Freighter wallet has less browser/mobile coverage than MetaMask's |
| 69 | + ecosystem |
| 70 | +- Team members with an EVM background need to learn Rust and the Soroban |
| 71 | + execution model |
0 commit comments