A verifiable on-chain index value for 18 DeFi perpetual assets, powered by an AI research agent and the SEDA oracle network.
An AI research agent (quinndex) produces portfolio weighting functions via tournament-style optimisation. A human approves or rejects candidates. Developer-built infrastructure converts the active weights into a SEDA oracle data request. The oracle program fetches live Pyth prices, applies the weights, and returns a consensus-backed index value on-chain.
The agent never touches SEDA directly. It produces compute_weights() functions. Everything downstream is deterministic plumbing.
research/ AI strategy code (copied from quinndex)
strategy.py Active compute_weights() function (Tail-Reactor, vol=1.0748)
harness.py Backtest engine with constraint validation
config.py 18-asset universe, weight constraints
data.py Hyperliquid OHLCV fetcher + Parquet cache
state/ Version tracking + human approval
models.py WeightingFunction, WeightVector, IndexFeed, StagedCandidate
store.py JSON-file persistence
engine/ Weight engine + SEDA adapter
weight_engine.py Runs active compute_weights() on cached prices
seda_adapter.py Converts weights, posts data requests, polls results
seda_bridge.ts TypeScript bridge to @seda-protocol/dev-tools
oracle-program/ Rust -> WASM, deployed to SEDA testnet
src/lib.rs execute() fetches 18 Pyth prices, tally() computes weighted index
frontend/ Flask admin console
app.py Server-rendered HTML with HTMX polling
templates/ Index ticker, weight breakdown, staging panel
scripts/ Operational scripts
seed_state.py Initialize state with active strategy + feed config
run_pipeline.py Full loop: weights -> SEDA data request -> on-chain result
- Python 3.10+ with uv
- Bun (for SEDA TypeScript bridge)
- Rust with
wasm32-wasip1target (only if rebuilding the oracle program) - A
.envfile at the project root with SEDA testnet credentials:
SEDA_MNEMONIC=your twelve word mnemonic phrase here
SEDA_RPC_ENDPOINT=https://rpc.testnet.seda.xyz
Get testnet SEDA tokens from the faucet.
# Install Python dependencies
uv sync --all-extras
# Install SEDA bridge dependencies
cd engine && bun install && cd ..
# Populate the price cache (~1-2 min, fetches from Hyperliquid)
uv run python -c "from research.data import prepare; prepare()"
# Seed state with active strategy and index feed
uv run python scripts/seed_state.pyComputes weights from the active strategy, posts a data request to SEDA testnet, waits for consensus, and stores the verified index value:
uv run python scripts/run_pipeline.pyTakes 30-90 seconds per run (SEDA consensus). Each run costs a small amount of testnet SEDA.
uv run python -m frontend.appOpen http://127.0.0.1:5000. Three panels auto-refresh every 30 seconds:
- Index Ticker -- current verified index value, oracle program ID, data request ID
- Weight Breakdown -- sorted table of all 18 assets with allocation percentages
- Staging Panel -- approve/reject interface for candidate strategies (populated when tournaments run)
Re-run the pipeline to compute fresh weights and post a new data request. The frontend picks up the latest result automatically:
uv run python scripts/run_pipeline.pyuv run pytest tests/ -v70 tests covering state models, persistence, research module (backtest engine, metrics, data pipeline, strategy), weight engine, and SEDA adapter.
The oracle program is already deployed to SEDA testnet. To rebuild and redeploy:
# Build
cd oracle-program && cargo build --target wasm32-wasip1 --release && cd ..
# Deploy (returns a new Oracle Program ID)
# Update ORACLE_PROGRAM_ID in scripts/seed_state.py, then re-seedCurrent Oracle Program ID: b3d54b3c2cd2b06db5353bf7e5eafd31e8d211aaa24146d62ffe2d3ecf0f0511
PUMP, LINK, AAVE, JUP, ENA, CRV, UNI, LDO, MORPHO, DYDX, PENDLE, INJ, JTO, ETHFI, PYTH, EIGEN, COMP, RUNE
All 18 assets have live Pyth price feeds fetched by the oracle program during execution.