OpenClaw’s Torch Prediction Market Kit skill is a ready‑to‑run autonomous
agent that lets anyone launch and manage binary prediction markets on the
Solana blockchain without needing to provide liquidity or worry about
custodial risk. The skill packages the Torch SDK and a lightweight bot that
reads a simple markets.json file, creates Torch tokens for each market,
seeds them with initial liquidity from a vault you control, monitors price and
volume, and resolves each market at its deadline using an oracle (CoinGecko
price feed or a manual feed). All SOL used for token creation and seed
liquidity flows through the vault, while the agent’s disposable keypair holds
no funds of value.
Why This Skill Exists
Prediction markets are powerful tools for aggregating information, but
deploying them on‑chain has traditionally required deep knowledge of AMMs,
liquidity provision, and complex smart‑contract interactions. The OpenClaw
skill abstracts away those complexities. By leveraging the Torch Market
protocol, each market becomes a simple Torch token whose price on a bonding
curve directly reflects the crowd’s belief about a binary outcome. The 10 %
treasury built into the token captures trading fees, providing a sustainable
revenue stream for the market creator without any extra steps.
The skill is designed with safety in mind. The agent wallet is generated
in‑process each time the bot starts, meaning there is no permanent private key
file that could be stolen. The wallet is intentionally funded with only enough
SOL to cover transaction gas (≈0.01 SOL). All valuable assets—SOL and the
newly minted market tokens—reside in the vault that you, the human principal,
create and fund. If the agent’s keypair were ever compromised, an attacker
could only drain the negligible gas balance and would still need to break the
vault link to steal any real value.
Core Components
- Vault : A Torch Vault account that holds SOL and all market tokens. You create and fund it from your authority wallet (hardware wallet, multisig, etc.). The vault is the sole custodian of value.
- Agent Keypair : A disposable Ed25519 keypair generated at runtime. It signs transactions for token creation, liquidity seeding, and market resolution but never holds funds.
- Markets.json : A plain‑text configuration file where you define each prediction market. Each entry includes a name, symbol, metadata URI, oracle type (price‑feed or manual), deadline, and the amount of SOL to seed.
-
Oracle : The skill defaults to CoinGecko’s public API for price feeds, requiring no API key. For non‑price outcomes you can switch to a manual oracle by updating the oracle field in
markets.json. - Bonding Curve & Treasury: When a market token is created, its price follows a deterministic bonding curve. Every trade incurs a 10 % fee that goes to the treasury, which accumulates inside the vault.
How the Market Cycle Works
The bot operates in a continuous loop governed by the SCAN_INTERVAL_MS
environment variable (default 30 seconds). Each iteration performs the
following steps:
-
Load Market Definitions : The bot reads
markets.jsonfrom the working directory. -
Create Pending Markets : For any market whose status is
pending, the bot builds a token‑creation transaction using the Torch SDK’sbuildCreateTokenTransactionfunction, signs it with the agent keypair, submits it to the Solana RPC, and waits for confirmation. -
Seed Liquidity : Immediately after token creation, the bot calls
buildBuyTransactionto purchase an amount of the new token directly from the vault. This seeds the bonding curve with initial liquidity, ensuring the market has a non‑zero price from the start. -
Update Status : On success, the market’s status is switched to
activeand its mint address is stored back intomarkets.json. -
Monitor Active Markets : For each
activemarket, the bot queries the token account to get the current price, volume, and holder count. -
Check Deadline : If the current UNIX timestamp exceeds the market’s deadline, the bot invokes the oracle:
- For a price‑feed oracle, it fetches the latest price from CoinGecko and compares it to the strike price defined in the market.
- For a manual oracle, it reads a user‑provided outcome flag from
markets.json.
-
Resolve Market : The bot records the outcome (YES or NO) and updates the market status to
resolved. No payout transaction is needed because the token price itself is the prediction; traders can simply sell their tokens back to the bonding curve to realize profit or loss. -
Persist State : The updated
markets.jsonis written to disk. -
Sleep : The bot pauses for
SCAN_INTERVAL_MSmilliseconds before repeating the loop.
Throughout this loop, every SOL transaction originates from the vault. The
agent’s keypair only pays the negligible network fee, ensuring that even if
the key were exposed, the attacker could not siphon meaningful funds.
Getting Started
-
Install the Kit :
npm install torch-prediction-market-kit@2.0.2
Alternatively, you can clone the repository and use the bundled source found
in lib/torchsdk/ (the Torch SDK) and lib/kit/ (the bot code).
- Create and Fund a Vault :
From your authority wallet (the wallet that will retain full control), run the
Torch SDK’s vault creation command:
torch-sdk create-vault --authority
Fund the vault with the amount of SOL you wish to allocate for market seeding
and transaction fees (e.g., 0.5 SOL).
- Link the Agent Wallet :
On first run the bot will output a message like:
--- ACTION REQUIRED --- agent wallet is NOT linked to the vault. link it by
running (from your authority wallet): buildLinkWalletTransaction(connection,
{ authority: "", vault_creator: "", wallet_to_link: "" }) then restart the
bot.
Execute the displayed command using your authority wallet, then restart the
bot.
- Prepare markets.json :
Create a file named markets.json in the bot’s working directory. A minimal
example looks like this:
[
{
"name": "Will BTC exceed $70k by 2025-12-31?",
"symbol": "BTC70K",
"uri": "https://example.com/metadata/btc70k.json",
"oracle": {
"type": "pricefeed",
"feed": "coingecko",
"token": "bitcoin",
"threshold": 70000
},
"deadline": 1767225600,
"seed_sol": 0.1
}
]
Each object defines a binary market. Adjust the fields to suit your use case.
-
Run the Bot :
npm start
The bot will read the configuration, create the markets, seed liquidity, and
begin monitoring.
Safety and Control
Because the skill sets disable-model-invocation: true, it cannot be
triggered autonomously by an AI model without explicit user initiation. This
prevents any unintended market creation or manipulation. All critical
actions—vault creation, funding, and wallet linking—must be performed from
your authority wallet, ensuring that you retain full custody.
The agent’s disposable nature means that even in the unlikely event of a key
compromise, the attacker gains nothing beyond the negligible gas balance. You
can instantly revoke access by running the unlinkWallet instruction from
your authority wallet, which removes the agent’s permission to interact with
the vault without affecting any other funds.
Use Cases
- Community‑driven event forecasting (sports outcomes, election results, product launches).
- Internal corporate prediction markets for project timelines or metric achievement.
- Educational demonstrations of on‑chain AMMs and oracle integration.
- Experimental financial products where the token price itself serves as the settlement mechanism.
Conclusion
The OpenClaw Torch Prediction Market Kit skill turns the sophisticated Torch
Market protocol into a plug‑and‑play agent that anyone can deploy with a few
commands. By isolating value in a vault you control, using a disposable agent
keypair, and automating the full market lifecycle—from token creation to
oracle‑based resolution—the skill offers a safe, transparent, and
low‑maintenance way to run prediction markets on Solana. Whether you are a
hobbyist looking to experiment with crowdsourced forecasts or a developer
seeking a composable building block for larger DeFi applications, this kit
provides the necessary tools, documentation, and safety guarantees to get
started quickly and confidently.
Skill can be found at:
https://github.com/openclaw/skills/tree/main/skills/mrsirg97-rgb/torchpredictionmarketkit/SKILL.md
Top comments (0)