Testing & Production
Run, test, and deploy your bot
Running and Testing
Start Both Apps
From the root directory:
npm run devyarn devpnpm devbun run devThis starts:
- Telegram bot on
http://localhost:8008 - Frontend on
http://localhost:3000
Complete Registration
Get Telegram ID
Open your Telegram bot and send /debug. Copy your Telegram ID from the response.
Register Signer
- Open
http://localhost:3000in your browser - Click "Connect RISE Wallet" and approve
- Paste your Telegram ID
- Click "Register Trading Signer"
- Sign the permission in RISE Wallet popup
- Wait for confirmation (~5-10 seconds)
Test the Bot
Go back to Telegram and try:
/balance- Should show 0 USDC/deposit- Should credit 1000 testnet USDC/balance- Should now show 1000 USDC
Place Your First Trade
Send: buy 0.02 BTC
The bot should respond with order confirmation and transaction hash.
A successful trade message should look like this:

Testing Natural Language
Try these examples:
✅ "check my balance" → Shows USDC balance
✅ "show positions" → Lists open perp positions
✅ "buy 0.02 BTC" → Places market long order
✅ "short 0.01 ETH at 3400" → Places limit short order
✅ "deposit 500" → Adds 500 USDC to account
✅ "go long with 1000 USDC" → Calculates size from USDC amountThe LLM will parse these into structured tool calls and execute them via the RISEx API.
Understanding the Flow
Let's trace what happens when you send "buy 0.02 BTC":
- Message Received: Telegram bot receives your text message
- Verification: Bot checks if your Telegram ID is linked to a wallet and has a registered signer
- LLM Processing: Message is sent to GPT-4o-mini with system prompt and tool definitions
- Intent Parsing: LLM returns:
{ "tool": "place_order", "params": { "market": "BTC", "side": "long", "size": "0.02", "orderType": "market" } } - Key Retrieval: Backend loads your encrypted signer key and decrypts it
- Signature Generation: Backend signs an EIP-712
VerifySignaturemessage using the signer key - API Call: Backend calls
POST /v1/orders/placewith the signature - On-Chain Verification: RISEx smart contract verifies the signature matches the registered signer
- Order Execution: RISEx executes the perpetual futures trade
- Confirmation: Bot replies with order ID and transaction hash
This entire flow completes in under 5 seconds, providing near-instant trading from natural language commands.
Next Steps
You've built a fully functional AI-powered trading bot! Here are some ideas to extend it:
- Advanced Orders: Add stop-loss, take-profit, and trailing stops
- Portfolio Analytics: Track PnL over time with charts
- Price Alerts: Notify users when markets hit target prices
- Multi-User Support: Allow multiple users per bot instance
- Risk Management: Add position sizing calculators and risk limits
- Market Data: Integrate realtime price feeds and order book data
Related Tutorials
- RISE Wallet Demo - Learn more about session keys
- Shred Ninja - Realtime event monitoring
- Reaction Time Game - 3ms transaction confirmations
Resources
- GitHub Repository - Complete source code
- RISEx Documentation - Complete trading platform guide
- RISEx API Reference - REST API endpoints
- Telegraf Documentation - Telegram bot framework
- OpenRouter Documentation - LLM integration guide
- Viem Documentation - Ethereum library reference
Now go build something amazing with RISEx on RISE! 🚀