npm.io
0.1.5 • Published 3d agoCLI

@srivtx/sports-workbench

Licence
MIT
Version
0.1.5
Deps
5
Size
147 kB
Vulns
0
Weekly
0

Sports Workbench

A verifiable sports trading workbench for TxLINE (by TxODDS) — the only sports data feed with cryptographic Merkle proofs anchored on Solana.

npm install @srivtx/sports-workbench
npx sports-workbench backtest --strategy sharpDetector --from 2026-06-01 --to 2026-07-10

Every signal in sports-workbench is on-chain verifiable: the underlying odds record, the Merkle proof, and the program-derived address are bundled into a Verifiable Settlement Receipt that anyone can re-check against the on-chain batch root.

What this is

sports-workbench is the Trading Tool + Agent for the TxLINE / TxODDS World Cup Hackathon. It is:

  • A trading TOOL — runs verifiable backtests against historical World Cup odds
  • An AGENT — connects to the live SSE stream and fires signals autonomously
  • A skill for the solana-agent-kit (1.7k stars) and any npx skills add-compatible agent
  • Free-tier friendly — runs against the TxLINE free tier (Service Level 1: 60s-delayed World Cup odds, no payment required)

Quick start

# install once
npm install -g @srivtx/sports-workbench

# or use npx with -p to invoke a binary from a scoped package
npx -p @srivtx/sports-workbench sports-workbench strategies

Then run any command:

sports-workbench strategies
sports-workbench backtest \
  --strategy sharpDetector \
  --from 2026-06-01 \
  --to 2026-07-10 \
  --threshold 2 \
  --out report.json

Note: plain npx sports-workbench … doesn't work — npx treats the first argument as a package name, and the unscoped sports-workbench package doesn't exist. Use npm install first, or use npx -p @srivtx/sports-workbench ….

The report contains:

  • total signals detected
  • win rate, P&L, max drawdown, Sharpe, Sortino, profit factor
  • proof artifacts (signal id, messageId, merkle root, on-chain tx) for every signal
  • per-strategy and per-market breakdown

Live signal agent

# Step 1: subscribe on-chain (one-time, 0 TxL for free tier, costs only SOL for gas)
sports-workbench subscribe --devnet --level 1 --weeks 4
# → returns { txSig, apiToken, expiresAt, wallet }
# → save the apiToken somewhere safe (or export TXLINE_API_TOKEN=<apiToken>)

# Step 2: stream live signals
export TXLINE_API_TOKEN=<apiToken from step 1>
sports-workbench signal \
  --strategy sharpDetector \
  --threshold 2 \
  --devnet \
  --state ./my-signals.json

(Or via npx: npx -p @srivtx/sports-workbench sports-workbench signal …)

The agent connects to the free World Cup odds stream, detects every >2% shift, fetches the Merkle proof, and persists every verifiable signal to a local JSON store. Drop the binary into a VM or a Cloudflare Worker and let it run.

Why a CLI step for subscribe? The TxLINE free tier is gated by an on-chain Solana subscription (Service Level 1 or 12, both 0 TxL tokens). The subscribe command does the subscribe instruction + activation in one shot. Mainnet works the same way — just drop --devnet. The token is valid for 30 days; re-run subscribe to refresh.

As a solana-agent-kit plugin

import { SolanaAgentKit, KeypairWallet } from "solana-agent-kit";
import { TxlinePlugin } from "@srivtx/sports-workbench/agent-kit";
import bs58 from "bs58";

const agent = new SolanaAgentKit(
  new KeypairWallet(Keypair.fromSecretKey(bs58.decode(process.env.SOLANA_PRIVATE_KEY!))),
  process.env.SOLANA_RPC_URL!,
  {}
).use(new TxlinePlugin({
  strategy: "sharpDetector",
  thresholdPct: 2,
}));

// Now your agent can do:
const r = await agent.methods.backtestOdds(agent, {
  fromDate: Date.parse("2026-06-01"),
  toDate: Date.parse("2026-07-10"),
  startingBankroll: 10000,
  positionSize: 0.02,
  verifyOnChain: true,
});
console.log(r.winRate, r.proofArtifacts.length);

As an MCP-compatible skill (npx skills add)

This package follows the skills.sh standard. Install with:

npx skills add srivtx/sports-workbench

Strategies

Strategy When it fires
momentum Home win prob rises >thresholdPct in the rolling window
meanReversion Any outcome moves >thresholdPct (bet on snap-back)
sharpDetector Max abs deltaPct across all outcomes > threshold (sponsor's official idea #1)
custom Bring your own JS strategy

Why "verifiable" matters

Every other backtester on GitHub (and there are 30+ — tradinglabpremium/sports-prediction-market-scanner, BiosignalsLab/sports-betting-insight, etc.) produces a number and says "trust me bro." sports-workbench produces a Verifiable Settlement Receipt: the exact MessageId of the odds update, the canonicalized subTreeRoot, the on-chain programId, the PDA for that daily batch, and the proof path. Anyone can take that receipt to a Solana explorer and re-run the on-chain validate_odds instruction to confirm the result is real.

This is a capability no other data feed (Pyth, Chainlink, Switchboard) offers for sports. TxLINE is the only one with on-chain anchoring, and sports-workbench is the first tool to use it for backtesting.

How it works

  1. Connect to TxLINE via the guest auth endpoint (/auth/guest/start → JWT, 30 days)
  2. Subscribe on-chain to the free World Cup tier (Service Level 1 or 12 — 0 TxL tokens needed) and activate the X-Api-Token via POST /api/token/activate with a wallet signature
  3. Replay historical odds through any strategy (sharpDetector is the default)
  4. Anchor every detected signal via fetchOddsValidation(messageId, ts)OddsValidation (the Merkle proof)
  5. Package as a Verifiable Settlement Receipt with the on-chain dailyBatchRootsPda so the user can re-check the proof against the on-chain root at any time
  6. Stream real-time odds via the SSE endpoint with both Authorization: Bearer <jwt> and X-Api-Token: <apiToken> headers (the reference example's domain oracle.txodds.com is not in public DNS; we use the main txline-dev.txodds.com instead)

Endpoints used

Endpoint Purpose
POST /auth/guest/start anonymous guest JWT (30 days)
GET /api/fixtures/snapshot/{epochDay} fixture list
GET /api/odds/snapshot/{fixtureId} historical odds snapshot
GET /api/odds/updates/{epochDay}/{hourOfDay}/{interval} 5-min interval historical odds
GET /api/odds/validation?messageId=…&ts=… Merkle proof for a single odds update
GET /api/scores/historical/{fixtureId} settle backtest outcomes
GET /api/odds/stream live SSE stream (requires both Authorization: Bearer <jwt> AND X-Api-Token: <apiToken>; the reference's oracle.txodds.com host is not in public DNS from most networks)

Live demo

A live dashboard is deployed at https://sports-workbench.vercel.app (or your custom domain) with:

  • Live signal feed (uses the free tier SSE stream)
  • Backtest playground (run any strategy against any date range)
  • Proof explorer (paste a MessageId to re-verify a signal on Solana)
  • Verifiable Settlement Receipt viewer

Hackathon context

This is the entry for the TxODDS World Cup Hackathon — Trading Tools and Agents track (Superteam Earn, deadline July 19 2026, $10k first prize). Judged by Yash (SendAI), Abhishek, and Pratik.

Repository: github.com/srivtx/sports-workbench

TxLINE feedback (built into docs/TXLINE_FEEDBACK.md)

What we liked: 30-day guest JWT means we can run unattended for the entire hackathon. Free tier covers exactly the World Cup. SSE stream is resumable via Last-Event-ID. The 3-level Merkle hierarchy maps cleanly to our receipt model.

What we'd want: an SDK package on npm with the OpenAPI spec bundled (currently the only TypeScript is the reference examples repo). A validate_odds .view()-style helper for low-cost re-derivation in the agent (vs a full CPI). And a Backtest endpoint that does the historical replay server-side so the workbench doesn't have to.

License

MIT.

Keywords