stellar-trade README

The project's README from github.com/Stellar-tradehub/stellar-trade. As one markdown file: README.md.

Stellar Trade

A Soroban prediction-market prototype for taking a position on a question and inspecting how it settles. Built on Stellar, the project combines XLM pools, wallet-signed transactions, and contract-enforced payout accounting.

Why Stellar Trade

A poll records what people think. A prediction market records a position against a defined outcome and settles it under published rules. Stellar Trade explores how to make that lifecycle understandable and inspectable: what question is being asked, how much value entered the pool, who can resolve the market, and how the final payout was calculated.

The project is aimed at communities and builders who want a transparent way to aggregate forecasts around ecosystem milestones, public data, or other questions with verifiable resolution criteria. The prototype uses Soroban contracts for the value-bearing rules and Stellar wallets for user authorization. Its goal is to make market mechanics reviewable in code and on the public ledger, while keeping the product honest about what is live and what is still a concept.

Market flow

flowchart LR
    Q[Clear question and close criteria] --> B[Buy YES or NO with XLM]
    B --> P[Pool and fees recorded by Soroban]
    B -->|optional, before close| S[Sell by reducing the position]
    P --> R[Authorized resolver submits outcome]
    R --> C[Winning positions claim proportional payout]
    Q --> X[Cancelled market follows refund rules]

The contract enforces pool accounting and settlement, while the wallet authorizes each transaction. Market questions, criteria, and resolver authority remain essential parts of the trust model.

How a market works

  1. Create a clear question. A market needs an outcome that can be checked against stated criteria and a close time. Resolution sources and criteria must be published before a market opens.
  2. Buy a position. A participant chooses YES or NO and stakes XLM. The contract records the position and accounts for the market's fee shares.
  3. Sell or reduce a position. Before close, a participant can reduce their existing stake. The reduce_position contract operation returns the amount computed by its accounting rules. This is not an order-book sale to another user and does not open a short position.
  4. Resolve and settle. An authorized resolver submits the outcome. Winning positions share the distributable pool proportionally; a cancelled market follows its refund path. Contract calls and resulting transactions can be inspected on Stellar.

Market resolution is currently permissioned. Public price and network feeds shown by the website provide context; they do not act as automated oracles or trigger settlement. Resolver accountability, objective criteria, and public evidence are open product and governance problems, not solved features.

What is implemented

The Rust workspace is maintained in the separate stellar-trade-contracts repository. Its contract README explains the workspace, and the invariant matrix documents safety properties for fee, payout, referral, reward, and storage changes.

Deployment status

These are existing pre-rebrand Testnet deployment addresses. The reward asset at its listed address retains its original identity; it is not STRD. Fresh deployments from the current contract source produce new addresses and initialize a new STRD asset.

Contract Testnet address Status
Prediction market CAPCAPWPGPOCENAJFYYIE22WYNFEDVZ3CT73M5MAKILFMBQ5TN2MIS6T Legacy deployment; configured market #3 is expired
Legacy reward asset CBYUQUXPGWUQRV7STCV3YPVLWNTFJHKLEAG7LVAOK7H4FIFJGZW5P476 Pre-rebrand asset; not STRD
Referral registry CCKVUVYXR6FBB4VFYGDF3IDDUVBRJGKPDDRABTZYKI2LKAJNVLF3TTQ2 Existing Testnet deployment
Leaderboard CCMNYMUI4XMDBTTMM7E6KNQFF3OVKS3Q2ERJ4EVQGCLW4VQCGUGG2AQM Existing Testnet deployment

Inspect the contracts and transactions on Stellar Expert Testnet. The browser app currently uses market #3, which was published to close on September 30, 2026. It does not yet load market terms or resolution status from Soroban. Do not treat the page's sample odds, rankings, or local demo positions as current ledger state.

Run the browser app

The app has no package manager, bundler, or build step. From the root of this repository, run:

python3 -m http.server 8080 --directory frontend

Open http://localhost:8080. To inspect wallet flows, use Freighter on Stellar Testnet and Testnet assets only; they have no mainnet value. Concept-market actions are local simulations and move no funds. The browser stores recent position activity in session storage.

Contracts and checks

Clone the contract repository separately. Install Rust 1.91.0 and the wasm32v1-none target, then run these commands from that repository's root:

cargo test --workspace --all-features
cargo fmt --all -- --check
cargo clippy --workspace --all-features -- -D warnings
cargo build --release --target wasm32v1-none -p prediction_market

The frontend CI uses Node.js 22 to validate HTML pages, local assets, and JavaScript syntax. The contract repository has its own CI workflow for checks, tests, WASM builds, and invariant tests. If you change payout math, fees, storage lifetimes, or reward flows, update the tests and invariant matrix with the implementation.

Roadmap and contributor opportunities

The next work should make the prototype more useful and easier to evaluate:

These are roadmap areas, not a claim that corresponding Wave issues are already open. Contributors should coordinate through GitHub issues and pull requests. Keep changes scoped, add regression tests for contract behavior, and include screenshots for interface changes.

Security, data, and license

Never commit .deploy.env, secret keys, recovery phrases, wallet identities, or generated deployment output. The app asks Freighter to sign transactions and does not handle secret keys. Testnet software and assets are experimental and have no mainnet value. This project is not audited or intended for production financial use. Stellar Trade source code is licensed under MIT; bundled third-party fonts retain their own licenses and notices.

stellar-trade (Stellar-tradehub/stellar-trade)

Searching Database…

Что это?Stellar Trade — прототип рынка предсказаний на смарт-контрактах Soroban от Stellar, где пользователи покупают или продают позиции YES/NO по вопросу, а выплата рассчитывается в блокчейне через учётную систему с общим пулом XLM.
Это смарт-контракт, веб-приложение или и то и другое?И то и другое: workspace контрактов на Rust/Soroban обеспечивает логику рынка, рефералок, лидерборда и токена наград, а отдельное статичное браузерное приложение на HTML/CSS/JS позволяет подключить кошелёк и вызывать эти контракты.
Как запустить браузерное приложение?В приложении нет пакетного менеджера, бандлера или шага сборки — просто откройте его прямо из корня репозитория в браузере. Контракты лежат в отдельном репозитории 'stellar-trade-contracts', который клонируется и собирается независимо.
Что нужно для взаимодействия с ним?Нужен кошелёк Freighter, настроенный на Stellar Testnet, чтобы подписывать транзакции в браузерном приложении; для самостоятельной сборки или тестирования контрактов требуется Rust 1.91.0 с таргетом wasm32v1-none.
Можно ли прямо сейчас реально купить или продать позицию?Нет — настроенный рынок в Testnet (#3) уже истёк, так что, хотя вызовы покупки и уменьшения позиции реализованы в клиенте, ни один сейчас выполнить нельзя, а страницы рынка/лидерборда показывают иллюстративные примеры чисел, а не живые данные контракта.
Здесь используются реальные деньги?Нет, всё работает на Stellar Testnet с активами тестнета, не имеющими ценности в основной сети; проект прямо заявляет, что он экспериментальный, не аудирован и не предназначен для продакшен-финансового использования.
Кто решает, чем завершится рынок?Сейчас разрешение исхода требует полномочий: уполномоченный резолвер подаёт итог, выигрышные позиции делят пул пропорционально, а отменённый рынок идёт по пути возврата средств. Публичные ценовые фиды на сайте — лишь контекст, а не автоматические оракулы.
Что такое STRD?STRD — собственный токен наград проекта на Soroban, инициализируемый при свежих деплоях контрактов как 'Stellar Trade (STRD)'; он ещё не развёрнут, а существующий адрес наградного актива в Testnet сохраняет исходное до-ребрендинговое имя, а не STRD.
Что ещё нужно доделать до запуска вживую?В дорожной карте — чтение условий рынка и позиций вживую из Soroban вместо жёстко заданных данных фронтенда, повторный деплой свежего набора в Testnet, определение объективных правил разрешения исходов/споров и независимый аудит безопасности до любого продакшен-использования.
Можно ли продать свою позицию другому трейдеру?Нет — уменьшение позиции лишь запускает собственную учётную формулу контракта, выплачивающую часть вашей ставки; это не сделка по ордербуку с другим пользователем и не открытие короткой позиции.
Size
14.2 MB
Stars
130
Updated
CommitOct 13
Age
10d
Commits · 90 Days