Build a Robinhood Chain trading bot with an API
3 min read
TrnchLabs
Get an API key with a wallet signature, read new Robinhood Chain tokens screened for rugs, and trade at the best route across eight routers. TypeScript or Python.
What you build
A bot that watches new Robinhood Chain launches, skips the tokens Trnch 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. Checks, scans and quotes need no key; the key from a wallet signature is only needed to read the Heat and build a buy or a sell. The 194 official Stock Tokens are covered, and copies are flagged. Base URL: https://trnch.fun/api/bot/v1
1. Get a key, once, to trade
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. 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 Trnch, 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 Trnch 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
The agent guide at https://trnch.fun/skill.md lists every call, with ready-made strategy scripts for entries, exits and guards, and the OpenAPI spec at https://trnch.fun/openapi.json works with any language.
FAQ
What are the fees?
0.25% per swap (0.10% between major assets such as ETH and USDG, 0.05% between a Stock Token and a major asset, 0.50% for tokens under 24 h old or with no known launch time), 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.