Building
Transactions
Every write is non-custodial. The API builds an unsigned transaction; you sign it with your own key and broadcast it. The service never holds funds or private keys.
The flow
- Build. POST to
/tx/create,/tx/buyor/tx/sell. You get back a transaction template. - Sign. Sign it locally with your wallet (viem, ethers, web3.py, a browser wallet — anything).
- Broadcast. Send it to any Robinhood Chain RPC, or POST the signed raw bytes to
/tx/sendand we relay them for you.
The transaction template
Build endpoints return a tx object:
json
{
"tx": {
"chainId": 46630,
"to": "0x4874AB389827d4BC9be9750163c59398D4C91Cd9",
"data": "0x…",
"value": "50000000000000000",
"function": "buy(address,uint256,uint256)"
}
}value is always wei as a decimal string (JSON-safe). Fill in nonce, gas fields and gas yourself at sign time.
Sign & broadcast with viem
javascript
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { robinhoodChainTestnet } from "./chains"; // your defineChain
const API = "http://5.9.115.219:2442/api/v1";
const account = privateKeyToAccount(process.env.PK);
const wallet = createWalletClient({ account, transport: http() });
// 1. build
const { tx } = await (await fetch(`${API}/tx/buy`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ token: "0x…", ethIn: "0.1", slippageBps: 300 }),
})).json();
// 2 + 3. sign locally with YOUR key and send
const hash = await wallet.sendTransaction({
to: tx.to, data: tx.data, value: BigInt(tx.value),
});
console.log(hash);Sign & relay with web3.py
python
import requests, os
from web3 import Web3
API = "http://5.9.115.219:2442/api/v1"
w3 = Web3(Web3.HTTPProvider("https://rpc.testnet.chain.robinhood.com"))
acct = w3.eth.account.from_key(os.environ["PK"])
tx = requests.post(f"{API}/tx/buy", json={
"token": "0x…", "ethIn": "0.1", "slippageBps": 300,
}).json()["tx"]
signed = acct.sign_transaction({
"to": tx["to"], "data": tx["data"], "value": int(tx["value"]),
"chainId": tx["chainId"], "gas": 300000,
"nonce": w3.eth.get_transaction_count(acct.address),
"maxFeePerGas": w3.eth.gas_price * 2, "maxPriorityFeePerGas": 1,
})
# broadcast yourself…
print(w3.eth.send_raw_transaction(signed.raw_transaction).hex())
# …or hand the bytes to us:
requests.post(f"{API}/tx/send", json={"rawTransaction": signed.raw_transaction.hex()})Slippage & deadlines
- Pass
slippageBpsand the API pulls a live quote and computesminTokensOut/minEthOutfor you (e.g.300= 3%). Or set the floor explicitly. - A buy that would overshoot graduation is partially filled and refunded — set your slippage floor accordingly.
- Every trade carries a
deadline(unix seconds, default now + 20 min). It reverts withExpiredif mined too late.
Heads up.Selling requires a prior ERC-20
approve of the launchpad on the token contract. The build endpoint can't do that for you — it's a separate transaction from your wallet.