Watch blockchain data via allowlisted RPC endpoints.
osmoda-keyd enforces spending limits and contract allowlists.
Tamper-proof SHA-256 ledger logs every decision and execution.
Crypto Trading Bot Template
This template describes the architecture for a crypto trading bot on osModa. The agent monitors on-chain data via allowlisted RPC endpoints, detects trading opportunities using your strategy logic, executes trades through osmoda-keyd policy-gated wallet operations, and logs every transaction to the tamper-proof audit ledger. osmoda-watch ensures the bot runs 24/7 with automatic crash recovery.
This is an architecture pattern, not a downloadable trading bot. It describes which osModa daemons your bot would use — osmoda-keyd for ETH and SOL wallet management with policy-gated signing, osmoda-egress for RPC endpoint allowlisting, osmoda-routines for periodic rebalancing, and osmoda-watch for uptime. You write the trading strategy; osModa provides the secure execution infrastructure.
TL;DR
- • On-chain data monitoring via allowlisted RPC endpoints (osmoda-egress)
- • Policy-gated wallet operations via osmoda-keyd -- spending limits, contract allowlists, daily caps
- • 24/7 uptime with osmoda-watch auto-restart on crash
- • Periodic portfolio rebalancing via osmoda-routines cron scheduling
- • Every trade decision and execution logged to SHA-256 tamper-proof audit ledger
- • Recommended plan: Pro ($34.99/mo)
Architecture Diagram
The data flow for a crypto trading bot on osModa.
┌──────────────────────────────────────────┐
│ ON-CHAIN DATA SOURCES │
│ via osmoda-egress allowlisted RPCs │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ ETH RPC │ │ SOL RPC │ │ DEX APIs │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ └────────────┼────────────┘ │
└────────────────────┼─────────────────────┘
▼
┌──────────────────────────────────────────┐
│ TRADING AGENT │
│ (your strategy code) │
│ supervised by osmoda-watch (24/7) │
└──────────┬───────────────────────────────┘
│
▼
┌──────────────────────────────────────────┐
│ OPPORTUNITY DETECTOR │
│ price movements, arbitrage, liquidity │
│ signals based on your strategy │
└──────────┬───────────────┬───────────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────┐
│ OPPORTUNITY │ │ NO SIGNAL │
│ FOUND │ │ continue │
│ │ │ monitoring │
└──────┬───────┘ └──────────────────┘
│
▼
┌──────────────────────────────────────────┐
│ osmoda-keyd │
│ POLICY-GATED SIGNING │
│ ✓ max tx value check │
│ ✓ contract allowlist check │
│ ✓ daily spending limit check │
│ ✓ sign or reject │
└──────────┬───────────────────────────────┘
│
▼
┌──────────────────────────────────────────┐
│ TRANSACTION BROADCAST │
│ submit signed tx to blockchain │
│ via osmoda-egress allowlisted RPC │
└──────────────────────────────────────────┘
┌──────────────────────────────────────────┐
│ osmoda-routines: periodic rebalancing │
│ cron job for portfolio maintenance │
└──────────────────────────────────────────┘
┌──────────────────────────────────────────┐
│ AUDIT LEDGER (agentd) │
│ logs every signal, decision, tx, result │
└──────────────────────────────────────────┘Components
The building blocks of this trading bot architecture.
On-Chain Data Feed
Connects to blockchain RPC endpoints (Alchemy, Infura, QuickNode) via osmoda-egress. Monitors price feeds, mempool activity, liquidity pools, and smart contract events relevant to your strategy.
Strategy Engine
Your trading logic that analyzes on-chain data and identifies opportunities. Can range from simple price threshold triggers to LLM-powered market analysis. Entirely defined by your code.
Policy-Gated Signer
osmoda-keyd validates every transaction against your configured policies before signing. Enforces spending limits, contract allowlists, and rate limits. Prevents the bot from exceeding boundaries you set.
Transaction Broadcaster
Submits signed transactions to the blockchain via the allowlisted RPC endpoint. Monitors transaction confirmation status. Handles gas price optimization and transaction retry logic.
Portfolio Rebalancer
An osmoda-routines cron job that periodically evaluates portfolio allocation and triggers rebalancing trades to maintain your target ratios. Runs independently of the opportunity-driven trading loop.
Trade Audit Log
Every signal detected, trade decision made, transaction signed, and execution result is logged to the SHA-256 audit ledger. Creates a tamper-proof record for strategy debugging and tax reporting.
osModa Features Used
The specific daemons and platform capabilities this template relies on.
osmoda-keyd
ETH and SOL wallet management with policy-gated signing. Enforces spending limits, contract allowlists, and daily caps on every transaction. Prevents runaway bots from exceeding risk boundaries.
osmoda-egress
Allowlists specific RPC endpoints and DEX API domains. Prevents the bot from connecting to malicious RPC nodes or exfiltrating data to unauthorized endpoints. Essential for trading security.
osmoda-watch
24/7 process supervision with auto-restart. If the trading bot crashes, osmoda-watch restarts it in seconds. Critical for trading bots that must not miss market opportunities due to downtime.
osmoda-routines
Cron scheduling for periodic portfolio rebalancing. Runs independently of the real-time trading loop. Logs each rebalancing operation to the audit ledger.
Step-by-Step Setup
How to implement this architecture pattern on your osModa server.
- 1
Spawn a Pro server and SSH in
Go to spawn.os.moda and create a Pro server ($34.99/mo). SSH in with your key. All 9 daemons including osmoda-keyd and osmoda-egress are already running.
- 2
Configure osmoda-keyd wallets and policies
Create or import your ETH and SOL wallets into osmoda-keyd. Define signing policies: maximum transaction value, allowed contract addresses, daily spending limits, and any chain-specific rules.
- 3
Allowlist RPC endpoints via osmoda-egress
Add your RPC provider endpoints (Alchemy, Infura, QuickNode) and any DEX API domains to the osmoda-egress allowlist. Block all other outbound traffic.
- 4
Build the trading strategy
Write your agent code that connects to the on-chain data feed, implements your trading logic, and calls osmoda-keyd for trade execution. Test with small amounts or on testnets first.
- 5
Register with osmoda-watch for 24/7 uptime
Register the trading bot process with osmoda-watch. Configure immediate restart policy. The bot must recover from crashes in seconds to avoid missing market opportunities.
- 6
Schedule periodic rebalancing (optional)
If your strategy includes portfolio rebalancing, set up an osmoda-routines cron job. The rebalancer runs independently of the main trading loop.
Recommended Plan
Trading bots need consistent low-latency performance and enough memory to process on-chain data streams. Pro provides the balance of compute and cost for most strategies.
Pro — $34.99/mo
4 CPU · 8 GB RAM · 80 GB disk
Handles real-time on-chain data processing, strategy computation, and trade execution for most trading strategies. For high-frequency strategies monitoring many markets, consider Team ($62.99/mo, 8 CPU, 16 GB RAM).
Frequently Asked Questions
Is this a downloadable trading bot?
No. This is an architecture pattern describing how to design a crypto trading bot on osModa. It maps the data flow from on-chain data sources through opportunity detection to trade execution via osmoda-keyd, and identifies which osModa daemons handle each stage. You write the trading logic yourself; the pattern shows you how to leverage osModa's wallet infrastructure and process supervision.
How does policy-gated signing work with osmoda-keyd?
osmoda-keyd manages ETH and SOL wallets with configurable policies that gate every signing operation. You define policies like maximum transaction value, allowed contract addresses, daily spending limits, and required confirmation thresholds. When your trading bot requests a signature, osmoda-keyd checks the transaction against all configured policies before signing. Transactions that violate any policy are rejected and logged. This prevents runaway bots from draining wallets.
Why does the template use osmoda-egress for RPC endpoints?
osmoda-egress allowlists the specific RPC endpoints your bot can access (e.g., your Alchemy, Infura, or QuickNode endpoints). This prevents the bot from being redirected to malicious RPC nodes that could return falsified on-chain data. It also ensures the bot cannot exfiltrate wallet keys or trade data to unauthorized endpoints.
How does the audit ledger help with trading?
Every trade decision, order placement, transaction signature, and execution result is logged to the SHA-256 hash-chained audit ledger via agentd. This creates a tamper-proof record of every action the bot took and why. Useful for debugging trading strategies, tax reporting, regulatory compliance, and post-incident forensics if something goes wrong.
What happens if the trading bot crashes?
osmoda-watch detects the crash and restarts the bot process. For a 24/7 trading bot, this means downtime is measured in seconds, not hours. The bot can check its last known state (open orders, pending transactions) on restart and resume operation. The crash and restart are logged to the audit ledger for review.
What plan is recommended for a trading bot?
Pro ($34.99/mo, 4 CPU, 8 GB RAM, 80 GB disk) is recommended. Trading bots need to process on-chain data streams, maintain order books in memory, and respond to opportunities with low latency. The 4 CPU and 8 GB RAM on Pro handles these requirements. For high-frequency strategies monitoring many markets simultaneously, consider Team ($62.99/mo).
Build Your Trading Bot on osModa
Spawn a dedicated server with osmoda-keyd for policy-gated wallets, osmoda-egress for RPC allowlisting, and osmoda-watch for 24/7 uptime. From $34.99/month.
Last updated: March 2026