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 是一个基于 Stellar 的 Soroban 智能合约构建的预测市场原型:用户就某个问题买入或卖出 YES/NO 头寸,赔付通过共享 XLM 记账系统在链上结算。
这是智能合约、网页应用,还是两者都有?两者都有:一个 Rust/Soroban 合约工作区负责执行市场、推荐、排行榜和奖励代币逻辑,另一个独立的静态 HTML/CSS/JS 浏览器应用让你连接钱包并调用这些合约。
怎么运行浏览器应用?这个应用没有包管理器、打包器或构建步骤——直接从仓库根目录在浏览器中打开即可。合约位于单独的“stellar-trade-contracts”仓库中,需要你单独克隆和构建。
与它交互需要什么?你需要为 Stellar 测试网配置好 Freighter 钱包,以便在浏览器应用中签署交易;要自己构建或测试合约,则需要带 wasm32v1-none 目标的 Rust 1.91.0。
现在真的能买入或卖出头寸吗?不能——已配置的测试网市场(#3)已经到期,所以尽管客户端实现了买入和减仓调用,但目前两者都无法执行,而且市场/排行榜页面显示的是示例数字,不是实时合约数据。
这里用的是真钱吗?不是,一切都在 Stellar 测试网上运行,使用没有主网价值的测试网资产;项目明确声明它是实验性的、未经审计的,不打算用于生产级金融用途。
市场如何结算由谁决定?结算目前是有权限控制的:由获得授权的结算者提交结果,获胜头寸按比例分享资金池,被取消的市场则走退款路径。网站上显示的公开价格源只是背景参考,不是自动化预言机。
STRD 是什么?STRD 是该项目自己的 Soroban 奖励代币,由全新的合约部署初始化为“Stellar Trade (STRD)”;它尚未部署,现有的测试网奖励资产地址仍然保留着改名前的原始身份,不是 STRD。
在正式上线之前还剩什么要做?路线图包括:从 Soroban 实时读取市场条款和头寸以取代硬编码的前端数据、重新部署一套全新的测试网合约、定义客观的结算/争议政策,并在任何生产使用前进行独立安全审查。
我可以把头寸卖给其他交易者吗?不能——减仓只会触发合约自身的记账公式来支付你部分本金;它不是与其他用户的订单簿交易,也不会开设空头头寸。
Size
14.2 MB
Stars
130
Updated
CommitOct 13
Age
11d
Commits · 90 Days