2 min read
Build a Robinhood Chain trading bot with the TRNCH Bot API
TrnchLabs
Code tutorial: get an API key with a wallet signature, read new Robinhood Chain tokens screened for rugs and honeypots, and buy or sell at the best route across six routers. TypeScript, Python or any HTTP client.
What you build
A bot that watches new Robinhood Chain launches, skips the tokens TIA keeps out, and trades the screened ones at the best price across KyberSwap, LI.FI, Uniswap, 0x, SushiSwap and 1inch. The bot keeps its own private key: TRNCH only returns transactions to sign. Base URL: https://trnch.fun/api/bot/v1
1. Get a key, once
import { createWalletClient, http, publicActions } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
const base = 'https://trnch.fun/api/bot/v1';
const account = privateKeyToAccount(process.env.BOT_PRIVATE_KEY as `0x${string}`);
const { message } = await (await fetch(`${base}/register?wallet=${account.address}`)).json();
const signature = await account.signMessage({ message });
const res = await fetch(`${base}/register`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ wallet: account.address, message, signature, label: 'my-bot' }),
});
const { key } = await res.json(); // shown once: store itThe message is valid for 10 minutes. The wallet needs 10 USDG or 0.004 ETH on Robinhood Chain. Up to 3 keys per wallet.
2. Read screened launches
const auth = { authorization: `Bearer ${key}` };
const feed = await (await fetch(`${base}/heat`, { headers: auth })).json();
// feed.heat: tokens screened by TIA, ranked by Heat score
// feed.new: just-spotted tokens, not screened yet (higher risk)Poll with ?since= set to the nextSince of the previous answer to get only the tokens that entered the Heat since. 60 calls per minute.
3. Buy at the best route
const wallet = createWalletClient({ account, transport: http('https://rpc.mainnet.chain.robinhood.com') }).extend(publicActions);
const buy = await (await fetch(`${base}/buy`, {
method: 'POST',
headers: { ...auth, 'content-type': 'application/json' },
body: JSON.stringify({ tokenId: feed.heat[0].id, amountUsd: 10, slippageBps: 300 }),
})).json();
if (buy.approval) {
const approved = await wallet.sendTransaction({ chain: null, to: buy.approval.to, data: buy.approval.data });
await wallet.waitForTransactionReceipt({ hash: approved });
}
const hash = await wallet.sendTransaction({ chain: null, to: buy.tx.to, data: buy.tx.data, value: BigInt(buy.tx.value) });
await fetch(`${base}/confirm`, { method: 'POST', headers: { ...auth, 'content-type': 'application/json' }, body: JSON.stringify({ txHash: hash }) });The answer is { router, quote, approval, tx, chainId, from }. The quote shows amountOut and the USD values, fee already deducted. The approval must be mined before tx is sent.
4. Sell
body: JSON.stringify({ tokenId, percent: 50 }) // or amount: '1234.5'/sell takes a share of the wallet balance (percent, 100 = all) or an exact amount, and returns the same shape as /buy. /quote compares routes without building a transaction.
Built-in protection
- Tokens TIA keeps out as High risk (rugs, honeypots, heavy sell taxes) are refused with a 409.
- Every transaction is built for the key's wallet only, within your slippage limit.
- Non-custodial: no deposit, no custody, the private key never leaves your machine.
Ready-made examples
Open source on GitHub: isonips/trnch-bot-examples (TypeScript and Python bots), isonips/plugin-trnch (ElizaOS plugin), isonips/trnch-mcp (MCP server) and isonips/robinhood-chain-mcp.
FAQ
What are the fees?
0.5% per swap, already deducted from the quoted amounts. No subscription.
Can my bot sell a token it did not buy through TRNCH?
Yes, any token the wallet holds, as long as a router can route it.
What happens when a call is rate limited?
The API answers 429 with a retry-after header. Wait and retry.