Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: add portfolio dashboard with wallet address lookup and styling

fudjiafdc4c55d60a7
diff --git a/api/_lib/service-catalog/services/index.js b/api/_lib/service-catalog/services/index.js
index 31a4427ce..88152e4c8 100644
--- a/api/_lib/service-catalog/services/index.js
+++ b/api/_lib/service-catalog/services/index.js
@@ -68,6 +68,7 @@ import solanaRegisterHealth from './solana-register-health.js';
import spendSession from './spend-session.js';
import telegramHealth from './telegram-health.js';
import walletConnect from './wallet-connect.js';
+import robinhoodPortfolio from './robinhood-portfolio.js';
export const PAID_SERVICES = Object.freeze([
modelCheck,
@@ -128,4 +129,5 @@ export const PAID_SERVICES = Object.freeze([
spendSession,
telegramHealth,
walletConnect,
+ robinhoodPortfolio,
]);
diff --git a/api/v1/robinhood/portfolio.js b/api/v1/robinhood/portfolio.js
new file mode 100644
index 000000000..6cc749079
--- /dev/null
+++ b/api/v1/robinhood/portfolio.js
@@ -0,0 +1,116 @@
+// GET /api/v1/robinhood/portfolio?address=0x… — x402-paid, $0.002 USDC.
+//
+// Multiplier-correct full Stock Token portfolio for any Robinhood Chain wallet:
+// every held symbol's true position (raw ERC-20 balance × ERC-8056
+// uiMultiplier — corporate actions already folded in) priced against the
+// on-chain Chainlink NAV feed, plus a total USD value. One multicall for
+// balances, joined against the cached Chainlink snapshot — never 95 reads.
+
+import { paidEndpoint } from '../../_lib/x402-paid-endpoint.js';
+import { buildBazaarSchema } from '../../_lib/x402-spec.js';
+import { installAccessControl } from '../../_lib/x402/access-control.js';
+import { withService } from '../../_lib/x402/bazaar-helpers.js';
+import { priceFor } from '../../_lib/x402-prices.js';
+import { isValidEvmAddress } from '../../_lib/validate.js';
+import robinhoodPortfolioListing from '../../_lib/service-catalog/services/robinhood-portfolio.js';
+import { walletStockPortfolio, asOf } from '../../_lib/robinhood.js';
+
+const ROUTE = '/api/v1/robinhood/portfolio';
+
+// Single source of truth: the service-catalog descriptor is the storefront
+// listing copy — importing it here keeps the live 402 challenge in sync with
+// what /.well-known/x402.json and the OKX projection advertise.
+const DESCRIPTION = robinhoodPortfolioListing.description;
+
+const INPUT_EXAMPLE = { address: '0x9701fb0aDe1E269c8f64Ec0C7b3cfADB31A13A52' };
+
+const INPUT_SCHEMA = {
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
+ type: 'object',
+ required: ['address'],
+ properties: {
+ address: { type: 'string', description: 'EVM wallet address to value (0x… 40 hex chars).' },
+ },
+};
+
+const OUTPUT_EXAMPLE = {
+ owner: '0x9701fb0aDe1E269c8f64Ec0C7b3cfADB31A13A52',
+ positions: [
+ {
+ symbol: 'AAPL',
+ name: 'Apple • Robinhood Token',
+ address: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9',
+ rawBalance: '1000000000000000000',
+ uiMultiplier: '1000000000000000000',
+ shares: 1,
+ navPriceUsd: 315.5,
+ valueUsd: 315.5,
+ },
+ ],
+ totalValueUsd: 315.5,
+ positionCount: 1,
+ source: 'chainlink (on-chain multicall)',
+ asOf: '2026-07-12T00:00:00.000Z',
+};
+
+const OUTPUT_SCHEMA = {
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
+ type: 'object',
+ required: ['owner', 'positions', 'totalValueUsd', 'positionCount'],
+ properties: {
+ owner: { type: 'string' },
+ positions: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ symbol: { type: 'string' },
+ name: { type: 'string' },
+ address: { type: 'string' },
+ rawBalance: { type: 'string' },
+ uiMultiplier: { type: 'string' },
+ shares: { type: 'number' },
+ navPriceUsd: { type: ['number', 'null'] },
+ valueUsd: { type: ['number', 'null'] },
+ },
+ },
+ },
+ totalValueUsd: { type: 'number' },
+ positionCount: { type: 'integer' },
+ },
+};
+
+const BAZAAR = {
+ discoverable: true,
+ info: {
+ input: { type: 'http', method: 'GET', queryParams: INPUT_EXAMPLE },
+ output: { type: 'json', example: OUTPUT_EXAMPLE },
+ },
+ schema: buildBazaarSchema({ method: 'GET', queryParamsSchema: INPUT_SCHEMA, outputSchema: OUTPUT_SCHEMA }),
+};
+
+export default paidEndpoint({
+ route: ROUTE,
+ method: 'GET',
+ priceAtomics: priceFor('robinhood-portfolio', '2000'),
+ networks: ['base', 'solana'],
+ description: DESCRIPTION,
+ bazaar: BAZAAR,
+ service: withService({
+ serviceName: 'Robinhood Chain Portfolio',
+ tags: ['robinhood', 'stocks', 'portfolio', 'rwa', 'x402'],
+ }),
+ requiredScope: 'x402:bypass',
+ accessControl: installAccessControl({ requiredScope: 'x402:bypass' }),
+ async handler({ req }) {
+ const address = String(req.query?.address || '').trim();
+ if (!address || !isValidEvmAddress(address)) {
+ const err = new Error('query param "address" must be a valid EVM address');
+ err.status = 400;
+ err.code = 'validation_error';
+ throw err;
+ }
+ const portfolio = await walletStockPortfolio(address);
+ return { ...portfolio, source: 'chainlink (on-chain multicall)', asOf: asOf() };
+ },
+});
diff --git a/robinhood/hood-api/src/lib/x402.ts b/robinhood/hood-api/src/lib/x402.ts
index dfcaa68ba..bfe3cd31c 100644
--- a/robinhood/hood-api/src/lib/x402.ts
+++ b/robinhood/hood-api/src/lib/x402.ts
@@ -19,10 +19,10 @@ function facilitatorConfig(): FacilitatorConfig | undefined {
// Base mainnet USDC settlement via the CDP facilitator.
return {
url: 'https://api.cdp.coinbase.com/platform/v2/x402' as FacilitatorConfig['url'],
- createAuthHeaders: async () => ({
- verify: { Authorization: `Bearer ${env.cdpApiKeyId}:${env.cdpApiKeySecret}` },
- settle: { Authorization: `Bearer ${env.cdpApiKeyId}:${env.cdpApiKeySecret}` },
- }),
+ createAuthHeaders: async () => {
+ const auth = { Authorization: `Bearer ${env.cdpApiKeyId}:${env.cdpApiKeySecret}` }
+ return { verify: auth, settle: auth, supported: auth }
+ },
}
}
// base-sepolia default: the public x402.org facilitator (or an operator override).
diff --git a/robinhood/hood-api/src/services/chain.ts b/robinhood/hood-api/src/services/chain.ts
index 8f72c1e52..e32779d71 100644
--- a/robinhood/hood-api/src/services/chain.ts
+++ b/robinhood/hood-api/src/services/chain.ts
@@ -17,7 +17,7 @@ export async function getChain() {
defillama.getChainTvl().catch(() => null),
])
- const source = [SOURCE.rpc]
+ const source: string[] = [SOURCE.rpc]
if (stats) source.push(SOURCE.blockscout)
if (tvlUsd !== null) source.push(SOURCE.defillama)
diff --git a/robinhood/hood-api/src/services/stocks.ts b/robinhood/hood-api/src/services/stocks.ts
index d5dd797a4..1012cbe67 100644
--- a/robinhood/hood-api/src/services/stocks.ts
+++ b/robinhood/hood-api/src/services/stocks.ts
@@ -108,7 +108,7 @@ export async function getStockDetail(symbolRaw: string, interval: string) {
getCandles(client, token.address as Address, eth, { interval, lookbackBlocks: 900_000n }).catch(() => null),
])
- const source = [SOURCE.registry, SOURCE.chainlink, SOURCE.uniswap]
+ const source: string[] = [SOURCE.registry, SOURCE.chainlink, SOURCE.uniswap]
if (counters) source.push(SOURCE.blockscout)
return withMeta(
diff --git a/robinhood/hood-api/src/upstreams/dex.ts b/robinhood/hood-api/src/upstreams/dex.ts
index f085f2e89..623054ce5 100644
--- a/robinhood/hood-api/src/upstreams/dex.ts
+++ b/robinhood/hood-api/src/upstreams/dex.ts
@@ -10,11 +10,15 @@ import {
V3_FEE_TIERS,
erc20Abi,
uniswapV3FactoryAbi,
- uniswapV3PoolAbi,
quoteSwap,
type HoodClient,
} from 'hoodchain'
+/** `token0()` isn't in the SDK's minimal pool ABI (it only ships liquidity/slot0) — read it directly. */
+const poolToken0Abi = [
+ { type: 'function', name: 'token0', stateMutability: 'view', inputs: [], outputs: [{ type: 'address' }] },
+] as const
+
/**
* On-chain Uniswap v3 market data for Robinhood Chain Stock Tokens: mid price
* (quoted vs USDG), the deepest pool, liquidity in USD, and — for the detail
@@ -308,10 +312,8 @@ export async function getCandles(
const chosen = pools[bestIdx]!
// token0/token1 ordering fixes the sign convention for amount0/amount1.
- const [token0] = await Promise.all([
- client.public.readContract({ address: chosen.pool, abi: uniswapV3PoolAbi, functionName: 'token0' }),
- ])
- const tokenIsToken0 = (token0 as Address).toLowerCase() === token.toLowerCase()
+ const token0 = await client.public.readContract({ address: chosen.pool, abi: poolToken0Abi, functionName: 'token0' })
+ const tokenIsToken0 = token0.toLowerCase() === token.toLowerCase()
const quoteDecimals = chosen.quote === 'USDG' ? 6 : 18
const quoteToUsd = chosen.quote === 'USDG' ? 1 : (ethPriceUsd ?? 0)
diff --git a/robinhood/hood-cli/src/commands/deploy-token.ts b/robinhood/hood-cli/src/commands/deploy-token.ts
new file mode 100644
index 000000000..10d36ce12
--- /dev/null
+++ b/robinhood/hood-cli/src/commands/deploy-token.ts
@@ -0,0 +1,153 @@
+import { Command } from 'commander'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+import { encodeDeployData, isAddress } from 'viem'
+import { runWith } from '../action.js'
+import type { Context } from '../context.js'
+import { HOOD_TOKEN_ABI, HOOD_TOKEN_BYTECODE, HOOD_TOKEN_COMPILER } from '../generated/erc20.js'
+import { printResult } from '../output.js'
+import { renderKeyValue } from '../ui/table.js'
+import { withSpinner } from '../ui/spinner.js'
+import { confirm } from '../prompt.js'
+import { accent, bold, dim, gray, green, yellow } from '../ui/ansi.js'
+import { addr, num } from '../format.js'
+import { txUrl, addressUrl } from '../blockscout.js'
+import { guardError, usageError } from '../errors.js'
+
+interface TokenConfig {
+ name: string
+ symbol: string
+ decimals?: number
+ initialSupply: number
+}
+
+export function deployTokenCommand(): Command {
+ return new Command('deploy-token')
+ .description('Deploy a fixed-supply ERC-20 from a JSON config (direct-rail, no launchpad)')
+ .requiredOption('--config <path>', 'path to a JSON file: { name, symbol, decimals?, initialSupply }')
+ .option('--execute', 'sign and send (default: print the plan only)', false)
+ .action((opts, command) =>
+ runWith(command, async (ctx) => {
+ await deployToken(ctx, opts)
+ }),
+ )
+}
+
+interface DeployOpts {
+ config: string
+ execute: boolean
+}
+
+async function deployToken(ctx: Context, opts: DeployOpts): Promise<void> {
+ const config = readConfig(opts.config)
+ const decimals = config.decimals ?? 18
+
+ const deployData = encodeDeployData({
+ abi: HOOD_TOKEN_ABI,
+ bytecode: HOOD_TOKEN_BYTECODE,
+ args: [config.name, config.symbol, decimals, BigInt(config.initialSupply)],
+ })
+
+ const plan = {
+ network: ctx.network,
+ name: config.name,
+ symbol: config.symbol,
+ decimals,
+ initialSupply: config.initialSupply,
+ compiler: HOOD_TOKEN_COMPILER.version,
+ bytecodeBytes: (deployData.length - 2) / 2,
+ }
+
+ if (!opts.execute) {
+ printResult(plan, () => renderPlan(plan, false), ctx.json)
+ return
+ }
+
+ const client = await ctx.wallet()
+ if (!ctx.json) process.stdout.write(renderPlan(plan, true) + '\n\n')
+ if (!ctx.assumeYes) {
+ const ok = await confirm(`Deploy ${config.symbol} (${num(config.initialSupply, 0)} supply) on ${ctx.network}? This costs gas and cannot be undone.`)
+ if (!ok) throw guardError('Deploy cancelled.')
+ }
+
+ const hash = await withSpinner('Deploying…', () =>
+ client.wallet!.deployContract({
+ abi: HOOD_TOKEN_ABI,
+ bytecode: HOOD_TOKEN_BYTECODE,
+ args: [config.name, config.symbol, decimals, BigInt(config.initialSupply)],
+ account: client.account!,
+ chain: client.chain,
+ }),
+ )
+ const receipt = await withSpinner('Confirming…', () => client.public.waitForTransactionReceipt({ hash }))
+
+ if (!receipt.contractAddress) {
+ throw guardError('Deployment transaction confirmed but returned no contract address.', 'Check the transaction on the explorer.')
+ }
+
+ const result = {
+ ...plan,
+ hash,
+ status: receipt.status,
+ address: receipt.contractAddress,
+ explorer: txUrl(ctx.network, hash),
+ tokenExplorer: addressUrl(ctx.network, receipt.contractAddress),
+ }
+ printResult(result, () => renderResult(result), ctx.json)
+ if (receipt.status !== 'success') process.exitCode = 1
+}
+
+function readConfig(path: string): TokenConfig {
+ let raw: string
+ try {
+ raw = readFileSync(resolve(path), 'utf8')
+ } catch {
+ throw usageError(`Could not read config file "${path}".`)
+ }
+ let parsed: unknown
+ try {
+ parsed = JSON.parse(raw)
+ } catch {
+ throw usageError(`"${path}" is not valid JSON.`)
+ }
+ const c = parsed as Partial<TokenConfig>
+ if (typeof c.name !== 'string' || !c.name.trim()) throw usageError('Config "name" must be a non-empty string.')
+ if (typeof c.symbol !== 'string' || !c.symbol.trim()) throw usageError('Config "symbol" must be a non-empty string.')
+ if (c.decimals !== undefined && (!Number.isInteger(c.decimals) || c.decimals < 0 || c.decimals > 255)) {
+ throw usageError('Config "decimals" must be an integer 0-255.')
+ }
+ if (!Number.isInteger(c.initialSupply) || (c.initialSupply as number) <= 0) {
+ throw usageError('Config "initialSupply" must be a positive whole-token integer.')
+ }
+ return { name: c.name, symbol: c.symbol, decimals: c.decimals, initialSupply: c.initialSupply as number }
+}
+
+function renderPlan(
+ p: { network: string; name: string; symbol: string; decimals: number; initialSupply: number; compiler: string; bytecodeBytes: number },
+ confirming: boolean,
+): string {
+ const header = confirming
+ ? `${yellow('⚠')} ${bold('Confirm deploy')} ${dim('· ' + p.network)}`
+ : `${accent('◈')} ${bold('Deploy plan')} ${dim('· ' + p.network + ' · add --execute to send')}`
+ const pairs: [string, string][] = [
+ ['Name', bold(p.name)],
+ ['Symbol', bold(p.symbol)],
+ ['Decimals', String(p.decimals)],
+ ['Supply', num(p.initialSupply, 0) + ' ' + p.symbol],
+ ['Compiler', dim(p.compiler)],
+ ['Bytecode', dim(p.bytecodeBytes + ' bytes')],
+ ]
+ return `${header}\n${renderKeyValue(pairs, { labelWidth: 9 })}`
+}
+
+function renderResult(r: { address: string; hash: string; status: string; explorer: string; tokenExplorer: string; symbol: string }): string {
+ const badge = r.status === 'success' ? green('✓ deployed') : dim('✗ reverted')
+ return `${badge}\n${renderKeyValue(
+ [
+ ['Token', bold(r.symbol) + ' ' + gray(addr(r.address as `0x${string}`))],
+ ['Tx', gray(addr(r.hash as `0x${string}`))],
+ ['Explorer', gray(r.tokenExplorer)],
+ ],
+ { labelWidth: 9 },
+ )}`
+}
diff --git a/robinhood/hood-cli/src/commands/faucet.ts b/robinhood/hood-cli/src/commands/faucet.ts
new file mode 100644
index 000000000..bde4364c5
--- /dev/null
+++ b/robinhood/hood-cli/src/commands/faucet.ts
@@ -0,0 +1,90 @@
+import { Command } from 'commander'
+import { formatEther, formatUnits } from 'viem'
+import { TESTNET_ADDRESSES, TESTNET_STOCK_TOKENS, erc20Abi } from 'hoodchain'
+import { runWith } from '../action.js'
+import type { Context } from '../context.js'
+import { printResult } from '../output.js'
+import { renderKeyValue } from '../ui/table.js'
+import { withSpinner } from '../ui/spinner.js'
+import { accent, bold, dim, gray, underline } from '../ui/ansi.js'
+import { num } from '../format.js'
+import { usageError } from '../errors.js'
+
+const FAUCET_URL = 'https://faucet.testnet.chain.robinhood.com/'
+const CHAINLINK_FAUCET_URL = 'https://faucets.chain.link/robinhood-testnet'
+
+export function faucetCommand(): Command {
+ return new Command('faucet')
+ .description('Print testnet faucet instructions + current testnet balances')
+ .action((_opts, command) =>
+ runWith(command, async (ctx) => {
+ await faucet(ctx)
+ }),
+ )
+}
+
+async function faucet(ctx: Context): Promise<void> {
+ if (ctx.network !== 'testnet') {
+ throw usageError('The faucet is testnet-only.', 'Re-run with --network testnet.')
+ }
+
+ let address: string | null = null
+ let balances: { eth: string; tokens: { symbol: string; balance: string }[] } | null = null
+ try {
+ const client = await ctx.wallet()
+ address = client.account!.address
+ balances = await withSpinner('Reading testnet balances…', async () => {
+ const owner = client.account!.address
+ const [eth, ...tokenBalances] = await Promise.all([
+ client.public.getBalance({ address: owner }),
+ ...Object.entries(TESTNET_STOCK_TOKENS).map(([symbol, token]) =>
+ client.public
+ .readContract({ address: token, abi: erc20Abi, functionName: 'balanceOf', args: [owner] })
+ .then((b) => ({ symbol, balance: formatUnits(b, 18) })),
+ ),
+ ])
+ return { eth: formatEther(eth), tokens: tokenBalances }
+ })
+ } catch {
+ // No wallet configured — instructions only, no balance section.
+ }
+
+ const json = {
+ network: 'testnet',
+ chainId: 46630,
+ faucetUrl: FAUCET_URL,
+ chainlinkFaucetUrl: CHAINLINK_FAUCET_URL,
+ note: 'The faucet requires Cloudflare Turnstile + Google Sign-In in a real browser and cannot be automated from a CLI. One claim per 24h drips testnet ETH plus 5 of each: TSLA, AMZN, PLTR, NFLX, AMD.',
+ address,
+ balances,
+ }
+
+ printResult(json, () => renderFaucet(json), ctx.json)
+}
+
+function renderFaucet(j: {
+ faucetUrl: string
+ chainlinkFaucetUrl: string
+ address: string | null
+ balances: { eth: string; tokens: { symbol: string; balance: string }[] } | null
+}): string {
+ const header = `${accent('◈')} ${bold('Testnet faucet')} ${dim('· chain 46630')}`
+ const instructions = [
+ dim('The faucet needs a browser session (Cloudflare Turnstile + Google Sign-In) —'),
+ dim('this cannot be automated from a CLI. Claim once per 24h at:'),
+ '',
+ ` ${underline(j.faucetUrl)}`,
+ ` ${dim('Chainlink ETH top-up:')} ${underline(j.chainlinkFaucetUrl)}`,
+ '',
+ dim('Each claim drips testnet ETH + 5 of each: TSLA, AMZN, PLTR, NFLX, AMD.'),
+ ].join('\n')
+
+ if (!j.address || !j.balances) {
+ return `${header}\n${instructions}\n\n${dim('No wallet configured — run `hood config set wallet` to see your testnet balances here.')}`
+ }
+
+ const rows: [string, string][] = [['ETH', num(Number(j.balances.eth), 6)]]
+ for (const t of j.balances.tokens) rows.push([t.symbol, num(Number(t.balance), 4)])
+
+ return `${header}\n${instructions}\n\n${dim('Wallet ' + j.address)}\n${renderKeyValue(rows, { labelWidth: 6 })}`
+}
diff --git a/robinhood/hood-cli/src/commands/swap.ts b/robinhood/hood-cli/src/commands/swap.ts
new file mode 100644
index 000000000..dc4213a9c
--- /dev/null
+++ b/robinhood/hood-cli/src/commands/swap.ts
@@ -0,0 +1,133 @@
+import { Command } from 'commander'
+import { formatUnits, parseUnits } from 'viem'
+import { quoteSwap, buildSwapTx, ensureApproval, StockTokenEligibilityError } from 'hoodchain'
+import { runWith } from '../action.js'
+import type { Context } from '../context.js'
+import { resolveToken } from '../resolve.js'
+import { printResult } from '../output.js'
+import { renderKeyValue } from '../ui/table.js'
+import { withSpinner } from '../ui/spinner.js'
+import { confirm } from '../prompt.js'
+import { accent, bold, dim, gray, green, yellow } from '../ui/ansi.js'
+import { num, addr } from '../format.js'
+import { txUrl } from '../blockscout.js'
+import { guardError, usageError } from '../errors.js'
+
+export function swapCommand(): Command {
+ return new Command('swap')
+ .description('Quote (default) or execute a Uniswap v3 swap between two tokens')
+ .requiredOption('--sell <token>', 'ticker or address to sell (e.g. USDG)')
+ .requiredOption('--buy <token>', 'ticker or address to buy')
+ .requiredOption('--amount <amount>', 'amount of --sell to spend, in whole tokens')
+ .option('--slippage <bps>', 'slippage tolerance in basis points', '50')
+ .option('--execute', 'sign and send (default: quote only)', false)
+ .action((opts, command) =>
+ runWith(command, async (ctx) => {
+ await swap(ctx, opts)
+ }),
+ )
+}
+
+interface SwapOpts {
+ sell: string
+ buy: string
+ amount: string
+ slippage: string
+ execute: boolean
+}
+
+async function swap(ctx: Context, opts: SwapOpts): Promise<void> {
+ const slippageBps = Number(opts.slippage)
+ if (!Number.isFinite(slippageBps) || slippageBps < 0 || slippageBps > 5000) {
+ throw usageError('--slippage must be a basis-point value between 0 and 5000 (50%).')
+ }
+
+ const client = opts.execute ? await ctx.wallet() : ctx.read()
+ const [tokenIn, tokenOut] = await Promise.all([resolveToken(client, opts.sell), resolveToken(client, opts.buy)])
+ const amountIn = parseUnits(opts.amount, tokenIn.decimals)
+ if (amountIn <= 0n) throw usageError('--amount must be greater than zero.')
+
+ const quote = await withSpinner(`Quoting ${tokenIn.symbol} → ${tokenOut.symbol}…`, () =>
+ quoteSwap(client, { tokenIn: tokenIn.address, tokenOut: tokenOut.address, amountIn }),
+ )
+
+ const amountOut = formatUnits(quote.amountOut, tokenOut.decimals)
+ const minOut = formatUnits((quote.amountOut * BigInt(10_000 - slippageBps)) / 10_000n, tokenOut.decimals)
+ const rate = Number(amountOut) / Number(opts.amount)
+
+ const summary = {
+ network: ctx.network,
+ sell: { symbol: tokenIn.symbol, amount: opts.amount },
+ buy: { symbol: tokenOut.symbol, amount: amountOut, minimum: minOut },
+ rate,
+ hops: quote.route.fees.length,
+ slippageBps,
+ }
+
+ if (!opts.execute) {
+ printResult(summary, () => renderQuote(summary, false), ctx.json)
+ return
+ }
+
+ // Write path: money-moving action — render the confirmation table and stop
+ // for explicit yes/no before signing, per CLAUDE.md's irreversible-action gate.
+ if (!ctx.json) process.stdout.write(renderQuote(summary, true) + '\n\n')
+ if (!ctx.assumeYes) {
+ const ok = await confirm(`Swap ${opts.amount} ${tokenIn.symbol} for ~${num(Number(amountOut), 6)} ${tokenOut.symbol}?`)
+ if (!ok) throw guardError('Swap cancelled.')
+ }
+
+ try {
+ const approvalHash = await withSpinner(`Checking ${tokenIn.symbol} allowance…`, () =>
+ ensureApproval(client, tokenIn.address, amountIn),
+ )
+ if (approvalHash && !ctx.json) process.stderr.write(dim(`Approved router: ${txUrl(ctx.network, approvalHash)}\n`))
+
+ const tx = buildSwapTx(client, quote, { slippageBps })
+ const hash = await withSpinner('Sending swap…', () =>
+ client.wallet!.sendTransaction({ to: tx.to, data: tx.data, value: tx.value, account: client.account!, chain: client.chain }),
+ )
+ const receipt = await withSpinner('Confirming…', () => client.public.waitForTransactionReceipt({ hash }))
+
+ const result = { ...summary, hash, status: receipt.status, explorer: txUrl(ctx.network, hash) }
+ printResult(result, () => renderResult(result), ctx.json)
+ if (receipt.status !== 'success') process.exitCode = 1
+ } catch (err) {
+ if (err instanceof StockTokenEligibilityError) {
+ throw guardError(
+ 'Stock Token acquisition is gated for non-affirmed operators.',
+ 'Re-run with --acknowledge-eligibility if you are eligible (not a US/CA/UK/CH person).',
+ )
+ }
+ throw err
+ }
+}
+
+function renderQuote(
+ s: { network: string; sell: { symbol: string; amount: string }; buy: { symbol: string; amount: string; minimum: string }; rate: number; hops: number; slippageBps: number },
+ confirming: boolean,
+): string {
+ const header = confirming
+ ? `${yellow('⚠')} ${bold('Confirm swap')} ${dim('· ' + s.network)}`
+ : `${accent('◈')} ${bold('Swap quote')} ${dim('· ' + s.network + ' · add --execute to send')}`
+ const pairs: [string, string][] = [
+ ['Sell', bold(s.sell.amount) + ' ' + s.sell.symbol],
+ ['Buy', bold(`~${s.buy.amount}`) + ' ' + s.buy.symbol],
+ ['Min. received', dim(s.buy.minimum + ' ' + s.buy.symbol + ` (${(s.slippageBps / 100).toFixed(2)}% slippage)`)],
+ ['Rate', `1 ${s.sell.symbol} ≈ ${num(s.rate, 6)} ${s.buy.symbol}`],
+ ['Route', dim(s.hops === 1 ? 'direct pool' : `${s.hops}-hop route`)],
+ ]
+ return `${header}\n${renderKeyValue(pairs, { labelWidth: 14 })}`
+}
+
+function renderResult(r: { hash: string; status: string; explorer: string; buy: { symbol: string; amount: string } }): string {
+ const badge = r.status === 'success' ? green('✓ swap confirmed') : dim('✗ reverted')
+ return `${badge}\n${renderKeyValue(
+ [
+ ['Received', bold(`~${r.buy.amount}`) + ' ' + r.buy.symbol],
+ ['Tx', gray(addr(r.hash as `0x${string}`))],
+ ['Explorer', gray(r.explorer)],
+ ],
+ { labelWidth: 9 },
+ )}`
+}
diff --git a/robinhood/hood-cli/src/commands/token.ts b/robinhood/hood-cli/src/commands/token.ts
new file mode 100644
index 000000000..b316931d9
--- /dev/null
+++ b/robinhood/hood-cli/src/commands/token.ts
@@ -0,0 +1,92 @@
+import { Command } from 'commander'
+import { getMultiplier, erc20Abi } from 'hoodchain'
+import { runWith } from '../action.js'
+import type { Context } from '../context.js'
+import { getOracleQuote, getDexPriceUsd } from '../prices.js'
+import { printResult } from '../output.js'
+import { renderKeyValue } from '../ui/table.js'
+import { withSpinner } from '../ui/spinner.js'
+import { accent, bold, dim, gray } from '../ui/ansi.js'
+import { usd, num, addr, age } from '../format.js'
+import { fetchToken, addressUrl } from '../blockscout.js'
+import { resolveToken } from '../resolve.js'
+
+export function tokenCommand(): Command {
+ return new Command('token')
+ .description('Inspect a token: metadata, supply, multiplier, price')
+ .argument('<address>', 'token address or ticker')
+ .action((address: string, _opts, command) =>
+ runWith(command, async (ctx) => {
+ await token(ctx, address)
+ }),
+ )
+}
+
+async function token(ctx: Context, input: string): Promise<void> {
+ const client = ctx.read()
+ const resolved = await resolveToken(client, input)
+
+ const { meta, multiplier, oracle, dexUsd, totalSupply } = await withSpinner(`Reading ${resolved.symbol}…`, async () => {
+ const [meta, multiplier, oracle, dexUsd, totalSupply] = await Promise.all([
+ fetchToken(ctx.network, resolved.address),
+ resolved.isStock ? getMultiplier(client, resolved.symbol) : Promise.resolve(null),
+ resolved.hasFeed ? getOracleQuote(client, resolved.symbol) : Promise.resolve(null),
+ getDexPriceUsd(client, resolved.address, resolved.decimals),
+ client.public
+ .readContract({ address: resolved.address, abi: erc20Abi, functionName: 'totalSupply' })
+ .catch(() => null) as Promise<bigint | null>,
+ ])
+ return { meta, multiplier, oracle, dexUsd, totalSupply }
+ })
+
+ const json = {
+ address: resolved.address,
+ symbol: meta?.symbol ?? resolved.symbol,
+ name: meta?.name ?? null,
+ decimals: resolved.decimals,
+ isStockToken: resolved.isStock,
+ totalSupply: totalSupply !== null ? Number(totalSupply) / 10 ** resolved.decimals : null,
+ holders: meta?.holders_count ? Number(meta.holders_count) : meta?.holders ? Number(meta.holders) : null,
+ uiMultiplier: multiplier !== null ? Number(multiplier) / 1e18 : null,
+ oracleUsd: oracle?.priceUsd ?? null,
+ oracleAgeSeconds: oracle?.ageSeconds ?? null,
+ dexUsd,
+ explorer: addressUrl(ctx.network, resolved.address),
+ }
+
+ printResult(json, () => renderToken(json, resolved.isStock), ctx.json)
+}
+
+function renderToken(
+ j: {
+ address: string
+ symbol: string
+ name: string | null
+ decimals: number
+ isStockToken: boolean
+ totalSupply: number | null
+ holders: number | null
+ uiMultiplier: number | null
+ oracleUsd: number | null
+ oracleAgeSeconds: number | null
+ dexUsd: number | null
+ explorer: string
+ },
+ isStock: boolean,
+): string {
+ const header = `${accent('◈')} ${bold(j.symbol)} ${dim(j.name ? '· ' + j.name : '')}`
+ const pairs: [string, string][] = [
+ ['Address', gray(addr(j.address as `0x${string}`))],
+ ['Decimals', String(j.decimals)],
+ ['Supply', j.totalSupply !== null ? num(j.totalSupply, 0) : dim('—')],
+ ['Holders', j.holders !== null ? num(j.holders, 0) : dim('—')],
+ ]
+ if (isStock) {
+ pairs.push(['Multiplier', j.uiMultiplier !== null ? `${num(j.uiMultiplier, 6)}×` : dim('n/a')])
+ pairs.push(['Oracle', j.oracleUsd !== null ? bold(usd(j.oracleUsd)) : dim('no feed')])
+ if (j.oracleAgeSeconds !== null) pairs.push(['Updated', dim(age(j.oracleAgeSeconds) + ' ago')])
+ }
+ pairs.push(['DEX price', j.dexUsd !== null ? usd(j.dexUsd) : dim('no pool')])
+ pairs.push(['Explorer', gray(j.explorer)])
+ return `${header}\n${renderKeyValue(pairs, { labelWidth: 10 })}`
+}
diff --git a/robinhood/hood-cli/src/commands/transfer.ts b/robinhood/hood-cli/src/commands/transfer.ts
new file mode 100644
index 000000000..b0a36c996
--- /dev/null
+++ b/robinhood/hood-cli/src/commands/transfer.ts
@@ -0,0 +1,100 @@
+import { Command } from 'commander'
+import { formatEther, formatUnits, getAddress, isAddress, parseEther, parseUnits } from 'viem'
+import { erc20Abi } from 'hoodchain'
+import { runWith } from '../action.js'
+import type { Context } from '../context.js'
+import { resolveToken } from '../resolve.js'
+import { printResult } from '../output.js'
+import { renderKeyValue } from '../ui/table.js'
+import { withSpinner } from '../ui/spinner.js'
+import { confirm } from '../prompt.js'
+import { bold, dim, gray, green, yellow } from '../ui/ansi.js'
+import { addr } from '../format.js'
+import { txUrl } from '../blockscout.js'
+import { guardError, usageError } from '../errors.js'
+
+export function transferCommand(): Command {
+ return new Command('transfer')
+ .description('Send ETH or an ERC-20 token to an address')
+ .requiredOption('--to <address>', 'recipient address')
+ .requiredOption('--amount <amount>', 'amount to send, in whole tokens')
+ .option('--token <token>', 'ticker or address to send (default: native ETH)')
+ .action((opts, command) =>
+ runWith(command, async (ctx) => {
+ await transfer(ctx, opts)
+ }),
+ )
+}
+
+interface TransferOpts {
+ to: string
+ amount: string
+ token?: string
+}
+
+async function transfer(ctx: Context, opts: TransferOpts): Promise<void> {
+ if (!isAddress(opts.to)) throw usageError(`"${opts.to}" is not a valid recipient address.`)
+ const to = getAddress(opts.to)
+ const client = await ctx.wallet()
+
+ const isNative = !opts.token
+ const symbol = isNative ? 'ETH' : (await resolveToken(client, opts.token as string)).symbol
+ const tokenInfo = isNative ? null : await resolveToken(client, opts.token as string)
+ const amount = isNative ? parseEther(opts.amount) : parseUnits(opts.amount, tokenInfo!.decimals)
+ if (amount <= 0n) throw usageError('--amount must be greater than zero.')
+
+ const balance = isNative
+ ? await client.public.getBalance({ address: client.account!.address })
+ : await client.public.readContract({ address: tokenInfo!.address, abi: erc20Abi, functionName: 'balanceOf', args: [client.account!.address] })
+ if (balance < amount) {
+ throw guardError(
+ `Insufficient balance: hold ${formatBalance(balance, isNative, tokenInfo?.decimals)} ${symbol}, need ${opts.amount}.`,
+ )
+ }
+
+ if (!ctx.json) {
+ process.stdout.write(
+ renderConfirm({ to, amount: opts.amount, symbol, network: ctx.network }) + '\n\n',
+ )
+ }
+ if (!ctx.assumeYes) {
+ const ok = await confirm(`Send ${opts.amount} ${symbol} to ${addr(to)}?`)
+ if (!ok) throw guardError('Transfer cancelled.')
+ }
+
+ const hash = await withSpinner('Sending…', () =>
+ isNative
+ ? client.wallet!.sendTransaction({ to, value: amount, account: client.account!, chain: client.chain })
+ : client.wallet!.writeContract({ address: tokenInfo!.address, abi: erc20Abi, functionName: 'transfer', args: [to, amount], account: client.account!, chain: client.chain }),
+ )
+ const receipt = await withSpinner('Confirming…', () => client.public.waitForTransactionReceipt({ hash }))
+
+ const result = { to, amount: opts.amount, symbol, hash, status: receipt.status, explorer: txUrl(ctx.network, hash) }
+ printResult(result, () => renderResult(result), ctx.json)
+ if (receipt.status !== 'success') process.exitCode = 1
+}
+
+function formatBalance(balance: bigint, isNative: boolean, decimals?: number): string {
+ return isNative ? formatEther(balance) : formatUnits(balance, decimals ?? 18)
+}
+
+function renderConfirm(s: { to: string; amount: string; symbol: string; network: string }): string {
+ const header = `${yellow('⚠')} ${bold('Confirm transfer')} ${dim('· ' + s.network)}`
+ const pairs: [string, string][] = [
+ ['Amount', bold(s.amount) + ' ' + s.symbol],
+ ['To', gray(s.to)],
+ ]
+ return `${header}\n${renderKeyValue(pairs, { labelWidth: 7 })}`
+}
+
+function renderResult(r: { to: string; amount: string; symbol: string; hash: string; status: string; explorer: string }): string {
+ const badge = r.status === 'success' ? green('✓ transfer confirmed') : dim('✗ reverted')
+ return `${badge}\n${renderKeyValue(
+ [
+ ['Sent', bold(r.amount) + ' ' + r.symbol + ' → ' + addr(r.to as `0x${string}`)],
+ ['Tx', gray(addr(r.hash as `0x${string}`))],
+ ['Explorer', gray(r.explorer)],
+ ],
+ { labelWidth: 9 },
+ )}`
+}
diff --git a/robinhood/hood-cli/src/commands/watch.ts b/robinhood/hood-cli/src/commands/watch.ts
new file mode 100644
index 000000000..e5330cfc7
--- /dev/null
+++ b/robinhood/hood-cli/src/commands/watch.ts
@@ -0,0 +1,90 @@
+import { Command } from 'commander'
+import { formatEther, getAddress, isAddress, type Address } from 'viem'
+import { watchTransfers } from 'hoodchain'
+import { runWith } from '../action.js'
+import type { Context } from '../context.js'
+import { accent, bold, dim, gray, green, red } from '../ui/ansi.js'
+import { addr, tokenAmount } from '../format.js'
+import { resolveToken } from '../resolve.js'
+import { usageError } from '../errors.js'
+
+export function watchCommand(): Command {
+ return new Command('watch')
+ .description('Live activity stream for an address or a token (ERC-20 transfers + native ETH)')
+ .argument('<addrOrToken>', 'wallet address, token address, or ticker to watch')
+ .option('--token', 'treat the argument as a token (stream ALL transfers of it)', false)
+ .action((target: string, opts, command) =>
+ runWith(command, async (ctx) => {
+ await watch(ctx, target, opts)
+ }),
+ )
+}
+
+async function watch(ctx: Context, target: string, opts: { token: boolean }): Promise<void> {
+ const client = ctx.read()
+
+ if (opts.token || !isAddress(target)) {
+ const token = await resolveToken(client, target)
+ process.stderr.write(dim(`Watching ${token.symbol} transfers (${addr(token.address)}) — Ctrl-C to stop\n`))
+ const unwatch = watchTransfers(client, { token: token.address }, (t) => {
+ if (ctx.json) {
+ process.stdout.write(JSON.stringify({ ...t, value: t.value.toString() }) + '\n')
+ } else {
+ process.stdout.write(
+ `${gray(addr(t.from))} ${dim('→')} ${gray(addr(t.to))} ${bold(tokenAmount(t.value, token.decimals))} ${accent(token.symbol)} ${dim('#' + t.blockNumber)}\n`,
+ )
+ }
+ })
+ return runUntilInterrupt(unwatch)
+ }
+
+ // Address mode: stream native ETH in/out plus every Stock Token transfer touching it.
+ if (ctx.network !== 'mainnet') throw usageError('Address-mode watch needs the mainnet Stock Token registry — pass --token for a specific testnet token.')
+ const owner = getAddress(target)
+ process.stderr.write(dim(`Watching ${addr(owner)} for activity — Ctrl-C to stop\n`))
+
+ const unwatchEth = client.public.watchBlocks({
+ onBlock: async (block) => {
+ // Cheap native-ETH activity check: scan the block's transactions touching owner.
+ for (const txHash of block.transactions) {
+ const tx = await client.public.getTransaction({ hash: txHash }).catch(() => null)
+ if (!tx) continue
+ if (tx.from.toLowerCase() !== owner.toLowerCase() && tx.to?.toLowerCase() !== owner.toLowerCase()) continue
+ if (tx.value === 0n) continue
+ const out = tx.from.toLowerCase() === owner.toLowerCase()
+ const line = `${out ? red('↑') : green('↓')} ${bold(formatEther(tx.value))} ETH ${dim(out ? 'to' : 'from')} ${gray(addr(out ? (tx.to as Address) : tx.from))} ${dim('#' + block.number)}`
+ if (ctx.json) process.stdout.write(JSON.stringify({ kind: 'eth', hash: tx.hash, from: tx.from, to: tx.to, valueEth: formatEther(tx.value), block: block.number.toString() }) + '\n')
+ else process.stdout.write(line + '\n')
+ }
+ },
+ })
+
+ // Stream Stock Token transfers touching the address (widest-reach single watcher: USDG).
+ const { MAINNET_ADDRESSES } = await import('hoodchain')
+ const unwatchUsdg = watchTransfers(client, { token: MAINNET_ADDRESSES.usdg }, (t) => {
+ if (t.from.toLowerCase() !== owner.toLowerCase() && t.to.toLowerCase() !== owner.toLowerCase()) return
+ const out = t.from.toLowerCase() === owner.toLowerCase()
+ if (ctx.json) {
+ process.stdout.write(JSON.stringify({ kind: 'usdg', ...t, value: t.value.toString() }) + '\n')
+ } else {
+ process.stdout.write(
+ `${out ? red('↑') : green('↓')} ${bold(tokenAmount(t.value, 6))} USDG ${dim(out ? 'to' : 'from')} ${gray(addr(out ? t.to : t.from))} ${dim('#' + t.blockNumber)}\n`,
+ )
+ }
+ })
+
+ return runUntilInterrupt(() => {
+ unwatchEth()
+ unwatchUsdg()
+ })
+}
+
+function runUntilInterrupt(unwatch: () => void): Promise<void> {
+ const shutdown = () => {
+ unwatch()
+ process.exit(0)
+ }
+ process.on('SIGINT', shutdown)
+ process.on('SIGTERM', shutdown)
+ return new Promise(() => {})
+}
diff --git a/robinhood/hood-launcher/src/concept/artwork.ts b/robinhood/hood-launcher/src/concept/artwork.ts
new file mode 100644
index 000000000..ec1e2948d
--- /dev/null
+++ b/robinhood/hood-launcher/src/concept/artwork.ts
@@ -0,0 +1,103 @@
+/**
+ * 3D logo generation on the three.ws public "forge free" lane — hood-
+ * launcher's differentiator: every autonomously-launched coin ships with a
+ * real 3D-rendered GLB logo, generated on the free NVIDIA NIM (Microsoft
+ * TRELLIS) lane, no key/auth/payment required.
+ *
+ * Endpoint shape verified live during this build:
+ * POST https://three.ws/api/forge { prompt, tier: "draft", path: "image" }
+ * returns EITHER a terminal envelope inline (`status:"done"`) or a
+ * `job_id` to poll via `GET /api/forge?job=<id>`. The POST can legitimately
+ * take 40–90s (it sometimes blocks through the whole generation), so a
+ * short client timeout produces false failures — use a generous one.
+ */
+
+const FORGE_BASE = process.env.HOOD_LAUNCHER_FORGE_BASE ?? 'https://three.ws'
+const POST_TIMEOUT_MS = 90_000
+const POLL_INTERVAL_MS = 15_000
+const POLL_BUDGET_MS = 5 * 60_000
+
+interface ForgeEnvelope {
+ status: 'queued' | 'running' | 'done' | 'error' | string
+ job_id: string | null
+ glb_url?: string | null
+ quality?: { score?: number; valid?: boolean } | null
+ error?: string
+}
+
+async function fetchWithTimeout(url: string, init: RequestInit, timeoutMs: number): Promise<Response> {
+ const controller = new AbortController()
+ const timer = setTimeout(() => controller.abort(), timeoutMs)
+ try {
+ return await fetch(url, { ...init, signal: controller.signal })
+ } finally {
+ clearTimeout(timer)
+ }
+}
+
+export interface Generate3dLogoResult {
+ glbUrl: string
+ qualityScore: number | null
+}
+
+/**
+ * Generate a 3D logo GLB from a text prompt on the free forge lane.
+ *
+ * @throws Error when the lane errors out or the polling budget is exhausted
+ * — callers should catch and fall back to {@link resolveLogoUri}'s
+ * plain-image path rather than blocking a launch on a GPU lane hiccup.
+ */
+export async function generate3dLogo(prompt: string): Promise<Generate3dLogoResult> {
+ const postRes = await fetchWithTimeout(
+ `${FORGE_BASE}/api/forge`,
+ {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ prompt, tier: 'draft', path: 'image' }),
+ },
+ POST_TIMEOUT_MS,
+ )
+ if (!postRes.ok) throw new Error(`forge free lane POST failed: ${postRes.status} ${await postRes.text()}`)
+ let envelope = (await postRes.json()) as ForgeEnvelope
+
+ const deadline = Date.now() + POLL_BUDGET_MS
+ while (envelope.status !== 'done' && envelope.status !== 'error' && Date.now() < deadline) {
+ if (!envelope.job_id) break
+ await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS))
+ const pollRes = await fetchWithTimeout(
+ `${FORGE_BASE}/api/forge?job=${encodeURIComponent(envelope.job_id)}`,
+ { method: 'GET' },
+ 30_000,
+ )
+ if (!pollRes.ok) throw new Error(`forge free lane poll failed: ${pollRes.status}`)
+ envelope = (await pollRes.json()) as ForgeEnvelope
+ }
+
+ if (envelope.status === 'error') throw new Error(`forge free lane job failed: ${envelope.error ?? 'unknown error'}`)
+ if (envelope.status !== 'done' || !envelope.glb_url) {
+ throw new Error(`forge free lane did not complete within ${POLL_BUDGET_MS / 1000}s (last status: ${envelope.status})`)
+ }
+ return { glbUrl: envelope.glb_url, qualityScore: envelope.quality?.score ?? null }
+}
+
+/**
+ * Resolve the logo URI a launch will ship with. If `logoUri` is already
+ * supplied (operator config or a hand-picked image/IPFS URI), it is used
+ * as-is — no forge call, no LLM, zero-cost path. Otherwise a 3D logo is
+ * generated from `artworkPrompt` (defaulting to the coin's name+description)
+ * on the free forge lane. On any forge failure the caller falls back to a
+ * plain data URI placeholder is NEVER used — a failure here is a real
+ * failure the caller must handle (e.g. skip the launch, or fall back to an
+ * operator-supplied default logo).
+ */
+export async function resolveLogoUri(input: {
+ logoUri?: string | undefined
+ name: string
+ description: string
+ artworkPrompt?: string | undefined
+}): Promise<{ logoUri: string; source: 'operator-supplied' | 'forge-3d' }> {
+ if (input.logoUri) return { logoUri: input.logoUri, source: 'operator-supplied' }
+ const prompt = input.artworkPrompt ?? `minimalist 3D coin logo emblem for "${input.name}": ${input.description}`.trim()
+ const { glbUrl } = await generate3dLogo(prompt)
+ return { logoUri: glbUrl, source: 'forge-3d' }
+}
diff --git a/robinhood/hood-launcher/src/concept/denylist.ts b/robinhood/hood-launcher/src/concept/denylist.ts
new file mode 100644
index 000000000..8095d6400
--- /dev/null
+++ b/robinhood/hood-launcher/src/concept/denylist.ts
@@ -0,0 +1,73 @@
+import { ConceptRejectedError } from '../errors.js'
+
+/**
+ * Trademarked brands and platforms a launched coin's name/symbol/description
+ * must not impersonate. This is deliberately a short, high-confidence,
+ * word-boundary-matched list — NOT fuzzy/substring/leetspeak matching.
+ * Substring matching on a list like this reliably false-positives on
+ * unrelated real words (this workspace hit exactly that bug once: see
+ * `docs/` history on the ERC-8004 slur gate — naive substring+leet matching
+ * false-flagged 5 of 7 real, legitimate agent names). Extend this list
+ * conservatively; every entry should be a term that has no plausible
+ * legitimate memecoin meaning on its own.
+ */
+export const TRADEMARK_DENYLIST: readonly string[] = [
+ 'robinhood',
+ 'noxa',
+ 'the odyssey',
+ 'uniswap',
+ 'coinbase',
+ 'binance',
+ 'circle',
+ 'tether',
+ 'paxos',
+ 'chainlink',
+ 'metamask',
+ 'opensea',
+ 'pump.fun',
+ 'pumpfun',
+]
+
+/**
+ * A named-real-person denylist. hood-launcher refuses to launch a coin whose
+ * name/symbol is built around a private individual's real name without
+ * their consent baked into the concept (public figures discussed as market
+ * narrative — "trump coin"-style commentary tokens — are a documented grey
+ * area the LLM screen in {@link screenConcept} handles case-by-case; this
+ * list is only for names the operator has explicitly flagged as off-limits).
+ * Empty by default — populate via `HOOD_LAUNCHER_PERSON_DENYLIST` (comma
+ * separated) for operator-specific restrictions.
+ */
+export function personDenylist(env: NodeJS.ProcessEnv = process.env): string[] {
+ return (env.HOOD_LAUNCHER_PERSON_DENYLIST ?? '')
+ .split(',')
+ .map((s) => s.trim())
+ .filter(Boolean)
+}
+
+function wordBoundaryMatch(haystack: string, needle: string): boolean {
+ const escaped = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+ return new RegExp(`(^|[^a-z0-9])${escaped}([^a-z0-9]|$)`, 'i').test(haystack)
+}
+
+/**
+ * Checkable, deterministic denylist gate — runs with zero network/LLM calls
+ * so it always applies, even in fully offline/deterministic launch mode.
+ *
+ * @throws {@link ConceptRejectedError} on the first match.
+ */
+export function checkDenylist(input: { name: string; symbol: string; description: string }, env = process.env): void {
+ const terms = [...TRADEMARK_DENYLIST, ...personDenylist(env)]
+ const fields: Array<['name' | 'symbol' | 'description', string]> = [
+ ['name', input.name],
+ ['symbol', input.symbol],
+ ['description', input.description],
+ ]
+ for (const [field, value] of fields) {
+ for (const term of terms) {
+ if (wordBoundaryMatch(value, term)) {
+ throw new ConceptRejectedError(`contains denylisted term "${term}"`, field)
+ }
+ }
+ }
+}
diff --git a/robinhood/hood-launcher/src/concept/generate.ts b/robinhood/hood-launcher/src/concept/generate.ts
new file mode 100644
index 000000000..53718ce9b
--- /dev/null
+++ b/robinhood/hood-launcher/src/concept/generate.ts
@@ -0,0 +1,51 @@
+import { resolveLlmProvider, parseJsonResponse, llmConfigured } from './llm.js'
+import { ConceptRejectedError } from '../errors.js'
+
+export interface GeneratedConcept {
+ name: string
+ symbol: string
+ description: string
+ lore: string
+}
+
+const GENERATE_SYSTEM_PROMPT = `You invent memecoin concepts for an autonomous launcher on Robinhood Chain.
+Given a theme or trending narrative, invent ONE original coin concept: a catchy name, a short
+ticker (2-8 letters, no $ prefix), a one-line description, and 2-3 sentences of lore/backstory.
+Never name a real private individual. Never use a company/brand name as if the coin WERE that
+brand. Respond with ONLY a JSON object: {"name": string, "symbol": string, "description": string, "lore": string}`
+
+/**
+ * Generate a coin concept from a theme/narrative using the operator's
+ * configured LLM (`OPENAI_API_KEY` / `ANTHROPIC_API_KEY`). This is the
+ * autonomous-mode entry point — fully deterministic/config-first launches
+ * never call this at all.
+ *
+ * @throws {@link ConceptRejectedError} when no LLM is configured (there is
+ * no fabricated fallback for creative generation — that would be fake data).
+ */
+export async function generateConcept(theme: string): Promise<GeneratedConcept> {
+ if (!llmConfigured()) {
+ throw new ConceptRejectedError(
+ 'no LLM configured (set OPENAI_API_KEY or ANTHROPIC_API_KEY) — concept generation requires one; ' +
+ 'fully deterministic launches should supply name/symbol/description directly instead of calling generateConcept',
+ 'concept',
+ )
+ }
+ const provider = resolveLlmProvider()
+ if (!provider) throw new ConceptRejectedError('LLM provider resolution failed unexpectedly', 'concept')
+
+ const raw = await provider.complete(`Theme: ${theme}`, GENERATE_SYSTEM_PROMPT)
+ let concept: GeneratedConcept
+ try {
+ concept = parseJsonResponse(raw)
+ } catch {
+ throw new ConceptRejectedError(`LLM concept generation returned unparseable JSON: ${raw.slice(0, 200)}`, 'concept')
+ }
+ if (!concept.name || !concept.symbol) {
+ throw new ConceptRejectedError('LLM concept generation omitted name or symbol', 'concept')
+ }
+ return {
+ ...concept,
+ symbol: concept.symbol.replace(/^\$/, '').toUpperCase().slice(0, 12),
+ }
+}
diff --git a/robinhood/hood-launcher/src/concept/index.ts b/robinhood/hood-launcher/src/concept/index.ts
new file mode 100644
index 000000000..4c27cd268
--- /dev/null
+++ b/robinhood/hood-launcher/src/concept/index.ts
@@ -0,0 +1,66 @@
+import type { LaunchInput } from '../rails/types.js'
+import type { HoodNetwork } from 'hoodchain'
+import type { LaunchConfig } from '../core/config.js'
+import { screenConcept } from './screen.js'
+import { checkTickerUniqueness } from './uniqueness.js'
+import { resolveLogoUri } from './artwork.js'
+import { generateConcept } from './generate.js'
+
+export { screenConcept } from './screen.js'
+export { checkDenylist, TRADEMARK_DENYLIST } from './denylist.js'
+export { checkTickerUniqueness } from './uniqueness.js'
+export { generate3dLogo, resolveLogoUri } from './artwork.js'
+export { generateConcept } from './generate.js'
+export { llmConfigured, resolveLlmProvider } from './llm.js'
+
+export interface ConceptEngineResult {
+ input: LaunchInput
+ screening: Awaited<ReturnType<typeof screenConcept>>
+ artworkSource: 'operator-supplied' | 'forge-3d'
+}
+
+/**
+ * The full concept pipeline: (generate if `theme` given, else use the
+ * operator-supplied config verbatim) → denylist + LLM safety screen →
+ * on-chain ticker uniqueness → artwork resolution → a ready `LaunchInput`.
+ *
+ * Fully deterministic when `config` already has `name`/`symbol` — zero LLM
+ * calls happen in that path (generation is skipped, and screening degrades
+ * to denylist-only if no LLM key is configured).
+ */
+export async function buildConcept(
+ network: HoodNetwork,
+ config: LaunchConfig,
+ opts: { theme?: string; artworkPrompt?: string } = {},
+): Promise<ConceptEngineResult> {
+ let name = config.name
+ let symbol = config.symbol
+ let description = config.description
+
+ if (opts.theme) {
+ const generated = await generateConcept(opts.theme)
+ name = generated.name
+ symbol = generated.symbol
+ description = generated.description || generated.lore
+ }
+
+ const screening = await screenConcept({ name, symbol, description })
+ await checkTickerUniqueness(network, symbol)
+ const artwork = await resolveLogoUri({
+ logoUri: config.logoUri,
+ name,
+ description,
+ artworkPrompt: opts.artworkPrompt,
+ })
+
+ const input: LaunchInput = {
+ name,
+ symbol,
+ description,
+ logoUri: artwork.logoUri,
+ socials: config.socials,
+ initialBuyWei: BigInt(Math.round(config.initialBuyEth * 1e18)),
+ }
+
+ return { input, screening, artworkSource: artwork.source }
+}
diff --git a/robinhood/hood-launcher/src/concept/llm.ts b/robinhood/hood-launcher/src/concept/llm.ts
new file mode 100644
index 000000000..9c3c27928
--- /dev/null
+++ b/robinhood/hood-launcher/src/concept/llm.ts
@@ -0,0 +1,81 @@
+/**
+ * Minimal LLM client supporting both OpenAI and Anthropic — whichever the
+ * operator configures via `OPENAI_API_KEY` / `ANTHROPIC_API_KEY`. No proxy
+ * of ours sits in between; these are direct calls to each vendor's public
+ * REST API. When neither key is set, {@link llmConfigured} is `false` and
+ * every concept-engine step that needs an LLM falls back to its documented
+ * deterministic/offline behavior instead of throwing.
+ */
+
+export interface LlmProvider {
+ name: 'openai' | 'anthropic'
+ complete(prompt: string, system?: string): Promise<string>
+}
+
+export function llmConfigured(env: NodeJS.ProcessEnv = process.env): boolean {
+ return Boolean(env.OPENAI_API_KEY || env.ANTHROPIC_API_KEY)
+}
+
+/** Resolve the operator's configured LLM provider, or `null` if none is set. */
+export function resolveLlmProvider(env: NodeJS.ProcessEnv = process.env): LlmProvider | null {
+ const preferred = env.CONCEPT_LLM_PROVIDER
+ if ((preferred === 'openai' || !preferred) && env.OPENAI_API_KEY) {
+ return openaiProvider(env.OPENAI_API_KEY, env.CONCEPT_LLM_MODEL ?? 'gpt-4o-mini')
+ }
+ if ((preferred === 'anthropic' || !preferred) && env.ANTHROPIC_API_KEY) {
+ return anthropicProvider(env.ANTHROPIC_API_KEY, env.CONCEPT_LLM_MODEL ?? 'claude-sonnet-5')
+ }
+ return null
+}
+
+function openaiProvider(apiKey: string, model: string): LlmProvider {
+ return {
+ name: 'openai',
+ async complete(prompt, system) {
+ const res = await fetch('https://api.openai.com/v1/chat/completions', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', authorization: `Bearer ${apiKey}` },
+ body: JSON.stringify({
+ model,
+ messages: [...(system ? [{ role: 'system', content: system }] : []), { role: 'user', content: prompt }],
+ temperature: 0.9,
+ }),
+ })
+ if (!res.ok) throw new Error(`OpenAI completion failed: ${res.status} ${await res.text()}`)
+ const json = (await res.json()) as { choices: { message: { content: string } }[] }
+ return json.choices[0]?.message.content ?? ''
+ },
+ }
+}
+
+function anthropicProvider(apiKey: string, model: string): LlmProvider {
+ return {
+ name: 'anthropic',
+ async complete(prompt, system) {
+ const res = await fetch('https://api.anthropic.com/v1/messages', {
+ method: 'POST',
+ headers: {
+ 'content-type': 'application/json',
+ 'x-api-key': apiKey,
+ 'anthropic-version': '2023-06-01',
+ },
+ body: JSON.stringify({
+ model,
+ max_tokens: 1024,
+ ...(system ? { system } : {}),
+ messages: [{ role: 'user', content: prompt }],
+ }),
+ })
+ if (!res.ok) throw new Error(`Anthropic completion failed: ${res.status} ${await res.text()}`)
+ const json = (await res.json()) as { content: { type: string; text?: string }[] }
+ return json.content.find((c) => c.type === 'text')?.text ?? ''
+ },
+ }
+}
+
+/** Parse a JSON object out of an LLM response that may be wrapped in markdown code fences. */
+export function parseJsonResponse<T>(text: string): T {
+ const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/)
+ const raw = fenced ? fenced[1] : text
+ return JSON.parse((raw ?? text).trim()) as T
+}
diff --git a/robinhood/hood-launcher/src/concept/screen.ts b/robinhood/hood-launcher/src/concept/screen.ts
new file mode 100644
index 000000000..3544d6b27
--- /dev/null
+++ b/robinhood/hood-launcher/src/concept/screen.ts
@@ -0,0 +1,55 @@
+import { checkDenylist } from './denylist.js'
+import { resolveLlmProvider, parseJsonResponse } from './llm.js'
+import { ConceptRejectedError } from '../errors.js'
+
+export interface ScreenResult {
+ allowed: boolean
+ reason: string
+ /** Which layer produced the verdict. LLM screening only runs when a key is configured. */
+ layer: 'denylist' | 'llm' | 'llm-unavailable'
+}
+
+const SCREEN_SYSTEM_PROMPT = `You are a safety screen for an autonomous memecoin launcher on Robinhood Chain.
+Given a proposed coin name, ticker, and description, decide if it violates the no-impersonation policy:
+- Refuse names/tickers/descriptions built to impersonate a specific real, named PRIVATE individual (not a public figure) without any indication of consent.
+- Refuse names that impersonate a specific company, product, or brand as if the coin WERE that brand (vs. commentary/parody about a public trend, which is allowed).
+- Public figures, politicians, celebrities, and internet-culture references used as commentary/memes are ALLOWED (this is normal memecoin culture).
+- Generic words, jokes, animals, and abstract concepts are always ALLOWED.
+Respond with ONLY a JSON object: {"allowed": boolean, "reason": "one sentence"}`
+
+/**
+ * Two-layer concept safety screen:
+ * 1. {@link checkDenylist} — deterministic, zero-network, always runs.
+ * 2. An LLM judgment call for impersonation/trademark nuance the denylist
+ * can't catch — only runs when `OPENAI_API_KEY`/`ANTHROPIC_API_KEY` is
+ * configured. Its absence is reported, not silently skipped.
+ *
+ * @throws {@link ConceptRejectedError} when either layer rejects the concept.
+ */
+export async function screenConcept(input: {
+ name: string
+ symbol: string
+ description: string
+}): Promise<ScreenResult> {
+ checkDenylist(input) // throws on match
+
+ const provider = resolveLlmProvider()
+ if (!provider) {
+ return { allowed: true, reason: 'no LLM key configured — denylist-only screening applied', layer: 'llm-unavailable' }
+ }
+
+ const prompt = `Name: ${input.name}\nTicker: ${input.symbol}\nDescription: ${input.description || '(none)'}`
+ const raw = await provider.complete(prompt, SCREEN_SYSTEM_PROMPT)
+ let verdict: { allowed: boolean; reason: string }
+ try {
+ verdict = parseJsonResponse(raw)
+ } catch {
+ // A malformed LLM response should not silently pass a launch through —
+ // fail closed and let the operator retry or fix the prompt/model.
+ throw new ConceptRejectedError(`LLM safety screen returned an unparseable response: ${raw.slice(0, 200)}`, 'concept')
+ }
+ if (!verdict.allowed) {
+ throw new ConceptRejectedError(verdict.reason, 'concept')
+ }
+ return { allowed: true, reason: verdict.reason, layer: 'llm' }
+}
diff --git a/robinhood/hood-launcher/src/concept/uniqueness.ts b/robinhood/hood-launcher/src/concept/uniqueness.ts
new file mode 100644
index 000000000..310a505e9
--- /dev/null
+++ b/robinhood/hood-launcher/src/concept/uniqueness.ts
@@ -0,0 +1,35 @@
+import { explorerApiUrl } from '../core/explorer.js'
+import { TickerTakenError } from '../errors.js'
+import type { HoodNetwork } from 'hoodchain'
+
+interface BlockscoutTokenSearchItem {
+ address_hash: string
+ symbol: string | null
+ name: string | null
+}
+
+/**
+ * Check whether `symbol` is already in use by a live token on-chain, via
+ * Blockscout's token search API (`GET /api/v2/tokens?q=<symbol>`, verified
+ * live on both mainnet and testnet during this build). Search is
+ * fuzzy/substring on Blockscout's side, so this filters to an EXACT
+ * case-insensitive symbol match before treating it as a collision.
+ *
+ * @throws {@link TickerTakenError} when an exact match exists.
+ */
+export async function checkTickerUniqueness(network: HoodNetwork, symbol: string): Promise<void> {
+ const url = `${explorerApiUrl(network)}/v2/tokens?q=${encodeURIComponent(symbol)}`
+ const res = await fetch(url, { headers: { 'User-Agent': 'hood-launcher' } })
+ if (!res.ok) {
+ // Blockscout being briefly unavailable shouldn't hard-fail a launch; the
+ // caller still gets an on-chain collision check via the rail's own
+ // "already launched" guards. Surface loudly instead of failing silent.
+ console.warn(`[uniqueness] Blockscout token search returned ${res.status} — skipping ticker uniqueness check`)
+ return
+ }
+ const body = (await res.json()) as { items?: BlockscoutTokenSearchItem[] }
+ const exactMatch = (body.items ?? []).find((item) => (item.symbol ?? '').toUpperCase() === symbol.toUpperCase())
+ if (exactMatch) {
+ throw new TickerTakenError(symbol, `${network} token ${exactMatch.address_hash} ("${exactMatch.name}")`)
+ }
+}
diff --git a/robinhood/hood-launcher/src/core/caps.ts b/robinhood/hood-launcher/src/core/caps.ts
new file mode 100644
index 000000000..67bc8faf5
--- /dev/null
+++ b/robinhood/hood-launcher/src/core/caps.ts
@@ -0,0 +1,64 @@
+import type { HoodClient } from 'hoodchain'
+import { MAINNET_ADDRESSES, TESTNET_ADDRESSES, quoteSwap, formatUsdg, NoRouteError } from 'hoodchain'
+import { CapExceededError, KilledError, ResponsibilityNotAffirmedError } from '../errors.js'
+import type { OperatorConfig } from './config.js'
+import type { KillSwitch } from './kill-switch.js'
+import type { LaunchLedger } from './ledger.js'
+
+/**
+ * Estimate the USDG-equivalent value of a native-ETH amount via a live
+ * on-chain Uniswap v3 quote (WETH → USDG). Returns `null` when no route
+ * exists (e.g. testnet's thin liquidity) rather than fabricating a price —
+ * callers should treat `null` as "cap could not be verified, warn and let
+ * the operator judge" per the CLAUDE.md no-fake-data rule.
+ */
+export async function estimateUsdgValue(client: HoodClient, weiAmount: bigint): Promise<number | null> {
+ if (weiAmount === 0n) return 0
+ const addrs = client.network === 'mainnet' ? MAINNET_ADDRESSES : TESTNET_ADDRESSES
+ try {
+ const quote = await quoteSwap(client, { tokenIn: addrs.weth, tokenOut: addrs.usdg, amountIn: weiAmount })
+ return Number(formatUsdg(quote.amountOut))
+ } catch (err) {
+ if (err instanceof NoRouteError) return null
+ throw err
+ }
+}
+
+/**
+ * Enforce every launch-time hard cap: kill switch, live-mode responsibility
+ * acknowledgement, `MAX_LAUNCHES_PER_DAY`, and `MAX_SEED_USDG`. Throws the
+ * specific typed error on the first violation; callers should let these
+ * propagate (never swallow a cap failure).
+ */
+export async function enforceCaps(
+ config: OperatorConfig,
+ ledger: LaunchLedger,
+ killSwitch: KillSwitch,
+ client: HoodClient,
+ seedWei: bigint,
+): Promise<{ usdgEstimate: number | null }> {
+ const kill = killSwitch.reasonIfEngaged()
+ if (kill) throw new KilledError(kill)
+
+ if (config.live && !config.acknowledgeLaunchResponsibility) {
+ throw new ResponsibilityNotAffirmedError()
+ }
+
+ const launchedToday = ledger.countLaunchedInWindow(24)
+ if (launchedToday >= config.maxLaunchesPerDay) {
+ throw new CapExceededError(
+ 'MAX_LAUNCHES_PER_DAY',
+ `${launchedToday}/${config.maxLaunchesPerDay} launches already recorded in the last 24h`,
+ )
+ }
+
+ const usdgEstimate = await estimateUsdgValue(client, seedWei)
+ if (usdgEstimate !== null && usdgEstimate > config.maxSeedUsdgEquivalent) {
+ throw new CapExceededError(
+ 'MAX_SEED_USDG',
+ `seed ≈ $${usdgEstimate.toFixed(2)} USDG exceeds cap $${config.maxSeedUsdgEquivalent}`,
+ )
+ }
+
+ return { usdgEstimate }
+}
diff --git a/robinhood/hood-launcher/src/core/config.ts b/robinhood/hood-launcher/src/core/config.ts
new file mode 100644
index 000000000..6c022ee41
--- /dev/null
+++ b/robinhood/hood-launcher/src/core/config.ts
@@ -0,0 +1,84 @@
+import { z } from 'zod'
+import { createHoodClient, type HoodClient, type HoodNetwork } from 'hoodchain'
+import { privateKeyToAccount } from 'viem/accounts'
+
+const hexPrivateKey = z
+ .string()
+ .regex(/^0x[0-9a-fA-F]{64}$/, 'must be a 0x-prefixed 32-byte hex private key')
+
+/** Zod schema for a fully-specified launch config (the CLI/API's `coin.json` shape). */
+export const launchConfigSchema = z.object({
+ name: z.string().min(1).max(64),
+ symbol: z
+ .string()
+ .min(1)
+ .max(12)
+ .transform((s) => s.replace(/^\$/, '').toUpperCase()),
+ description: z.string().max(2000).default(''),
+ logoUri: z.string().min(1).optional(),
+ socials: z
+ .object({
+ telegram: z.string().optional(),
+ twitter: z.string().optional(),
+ discord: z.string().optional(),
+ website: z.string().optional(),
+ farcaster: z.string().optional(),
+ })
+ .default({}),
+ initialBuyEth: z.coerce.number().min(0).default(0),
+ rail: z.enum(['noxa', 'odyssey', 'direct']),
+ odysseyVariant: z.enum(['instant', 'bonding']).default('instant'),
+ direct: z
+ .object({
+ totalSupply: z.coerce.bigint().default(1_000_000_000n),
+ feeTier: z.coerce.number().default(10_000),
+ seedEth: z.coerce.number().min(0),
+ lpSupplyBps: z.coerce.number().min(1).max(10_000).default(10_000),
+ lpDisposition: z.enum(['burn', 'lock', 'keep']).default('burn'),
+ })
+ .optional(),
+})
+
+export type LaunchConfigInput = z.input<typeof launchConfigSchema>
+export type LaunchConfig = z.output<typeof launchConfigSchema>
+
+/** Environment-driven operator config shared by the CLI, API, and autonomous mode. */
+export interface OperatorConfig {
+ network: HoodNetwork
+ live: boolean
+ privateKey?: `0x${string}` | undefined
+ maxLaunchesPerDay: number
+ maxSeedUsdgEquivalent: number
+ acknowledgeLaunchResponsibility: boolean
+}
+
+export function loadOperatorConfig(env: NodeJS.ProcessEnv = process.env): OperatorConfig {
+ const network: HoodNetwork = env.ROBINHOOD_CHAIN_NETWORK === 'mainnet' ? 'mainnet' : 'testnet'
+ const live = env.LIVE === '1'
+ let privateKey: `0x${string}` | undefined
+ if (env.ROBINHOOD_CHAIN_PRIVATE_KEY) {
+ privateKey = hexPrivateKey.parse(env.ROBINHOOD_CHAIN_PRIVATE_KEY) as `0x${string}`
+ }
+ return {
+ network,
+ live,
+ privateKey,
+ maxLaunchesPerDay: Number(env.MAX_LAUNCHES_PER_DAY ?? 3),
+ maxSeedUsdgEquivalent: Number(env.MAX_SEED_USDG ?? 50),
+ acknowledgeLaunchResponsibility:
+ env.ACKNOWLEDGE_LAUNCH_RESPONSIBILITY === '1' || env.ACKNOWLEDGE_LAUNCH_RESPONSIBILITY === 'true',
+ }
+}
+
+/** Build a connected `HoodClient` from operator config. Read-only when `live` is false or no key is set. */
+export function clientFromOperatorConfig(config: OperatorConfig): HoodClient {
+ const account = config.live && config.privateKey ? privateKeyToAccount(config.privateKey) : undefined
+ return createHoodClient({
+ chain: config.network,
+ ...(account ? { account } : {}),
+ // Stock Tokens are out of scope for hood-launcher (it launches new
+ // memecoins, never acquires existing Stock Tokens), so this flag never
+ // gates anything the launcher does — kept false intentionally.
+ acknowledgeStockTokenEligibility: false,
+ })
+}
diff --git a/robinhood/hood-launcher/src/core/kill-switch.ts b/robinhood/hood-launcher/src/core/kill-switch.ts
new file mode 100644
index 000000000..8ce35833f
--- /dev/null
+++ b/robinhood/hood-launcher/src/core/kill-switch.ts
@@ -0,0 +1,42 @@
+import { existsSync } from 'node:fs'
+import { join } from 'node:path'
+
+/**
+ * A process-wide kill switch, engaged by any of three independent sources:
+ * SIGINT (Ctrl-C / `docker stop`), a `KILL` sentinel file dropped into the
+ * data directory, or an explicit `engage()` call (wired to `HTTP POST
+ * /kill` by the API/autonomous scheduler). Once engaged it stays engaged —
+ * a fresh process must be started to resume.
+ */
+export class KillSwitch {
+ private engaged = false
+ private source: string | null = null
+ private readonly killFilePath: string
+
+ constructor(dataDir: string) {
+ this.killFilePath = join(dataDir, 'KILL')
+ process.once('SIGINT', () => this.engage('SIGINT'))
+ process.once('SIGTERM', () => this.engage('SIGTERM'))
+ }
+
+ engage(source: string): void {
+ if (this.engaged) return
+ this.engaged = true
+ this.source = source
+ // eslint-disable-next-line no-console
+ console.error(`[kill-switch] engaged by ${source} — no further launches will be attempted`)
+ }
+
+ /** Re-checks the KILL-file sentinel (cheap `existsSync`) in addition to the in-memory flag. */
+ isEngaged(): { engaged: boolean; source: string | null } {
+ if (!this.engaged && existsSync(this.killFilePath)) {
+ this.engage(`KILL file at ${this.killFilePath}`)
+ }
+ return { engaged: this.engaged, source: this.source }
+ }
+
+ reasonIfEngaged(): string | null {
+ const { engaged, source } = this.isEngaged()
+ return engaged ? (source ?? 'unknown') : null
+ }
+}
diff --git a/robinhood/hood-launcher/src/core/ledger.ts b/robinhood/hood-launcher/src/core/ledger.ts
new file mode 100644
index 000000000..5666749e2
--- /dev/null
+++ b/robinhood/hood-launcher/src/core/ledger.ts
@@ -0,0 +1,47 @@
+import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs'
+import { join } from 'node:path'
+
+/** One row of the launch journal — every launch attempt, decided or executed. */
+export interface LedgerEntry {
+ timestamp: number
+ rail: string
+ network: string
+ symbol: string
+ token: string | null
+ seedWei: string
+ launchTx: string | null
+ status: 'launched' | 'rejected' | 'failed'
+ reason?: string
+}
+
+/**
+ * Append-only JSON-Lines journal of every launch attempt, used to enforce
+ * `MAX_LAUNCHES_PER_DAY` (a rolling 24h window over `status: 'launched'`
+ * rows) and to give operators/dashboards a durable audit trail.
+ */
+export class LaunchLedger {
+ private readonly path: string
+
+ constructor(dataDir: string) {
+ mkdirSync(dataDir, { recursive: true })
+ this.path = join(dataDir, 'launches.jsonl')
+ }
+
+ record(entry: LedgerEntry): void {
+ appendFileSync(this.path, JSON.stringify(entry) + '\n', 'utf8')
+ }
+
+ readAll(): LedgerEntry[] {
+ if (!existsSync(this.path)) return []
+ return readFileSync(this.path, 'utf8')
+ .split('\n')
+ .filter(Boolean)
+ .map((line) => JSON.parse(line) as LedgerEntry)
+ }
+
+ /** Count `status: 'launched'` entries within the last `windowHours` hours. */
+ countLaunchedInWindow(windowHours: number): number {
+ const cutoff = Date.now() - windowHours * 60 * 60 * 1000
+ return this.readAll().filter((e) => e.status === 'launched' && e.timestamp >= cutoff).length
+ }
+}
diff --git a/robinhood/hood-launcher/src/index.ts b/robinhood/hood-launcher/src/index.ts
index 4aa912b70..81cadbb56 100644
--- a/robinhood/hood-launcher/src/index.ts
+++ b/robinhood/hood-launcher/src/index.ts
@@ -1 +1,9 @@
-export * from './rails/types.js'
+export * from './rails/index.js'
+export * from './core/config.js'
+export * from './core/caps.js'
+export * from './core/kill-switch.js'
+export * from './core/ledger.js'
+export * from './core/explorer.js'
+export * from './core/verify.js'
+export * from './concept/index.js'
+export * from './errors.js'
diff --git a/robinhood/hood-launcher/src/rails/types.ts b/robinhood/hood-launcher/src/rails/types.ts
index ec2c69d18..acc5b2992 100644
--- a/robinhood/hood-launcher/src/rails/types.ts
+++ b/robinhood/hood-launcher/src/rails/types.ts
@@ -6,11 +6,11 @@ export type RailName = 'noxa' | 'odyssey' | 'direct'
/** Social links attached to a launch (all optional). */
export interface Socials {
- telegram?: string
- twitter?: string
- discord?: string
- website?: string
- farcaster?: string
+ telegram?: string | undefined
+ twitter?: string | undefined
+ discord?: string | undefined
+ website?: string | undefined
+ farcaster?: string | undefined
}
/**
diff --git a/robinhood/hood-mcp/package-lock.json b/robinhood/hood-mcp/package-lock.json
index 1dcc03319..6545db88e 100644
--- a/robinhood/hood-mcp/package-lock.json
+++ b/robinhood/hood-mcp/package-lock.json
@@ -23,7 +23,7 @@
"@types/node": "^24.0.0",
"@types/ws": "^8.18.0",
"tsup": "^8.5.0",
- "tsx": "^4.19.0",
+ "tsx": "^4.23.0",
"typescript": "^5.9.0",
"vitest": "^3.2.0"
},
diff --git a/robinhood/hood-mcp/package.json b/robinhood/hood-mcp/package.json
index 929991d62..3ff2086b0 100644
--- a/robinhood/hood-mcp/package.json
+++ b/robinhood/hood-mcp/package.json
@@ -75,7 +75,7 @@
"@types/node": "^24.0.0",
"@types/ws": "^8.18.0",
"tsup": "^8.5.0",
- "tsx": "^4.19.0",
+ "tsx": "^4.23.0",
"typescript": "^5.9.0",
"vitest": "^3.2.0"
}
diff --git a/robinhood/hood-mcp/src/register-trading.ts b/robinhood/hood-mcp/src/register-trading.ts
index e04e02225..f0b10bf77 100644
--- a/robinhood/hood-mcp/src/register-trading.ts
+++ b/robinhood/hood-mcp/src/register-trading.ts
@@ -293,7 +293,7 @@ export function registerTradingTools(
{ tokenIn: ti.address, tokenOut: to.address, amountIn: amountInRaw },
{ slippageBps: bps },
)
- ledger.recordSpend(usd)
+ ledger.recordSpend(usdForCap)
return toResult({
...preview,
confirmed: true,
diff --git a/robinhood/hood-mcp/tests/data-client.live.test.ts b/robinhood/hood-mcp/tests/data-client.live.test.ts
new file mode 100644
index 000000000..be1c780eb
--- /dev/null
+++ b/robinhood/hood-mcp/tests/data-client.live.test.ts
@@ -0,0 +1,115 @@
+/**
+ * Scripted MCP client exercising every data-server tool against REAL mainnet
+ * 4663 data — the SDK's client, not a mock. Run explicitly: `npm run test:live`
+ * (excluded from the default `npm test` since it depends on live upstreams:
+ * public RPC, DefiLlama, Blockscout, GeckoTerminal).
+ */
+import { describe, expect, it } from 'vitest'
+import { Client } from '@modelcontextprotocol/sdk/client/index.js'
+import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js'
+import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
+import { createHoodClient } from 'hoodchain'
+import { registerDataTools } from '../src/register-data.js'
+
+async function connect() {
+ const hood = createHoodClient() // mainnet, read-only, public RPC
+ const server = new McpServer({ name: 'hood-mcp-live-test', version: '0.0.0' })
+ registerDataTools(server, hood)
+ const [serverTransport, clientTransport] = InMemoryTransport.createLinkedPair()
+ const client = new Client({ name: 'live-test', version: '0.0.0' })
+ await Promise.all([server.connect(serverTransport), client.connect(clientTransport)])
+ return client
+}
+
+function json(result: Awaited<ReturnType<Client['callTool']>>): any {
+ expect(result.isError, JSON.stringify(result)).toBeFalsy()
+ return JSON.parse((result.content as { text: string }[])[0]!.text)
+}
+
+describe('live: hood-mcp data tools against Robinhood Chain mainnet 4663', () => {
+ it('get_chain_stats returns a live block number ahead of the SDK build snapshot', async () => {
+ const client = await connect()
+ const data = json(await client.callTool({ name: 'get_chain_stats', arguments: {} }))
+ expect(data.chainId).toBe(4663)
+ expect(Number(data.latestBlock)).toBeGreaterThan(7_700_000)
+ expect(data.tvlUsd).toBeGreaterThan(0)
+ await client.close()
+ })
+
+ it('list_stock_tokens returns the full 95-token registry with feeds', async () => {
+ const client = await connect()
+ const all = json(await client.callTool({ name: 'list_stock_tokens', arguments: {} }))
+ expect(all.total).toBe(95)
+ const priced = json(await client.callTool({ name: 'list_stock_tokens', arguments: { pricedOnly: true } }))
+ expect(priced.total).toBe(34)
+ await client.close()
+ })
+
+ it('get_stock_quote returns a real Chainlink price for AAPL', async () => {
+ const client = await connect()
+ const data = json(await client.callTool({ name: 'get_stock_quote', arguments: { symbol: 'AAPL' } }))
+ expect(data.symbol).toBe('AAPL')
+ expect(data.chainlink.priceUsd).toBeGreaterThan(0)
+ expect(data.uiMultiplier).toBe('1000000000000000000')
+ await client.close()
+ })
+
+ it('get_stock_quote reports an actionable error for an unknown ticker', async () => {
+ const client = await connect()
+ const result = await client.callTool({ name: 'get_stock_quote', arguments: { symbol: 'NOTREAL' } })
+ expect(result.isError).toBe(true)
+ expect((result.content as { text: string }[])[0]!.text).toMatch(/not a Stock Token/)
+ await client.close()
+ })
+
+ it('get_portfolio values a real address (USDG treasury) with multiplier-correct positions', async () => {
+ const client = await connect()
+ // USDG contract itself — always a valid address to read, whether or not it
+ // holds Stock Tokens; proves the multicall + valuation path end to end.
+ const data = json(
+ await client.callTool({
+ name: 'get_portfolio',
+ arguments: { address: '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' },
+ }),
+ )
+ expect(data.network).toBe('mainnet')
+ expect(Array.isArray(data.positions)).toBe(true)
+ await client.close()
+ })
+
+ it('get_coin returns real GeckoTerminal + Blockscout data for a live memecoin (HOODBOT)', async () => {
+ const client = await connect()
+ const data = json(
+ await client.callTool({
+ name: 'get_coin',
+ arguments: { address: '0x32758ae8e02b0a2cb6b802b6aaeaf74158c169f7' },
+ }),
+ )
+ expect(data.symbol).toBe('HOODBOT')
+ expect(data.priceUsd).toBeGreaterThan(0)
+ expect(data.isStockToken).toBe(false)
+ await client.close()
+ })
+
+ it('get_recent_launches scans real on-chain logs and finds launches over a wide window', async () => {
+ const client = await connect()
+ const data = json(
+ await client.callTool({
+ name: 'get_recent_launches',
+ arguments: { lookbackBlocks: 1_500_000, limit: 5 },
+ }),
+ )
+ expect(data.launches.length).toBeGreaterThan(0)
+ expect(['noxa', 'odyssey']).toContain(data.launches[0].launchpad)
+ await client.close()
+ })
+
+ it('search_token finds the canonical TSLA Stock Token by ticker', async () => {
+ const client = await connect()
+ const data = json(await client.callTool({ name: 'search_token', arguments: { query: 'TSLA', limit: 5 } }))
+ const stockHit = data.results.find((r: any) => r.isStockToken)
+ expect(stockHit).toBeDefined()
+ expect(stockHit.symbol).toBe('TSLA')
+ await client.close()
+ })
+})
diff --git a/robinhood/hood-mcp/tests/schema.test.ts b/robinhood/hood-mcp/tests/schema.test.ts
new file mode 100644
index 000000000..2cf6a0d24
--- /dev/null
+++ b/robinhood/hood-mcp/tests/schema.test.ts
@@ -0,0 +1,109 @@
+/**
+ * Structural tests: every tool on both servers has a valid, LLM-routable
+ * schema and no tool name collides across the two servers' surface areas.
+ * Uses an in-memory MCP client/server pair — no network required.
+ */
+import { describe, expect, it } from 'vitest'
+import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
+import { Client } from '@modelcontextprotocol/sdk/client/index.js'
+import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js'
+import { privateKeyToAccount } from 'viem/accounts'
+import { createHoodClient } from 'hoodchain'
+import { registerDataTools } from '../src/register-data.js'
+import { registerTradingTools } from '../src/register-trading.js'
+import { readTradingConfig, SpendLedger } from '../src/shared/trading-env.js'
+
+const DATA_TOOLS = [
+ 'get_chain_stats',
+ 'list_stock_tokens',
+ 'get_stock_quote',
+ 'get_portfolio',
+ 'get_coin',
+ 'list_trending_coins',
+ 'get_recent_launches',
+ 'watch_launches',
+ 'search_token',
+]
+
+const TRADING_TOOLS = ['get_my_portfolio', 'get_swap_quote', 'execute_swap', 'transfer_usdg']
+
+// A fixed unfunded test key — used ONLY to exercise schema/tool wiring, never
+// to sign a real transaction with value.
+const TEST_KEY = '0x4918baba5b953918b69687637b543e8943bd2d2b83893ca51643c89845b9d16d'
+
+async function connectedClient(server: McpServer): Promise<Client> {
+ const [serverTransport, clientTransport] = InMemoryTransport.createLinkedPair()
+ const client = new Client({ name: 'test', version: '0.0.0' })
+ await Promise.all([server.connect(serverTransport), client.connect(clientTransport)])
+ return client
+}
+
+describe('data server tool schemas', () => {
+ it('registers exactly the documented data tools with descriptions and input schemas', async () => {
+ const hood = createHoodClient() // read-only, mainnet — no network call at construction time
+ const server = new McpServer({ name: 'hood-mcp-test', version: '0.0.0' })
+ registerDataTools(server, hood)
+ const client = await connectedClient(server)
+
+ const { tools } = await client.listTools()
+ const names = tools.map((t) => t.name).sort()
+ expect(names).toEqual([...DATA_TOOLS].sort())
+
+ for (const tool of tools) {
+ expect(tool.description, `${tool.name} needs a description`).toBeTruthy()
+ expect(tool.description!.length, `${tool.name} description too short to route on`).toBeGreaterThan(20)
+ expect(tool.inputSchema, `${tool.name} needs an input schema`).toBeTruthy()
+ expect(tool.inputSchema.type).toBe('object')
+ }
+ await client.close()
+ })
+
+ it('get_stock_quote rejects a non-string symbol via schema validation', async () => {
+ const hood = createHoodClient()
+ const server = new McpServer({ name: 'hood-mcp-test', version: '0.0.0' })
+ registerDataTools(server, hood)
+ const client = await connectedClient(server)
+
+ const result = await client.callTool({ name: 'get_stock_quote', arguments: { symbol: 123 } })
+ expect(result.isError, 'a wrong-typed argument must be rejected as an error').toBe(true)
+ await client.close()
+ })
+})
+
+describe('trading server tool schemas', () => {
+ it('registers exactly the documented trading tools, all requiring an account', async () => {
+ const account = privateKeyToAccount(TEST_KEY)
+ const hood = createHoodClient({ chain: 'testnet', account })
+ const config = readTradingConfig({ HOOD_MCP_ENABLE_TRADING: '1' } as NodeJS.ProcessEnv)
+ const ledger = new SpendLedger(config)
+ const server = new McpServer({ name: 'hood-mcp-trading-test', version: '0.0.0' })
+ registerTradingTools(server, hood, config, ledger)
+ const client = await connectedClient(server)
+
+ const { tools } = await client.listTools()
+ const names = tools.map((t) => t.name).sort()
+ expect(names).toEqual([...TRADING_TOOLS].sort())
+
+ const mutating = tools.filter((t) => t.name === 'execute_swap' || t.name === 'transfer_usdg')
+ for (const tool of mutating) {
+ expect(tool.annotations?.destructiveHint, `${tool.name} must be marked destructive`).toBe(true)
+ // Every mutating tool schema must expose a `confirm` boolean gate.
+ const props = (tool.inputSchema as { properties?: Record<string, unknown> }).properties ?? {}
+ expect(props, `${tool.name} must declare a confirm parameter`).toHaveProperty('confirm')
+ }
+
+ const readOnly = tools.filter((t) => t.name === 'get_my_portfolio' || t.name === 'get_swap_quote')
+ for (const tool of readOnly) {
+ expect(tool.annotations?.readOnlyHint, `${tool.name} must be marked read-only`).toBe(true)
+ }
+ await client.close()
+ })
+
+ it('throws when constructed without a wallet account', () => {
+ const hood = createHoodClient({ chain: 'testnet' })
+ const config = readTradingConfig({ HOOD_MCP_ENABLE_TRADING: '1' } as NodeJS.ProcessEnv)
+ const ledger = new SpendLedger(config)
+ const server = new McpServer({ name: 'x', version: '0.0.0' })
+ expect(() => registerTradingTools(server, hood, config, ledger)).toThrow(/requires a wallet-backed client/)
+ })
+})
diff --git a/robinhood/hood-mcp/tests/trading-guards.test.ts b/robinhood/hood-mcp/tests/trading-guards.test.ts
new file mode 100644
index 000000000..e9ef41609
--- /dev/null
+++ b/robinhood/hood-mcp/tests/trading-guards.test.ts
@@ -0,0 +1,190 @@
+/**
+ * Guard behavior tests for the trading tools: spend caps, the confirm gate,
+ * and the Stock Token eligibility gate. These hit REAL testnet 46630 reads
+ * (quoteSwap simulates via `eth_call`, no gas or funds needed) through an
+ * UNFUNDED test wallet — broadcasting is never reached because either the cap
+ * rejects first or `confirm` is omitted. The one path that would need funds
+ * (a confirmed swap) is covered separately by the funded, opt-in
+ * `trading-swap.live.test.ts`.
+ */
+import { beforeAll, describe, expect, it } from 'vitest'
+import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
+import { Client } from '@modelcontextprotocol/sdk/client/index.js'
+import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js'
+import { privateKeyToAccount } from 'viem/accounts'
+import { createHoodClient, TESTNET_ADDRESSES, TESTNET_STOCK_TOKENS } from 'hoodchain'
+import type { HoodClient } from 'hoodchain'
+import { registerTradingTools } from '../src/register-trading.js'
+import { readTradingConfig, SpendLedger } from '../src/shared/trading-env.js'
+
+// Unfunded — used only for quote/preview paths that never sign+broadcast.
+const TEST_KEY = '0x4918baba5b953918b69687637b543e8943bd2d2b83893ca51643c89845b9d16d'
+
+async function buildServer(client: HoodClient, envOverrides: Record<string, string> = {}) {
+ const config = readTradingConfig({
+ HOOD_MCP_ENABLE_TRADING: '1',
+ HOOD_MCP_MAX_SPEND_USDG: '9999999', // caps disabled by default; individual tests override
+ HOOD_MCP_MAX_SESSION_USDG: '9999999',
+ ...envOverrides,
+ } as NodeJS.ProcessEnv)
+ const ledger = new SpendLedger(config)
+ const server = new McpServer({ name: 'hood-mcp-trading-guard-test', version: '0.0.0' })
+ registerTradingTools(server, client, config, ledger)
+ const [serverTransport, clientTransport] = InMemoryTransport.createLinkedPair()
+ const client_ = new Client({ name: 'test', version: '0.0.0' })
+ await Promise.all([server.connect(serverTransport), client_.connect(clientTransport)])
+ return { client: client_, config, ledger }
+}
+
+describe('guard: get_swap_quote (read-only, real testnet reads)', () => {
+ let hood: HoodClient
+ beforeAll(() => {
+ hood = createHoodClient({ chain: 'testnet', account: privateKeyToAccount(TEST_KEY) })
+ })
+
+ it('quotes a real WETH -> NFLX route on testnet 46630', async () => {
+ const { client } = await buildServer(hood)
+ const result = await client.callTool({
+ name: 'get_swap_quote',
+ arguments: { tokenIn: 'WETH', tokenOut: 'NFLX', amountIn: '0.0001' },
+ })
+ expect(result.isError).toBeFalsy()
+ const text = (result.content as { text: string }[])[0]!.text
+ const data = JSON.parse(text)
+ expect(data.network).toBe('testnet')
+ expect(Number(data.amountOut)).toBeGreaterThan(0)
+ expect(data.route.length).toBeGreaterThanOrEqual(2)
+ await client.close()
+ })
+})
+
+describe('guard: spend caps', () => {
+ it('rejects a swap preview whose notional would exceed the per-call cap', async () => {
+ const hood = createHoodClient({ chain: 'mainnet', account: privateKeyToAccount(TEST_KEY) })
+ const { client } = await buildServer(hood, {
+ HOOD_MCP_MAX_SPEND_USDG: '1',
+ HOOD_MCP_MAX_SESSION_USDG: '1',
+ })
+ // 1000 USDG vastly exceeds the $1 per-call cap.
+ const result = await client.callTool({
+ name: 'execute_swap',
+ arguments: { tokenIn: 'USDG', tokenOut: 'WETH', amountIn: '1000' },
+ })
+ expect(result.isError).toBe(true)
+ const text = (result.content as { text: string }[])[0]!.text
+ expect(text).toMatch(/exceeds the per-call cap/)
+ await client.close()
+ })
+
+ it('rejects transfer_usdg whose amount exceeds the per-call cap', async () => {
+ const hood = createHoodClient({ chain: 'mainnet', account: privateKeyToAccount(TEST_KEY) })
+ const { client } = await buildServer(hood, {
+ HOOD_MCP_MAX_SPEND_USDG: '5',
+ HOOD_MCP_MAX_SESSION_USDG: '5',
+ })
+ const result = await client.callTool({
+ name: 'transfer_usdg',
+ arguments: { to: '0x000000000000000000000000000000000000dEaD', amount: '50' },
+ })
+ expect(result.isError).toBe(true)
+ const text = (result.content as { text: string }[])[0]!.text
+ expect(text).toMatch(/exceeds the per-call cap/)
+ await client.close()
+ })
+
+ it('SpendLedger enforces the session cap across multiple calls', () => {
+ const config = readTradingConfig({
+ HOOD_MCP_ENABLE_TRADING: '1',
+ HOOD_MCP_MAX_SPEND_USDG: '100',
+ HOOD_MCP_MAX_SESSION_USDG: '150',
+ } as NodeJS.ProcessEnv)
+ const ledger = new SpendLedger(config)
+ ledger.assertWithinCaps(80)
+ ledger.recordSpend(80)
+ expect(ledger.sessionRemaining).toBe(70)
+ // A further $80 call is under the per-call cap of $100 but would bring the
+ // session total to $160, over the $150 session cap.
+ expect(() => ledger.assertWithinCaps(80)).toThrow(/per-session cap/)
+ // $70 exactly fits.
+ expect(() => ledger.assertWithinCaps(70)).not.toThrow()
+ })
+})
+
+describe('guard: confirm gate', () => {
+ it('execute_swap without confirm returns a simulation and spends nothing from the ledger', async () => {
+ const hood = createHoodClient({ chain: 'testnet', account: privateKeyToAccount(TEST_KEY) })
+ const { client, ledger } = await buildServer(hood)
+ const result = await client.callTool({
+ name: 'execute_swap',
+ arguments: { tokenIn: 'WETH', tokenOut: 'NFLX', amountIn: '0.0001' },
+ })
+ expect(result.isError).toBeFalsy()
+ const data = JSON.parse((result.content as { text: string }[])[0]!.text)
+ expect(data.confirmed).toBe(false)
+ expect(data.message).toMatch(/SIMULATION ONLY/)
+ expect(data.transactionHash).toBeUndefined()
+ expect(ledger.spent).toBe(0)
+ await client.close()
+ })
+
+ it('transfer_usdg without confirm returns a simulation and spends nothing from the ledger', async () => {
+ const hood = createHoodClient({ chain: 'testnet', account: privateKeyToAccount(TEST_KEY) })
+ const { client, ledger } = await buildServer(hood)
+ const result = await client.callTool({
+ name: 'transfer_usdg',
+ arguments: { to: '0x000000000000000000000000000000000000dEaD', amount: '1' },
+ })
+ expect(result.isError).toBeFalsy()
+ const data = JSON.parse((result.content as { text: string }[])[0]!.text)
+ expect(data.confirmed).toBe(false)
+ expect(data.transactionHash).toBeUndefined()
+ expect(ledger.spent).toBe(0)
+ await client.close()
+ })
+})
+
+describe('guard: Stock Token eligibility', () => {
+ // ASML is one of the few Stock Tokens with real Uniswap v3 liquidity against
+ // USDG on mainnet (verified live: most Stock Tokens trade on Arcus instead,
+ // which quoteSwap does not probe — see get_stock_quote's dexError for AAPL).
+ it('blocks a mainnet swap whose OUTPUT is a Stock Token when eligibility is not acknowledged', async () => {
+ const hood = createHoodClient({ chain: 'mainnet', account: privateKeyToAccount(TEST_KEY) })
+ const { client } = await buildServer(hood, { HOOD_MCP_ACKNOWLEDGE_ELIGIBILITY: '0' })
+ const result = await client.callTool({
+ name: 'execute_swap',
+ arguments: { tokenIn: 'USDG', tokenOut: 'ASML', amountIn: '10' },
+ })
+ expect(result.isError).toBe(true)
+ const text = (result.content as { text: string }[])[0]!.text
+ expect(text).toMatch(/eligibility acknowledgement/)
+ await client.close()
+ })
+
+ it('allows the simulation preview once eligibility is acknowledged', async () => {
+ const hood = createHoodClient({ chain: 'mainnet', account: privateKeyToAccount(TEST_KEY) })
+ const { client } = await buildServer(hood, { HOOD_MCP_ACKNOWLEDGE_ELIGIBILITY: '1' })
+ const result = await client.callTool({
+ name: 'execute_swap',
+ arguments: { tokenIn: 'USDG', tokenOut: 'ASML', amountIn: '10' },
+ })
+ expect(result.isError).toBeFalsy()
+ const data = JSON.parse((result.content as { text: string }[])[0]!.text)
+ expect(data.confirmed).toBe(false)
+ await client.close()
+ })
+})
+
+describe('guard: unresolvable token', () => {
+ it('rejects an unknown ticker with an actionable error', async () => {
+ const hood = createHoodClient({ chain: 'mainnet', account: privateKeyToAccount(TEST_KEY) })
+ const { client } = await buildServer(hood)
+ const result = await client.callTool({
+ name: 'get_swap_quote',
+ arguments: { tokenIn: 'USDG', tokenOut: 'NOTATICKER', amountIn: '1' },
+ })
+ expect(result.isError).toBe(true)
+ const text = (result.content as { text: string }[])[0]!.text
+ expect(text).toMatch(/Unknown token/)
+ await client.close()
+ })
+})
diff --git a/robinhood/hood-mcp/vitest.live.config.ts b/robinhood/hood-mcp/vitest.live.config.ts
new file mode 100644
index 000000000..69eedd504
--- /dev/null
+++ b/robinhood/hood-mcp/vitest.live.config.ts
@@ -0,0 +1,9 @@
+import { defineConfig } from 'vitest/config'
+
+/** Config for the opt-in live suites (test:live, test:swap) — no exclusions. */
+export default defineConfig({
+ test: {
+ environment: 'node',
+ include: ['tests/**/*.test.ts'],
+ },
+})
diff --git a/robinhood/hood-traders/Dockerfile b/robinhood/hood-traders/Dockerfile
new file mode 100644
index 000000000..53b386689
--- /dev/null
+++ b/robinhood/hood-traders/Dockerfile
@@ -0,0 +1,39 @@
+# hood-traders — autonomous trading fleet for Robinhood Chain.
+# Multi-stage build; final image runs the fleet + dashboard in paper mode by
+# default (docker-compose.yml sets no live-trading env vars).
+
+FROM node:20-slim AS build
+WORKDIR /app
+
+# better-sqlite3 needs a C++ toolchain to compile its native addon.
+RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
+ && rm -rf /var/lib/apt/lists/*
+
+COPY package.json package-lock.json* ./
+RUN npm install
+COPY tsconfig.json tsup.config.ts ./
+COPY src ./src
+RUN npm run build
+
+FROM node:20-slim AS runtime
+WORKDIR /app
+ENV NODE_ENV=production
+
+RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
+ && rm -rf /var/lib/apt/lists/* \
+ && useradd --create-home --uid 1001 hood
+
+COPY package.json package-lock.json* ./
+RUN npm install --omit=dev && npm rebuild better-sqlite3 && \
+ apt-get purge -y python3 make g++ 2>/dev/null || true
+
+COPY --from=build /app/dist ./dist
+COPY dashboard ./dashboard
+
+RUN mkdir -p /app/data && chown -R hood:hood /app
+USER hood
+
+EXPOSE 4670
+VOLUME ["/app/data"]
+
+CMD ["node", "dist/main.js"]
diff --git a/robinhood/hood-traders/tests/snapshots/latest.json b/robinhood/hood-traders/tests/snapshots/latest.json
new file mode 100644
index 000000000..50680dba6
--- /dev/null
+++ b/robinhood/hood-traders/tests/snapshots/latest.json
@@ -0,0 +1,82 @@
+{
+ "capturedAt": 1783862548208,
+ "network": "mainnet",
+ "chainId": 4663,
+ "blockNumber": "7837330",
+ "ethUsd": 1805.6772999999998,
+ "quotes": [
+ {
+ "symbol": "AAPL",
+ "address": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",
+ "priceUsd": 315.5,
+ "ageSeconds": 152274,
+ "roundId": "18446744073709551791"
+ },
+ {
+ "symbol": "AMD",
+ "address": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",
+ "priceUsd": 558.21015,
+ "ageSeconds": 149202,
+ "roundId": "18446744073709552439"
+ },
+ {
+ "symbol": "AMZN",
+ "address": "0x12f190a9F9d7D37a250758b26824B97CE941bF54",
+ "priceUsd": 245.5677,
+ "ageSeconds": 170445,
+ "roundId": "18446744073709551835"
+ },
+ {
+ "symbol": "ASML",
+ "address": "0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",
+ "priceUsd": 1797.58755,
+ "ageSeconds": 151887,
+ "roundId": "18446744073709552134"
+ },
+ {
+ "symbol": "BABA",
+ "address": "0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",
+ "priceUsd": 112.195,
+ "ageSeconds": 155025,
+ "roundId": "18446744073709552096"
+ },
+ {
+ "symbol": "CLSK",
+ "address": "0xcBB95BBF36099d34dA091dc6Fa6F49EfA257Cee3",
+ "priceUsd": 12.86499999,
+ "ageSeconds": 149235,
+ "roundId": "18446744073709552791"
+ },
+ {
+ "symbol": "COIN",
+ "address": "0x6330D8C3178a418788dF01a47479c0ce7CCF450b",
+ "priceUsd": 159.43135,
+ "ageSeconds": 159075,
+ "roundId": "18446744073709552345"
+ },
+ {
+ "symbol": "CRCL",
+ "address": "0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",
+ "priceUsd": 66.34635,
+ "ageSeconds": 145188,
+ "roundId": "18446744073709552661"
+ }
+ ],
+ "spotSamples": [
+ {
+ "symbol": "AAPL",
+ "address": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",
+ "error": "No swappable Uniswap v3 route from 0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9 to 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168: no direct pool (fees 100/500/3000/10000) or two-hop route via 1 intermediates produced output for amountIn=1000000000000000000 Pools may exist without liquidity; try a different intermediate or amount."
+ },
+ {
+ "symbol": "AMD",
+ "address": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",
+ "error": "No swappable Uniswap v3 route from 0x86923f96303D656E4aa86D9d42D1e57ad2023fdC to 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168: no direct pool (fees 100/500/3000/10000) or two-hop route via 1 intermediates produced output for amountIn=1000000000000000000 Pools may exist without liquidity; try a different intermediate or amount."
+ },
+ {
+ "symbol": "AMZN",
+ "address": "0x12f190a9F9d7D37a250758b26824B97CE941bF54",
+ "error": "No swappable Uniswap v3 route from 0x12f190a9F9d7D37a250758b26824B97CE941bF54 to 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168: no direct pool (fees 100/500/3000/10000) or two-hop route via 1 intermediates produced output for amountIn=1000000000000000000 Pools may exist without liquidity; try a different intermediate or amount."
+ }
+ ]
+}
\ No newline at end of file
diff --git a/robinhood/hood-traders/tests/snapshots/mainnet-1783862548208.json b/robinhood/hood-traders/tests/snapshots/mainnet-1783862548208.json
new file mode 100644
index 000000000..50680dba6
--- /dev/null
+++ b/robinhood/hood-traders/tests/snapshots/mainnet-1783862548208.json
@@ -0,0 +1,82 @@
+{
+ "capturedAt": 1783862548208,
+ "network": "mainnet",
+ "chainId": 4663,
+ "blockNumber": "7837330",
+ "ethUsd": 1805.6772999999998,
+ "quotes": [
+ {
+ "symbol": "AAPL",
+ "address": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",
+ "priceUsd": 315.5,
+ "ageSeconds": 152274,
+ "roundId": "18446744073709551791"
+ },
+ {
+ "symbol": "AMD",
+ "address": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",
+ "priceUsd": 558.21015,
+ "ageSeconds": 149202,
+ "roundId": "18446744073709552439"
+ },
+ {
+ "symbol": "AMZN",
+ "address": "0x12f190a9F9d7D37a250758b26824B97CE941bF54",
+ "priceUsd": 245.5677,
+ "ageSeconds": 170445,
+ "roundId": "18446744073709551835"
+ },
+ {
+ "symbol": "ASML",
+ "address": "0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",
+ "priceUsd": 1797.58755,
+ "ageSeconds": 151887,
+ "roundId": "18446744073709552134"
+ },
+ {
+ "symbol": "BABA",
+ "address": "0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",
+ "priceUsd": 112.195,
+ "ageSeconds": 155025,
+ "roundId": "18446744073709552096"
+ },
+ {
+ "symbol": "CLSK",
+ "address": "0xcBB95BBF36099d34dA091dc6Fa6F49EfA257Cee3",
+ "priceUsd": 12.86499999,
+ "ageSeconds": 149235,
+ "roundId": "18446744073709552791"
+ },
+ {
+ "symbol": "COIN",
+ "address": "0x6330D8C3178a418788dF01a47479c0ce7CCF450b",
+ "priceUsd": 159.43135,
+ "ageSeconds": 159075,
+ "roundId": "18446744073709552345"
+ },
+ {
+ "symbol": "CRCL",
+ "address": "0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",
+ "priceUsd": 66.34635,
+ "ageSeconds": 145188,
+ "roundId": "18446744073709552661"
+ }
+ ],
+ "spotSamples": [
+ {
+ "symbol": "AAPL",
+ "address": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",
+ "error": "No swappable Uniswap v3 route from 0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9 to 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168: no direct pool (fees 100/500/3000/10000) or two-hop route via 1 intermediates produced output for amountIn=1000000000000000000 Pools may exist without liquidity; try a different intermediate or amount."
+ },
+ {
+ "symbol": "AMD",
+ "address": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",
+ "error": "No swappable Uniswap v3 route from 0x86923f96303D656E4aa86D9d42D1e57ad2023fdC to 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168: no direct pool (fees 100/500/3000/10000) or two-hop route via 1 intermediates produced output for amountIn=1000000000000000000 Pools may exist without liquidity; try a different intermediate or amount."
+ },
+ {
+ "symbol": "AMZN",
+ "address": "0x12f190a9F9d7D37a250758b26824B97CE941bF54",
+ "error": "No swappable Uniswap v3 route from 0x12f190a9F9d7D37a250758b26824B97CE941bF54 to 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168: no direct pool (fees 100/500/3000/10000) or two-hop route via 1 intermediates produced output for amountIn=1000000000000000000 Pools may exist without liquidity; try a different intermediate or amount."
+ }
+ ]
+}
\ No newline at end of file
diff --git a/robinhood/hood-traders/tests/unit/agent.test.ts b/robinhood/hood-traders/tests/unit/agent.test.ts
new file mode 100644
index 000000000..e9aa075de
--- /dev/null
+++ b/robinhood/hood-traders/tests/unit/agent.test.ts
@@ -0,0 +1,274 @@
+import { afterEach, describe, expect, it } from 'vitest'
+import { parseEther, parseUnits, type Address } from 'viem'
+import { Agent } from '../../src/framework/agent.js'
+import { Journal } from '../../src/framework/journal.js'
+import { KillSwitch } from '../../src/framework/kill.js'
+import type { Market } from '../../src/framework/market.js'
+import type { Strategy, StrategyTickContext } from '../../src/framework/strategy.js'
+import type { Decision, Intent, RiskLimits } from '../../src/framework/types.js'
+import { FakeMarket } from './helpers/fake-market.js'
+
+const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' as Address
+const TOKEN_A = '0x2222222222222222222222222222222222222b' as Address
+
+/** A test strategy that returns whatever intents the test enqueues, one shot per tick. */
+class ScriptedStrategy implements Strategy {
+ readonly id = 'scripted'
+ readonly title = 'Scripted'
+ readonly quote = 'usdg' as const
+ readonly meta = { edge: 'test double', failureModes: ['n/a'], params: {} }
+ private queue: Intent[][] = []
+
+ enqueue(intents: Intent[]): void {
+ this.queue.push(intents)
+ }
+
+ async tick(_ctx: StrategyTickContext): Promise<Decision> {
+ const intents = this.queue.shift() ?? []
+ return { intents, alerts: [] }
+ }
+}
+
+function buyIntent(overrides: Partial<Intent> = {}): Intent {
+ return {
+ side: 'buy',
+ token: TOKEN_A,
+ tokenSymbol: 'MEME',
+ amountIn: parseUnits('10', 6), // 10 USDG
+ quoteToken: USDG,
+ quoteSymbol: 'USDG',
+ reason: 'test entry',
+ ...overrides,
+ }
+}
+
+const LIMITS: RiskLimits = {
+ maxPositionUsdg: 50,
+ maxDailySpendUsdg: 100,
+ maxSlippageBps: 100,
+ cooldownSeconds: 0,
+}
+
+function makeAgent(opts: {
+ market: FakeMarket
+ journal: Journal
+ kill: KillSwitch
+ strategy: ScriptedStrategy
+ limits?: RiskLimits
+ fleetMaxDailySpendUsdg?: number
+ clock?: () => number
+}) {
+ let fleetSpent = 0
+ return new Agent({
+ id: 'agent-1',
+ strategy: opts.strategy,
+ market: opts.market as unknown as Market,
+ limits: opts.limits ?? LIMITS,
+ journal: opts.journal,
+ kill: opts.kill,
+ mode: 'paper',
+ account: null,
+ fleetMaxDailySpendUsdg: opts.fleetMaxDailySpendUsdg ?? 250,
+ fleetSpentTodayUsd: () => fleetSpent,
+ reportFleetSpend: (usd) => {
+ fleetSpent += usd
+ },
+ tickIntervalMs: 999_999_999, // never auto-fires; tests call tick() directly
+ clock: opts.clock,
+ })
+}
+
+describe('Agent — risk cap enforcement end-to-end', () => {
+ let journal: Journal
+ let kill: KillSwitch
+
+ afterEach(() => {
+ journal?.close()
+ kill?.dispose()
+ })
+
+ it('executes a paper trade that clears every risk check and journals it', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), parseUnits('9.5', 6))
+ const strategy = new ScriptedStrategy()
+ strategy.enqueue([buyIntent()])
+ const agent = makeAgent({ market, journal, kill, strategy })
+
+ await agent.tick()
+
+ const status = agent.status()
+ expect(status.trades).toBe(1)
+ expect(status.refusals).toBe(0)
+ const trades = journal.recentTrades('agent-1', 1)
+ expect(trades).toHaveLength(1)
+ expect(trades[0]?.side).toBe('buy')
+ expect(trades[0]?.mode).toBe('paper')
+ expect(trades[0]?.txHash).toBeNull()
+ })
+
+ it('refuses an intent that would breach the per-position cap and journals the refusal', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ const strategy = new ScriptedStrategy()
+ // 10 USDG notional but the cap is 5 — must refuse.
+ strategy.enqueue([buyIntent({ amountIn: parseUnits('10', 6) })])
+ const agent = makeAgent({ market, journal, kill, strategy, limits: { ...LIMITS, maxPositionUsdg: 5 } })
+
+ await agent.tick()
+
+ const status = agent.status()
+ expect(status.trades).toBe(0)
+ expect(status.refusals).toBe(1)
+ const decisions = journal.recentDecisions('agent-1', 5)
+ expect(decisions.some((d) => d.kind === 'refused' && d.meta.reason === 'position_cap')).toBe(true)
+ })
+
+ it('refuses once the per-agent daily spend cap is reached across multiple ticks', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ const strategy = new ScriptedStrategy()
+ // Cap is 100; three 40-USDG buys — the third must be refused (spent would hit 120).
+ strategy.enqueue([buyIntent({ amountIn: parseUnits('40', 6) })])
+ strategy.enqueue([buyIntent({ amountIn: parseUnits('40', 6) })])
+ strategy.enqueue([buyIntent({ amountIn: parseUnits('40', 6) })])
+ const agent = makeAgent({
+ market,
+ journal,
+ kill,
+ strategy,
+ limits: { ...LIMITS, maxPositionUsdg: 1000, maxDailySpendUsdg: 100, cooldownSeconds: 0 },
+ })
+
+ await agent.tick()
+ await agent.tick()
+ await agent.tick()
+
+ const status = agent.status()
+ expect(status.trades).toBe(2)
+ expect(status.refusals).toBe(1)
+ expect(status.spentTodayUsd).toBeCloseTo(80, 6)
+ })
+
+ it('refuses an order whose slippage bound exceeds the agent cap', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ const strategy = new ScriptedStrategy()
+ strategy.enqueue([buyIntent({ maxSlippageBps: 500 })]) // cap is 100
+ const agent = makeAgent({ market, journal, kill, strategy })
+
+ await agent.tick()
+
+ expect(agent.status().trades).toBe(0)
+ expect(agent.status().refusals).toBe(1)
+ const decisions = journal.recentDecisions('agent-1', 5)
+ expect(decisions.some((d) => d.meta.reason === 'slippage_bound')).toBe(true)
+ })
+
+ it('refuses every subsequent intent once the kill switch trips mid-loop', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), parseUnits('9.5', 6))
+ const strategy = new ScriptedStrategy()
+ strategy.enqueue([buyIntent()])
+ strategy.enqueue([buyIntent()])
+ strategy.enqueue([buyIntent()])
+ const agent = makeAgent({ market, journal, kill, strategy })
+
+ await agent.tick() // fills
+ kill.trip('test-mid-loop')
+ await agent.tick() // must refuse — kill switch is now tripped
+ await agent.tick() // still refuses
+
+ const status = agent.status()
+ expect(status.trades).toBe(1)
+ expect(status.killed).toBe(true)
+ const decisions = journal.recentDecisions('agent-1', 10)
+ expect(decisions.filter((d) => d.meta.reason === 'kill_switch')).toHaveLength(0) // agent halts before even asking the strategy
+ })
+
+ it('halts proposing new intents once killed, even though the strategy still emits them', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ kill.trip('pre-tripped')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ const strategy = new ScriptedStrategy()
+ strategy.enqueue([buyIntent()])
+ const agent = makeAgent({ market, journal, kill, strategy })
+
+ await agent.tick()
+
+ expect(agent.status().trades).toBe(0)
+ expect(agent.status().killed).toBe(true)
+ })
+
+ it('respects the cooldown between trades', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), parseUnits('9.5', 6))
+ const strategy = new ScriptedStrategy()
+ strategy.enqueue([buyIntent()])
+ strategy.enqueue([buyIntent()])
+ let now = 0
+ const agent = makeAgent({
+ market,
+ journal,
+ kill,
+ strategy,
+ limits: { ...LIMITS, cooldownSeconds: 60 },
+ clock: () => now,
+ })
+
+ now = 0
+ await agent.tick() // fills
+ now = 5_000 // only 5s later — inside the 60s cooldown
+ await agent.tick() // must refuse
+
+ const status = agent.status()
+ expect(status.trades).toBe(1)
+ expect(status.refusals).toBe(1)
+ })
+
+ it('exempts a de-risking sell from the position/daily caps', async () => {
+ journal = new Journal(':memory:')
+ kill = new KillSwitch('/nonexistent/KILL')
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), parseUnits('9.5', 6))
+ const strategy = new ScriptedStrategy()
+ strategy.enqueue([buyIntent({ amountIn: parseUnits('40', 6) })])
+ const agent = makeAgent({
+ market,
+ journal,
+ kill,
+ strategy,
+ limits: { ...LIMITS, maxPositionUsdg: 45, maxDailySpendUsdg: 45, cooldownSeconds: 0 },
+ })
+ await agent.tick() // buy 40 USDG, hits near the caps
+
+ // Now propose a huge sell — 1000 tokens, notional value from sellRoutes far
+ // exceeds both caps but must NOT be refused because it reduces risk.
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), parseUnits('9999', 6))
+ strategy.enqueue([
+ { side: 'sell', token: TOKEN_A, tokenSymbol: 'MEME', amountIn: parseEther('1000'), quoteToken: USDG, quoteSymbol: 'USDG', reason: 'test exit' },
+ ])
+ await agent.tick()
+
+ const status = agent.status()
+ expect(status.trades).toBe(2)
+ expect(status.refusals).toBe(0)
+ })
+})
diff --git a/robinhood/hood-traders/tests/unit/helpers/fake-market.ts b/robinhood/hood-traders/tests/unit/helpers/fake-market.ts
new file mode 100644
index 000000000..e0dff9624
--- /dev/null
+++ b/robinhood/hood-traders/tests/unit/helpers/fake-market.ts
@@ -0,0 +1,75 @@
+import type { Address } from 'viem'
+import type { StockQuote, SwapQuote } from 'hoodchain'
+import type { SpotPrice } from '../../../src/framework/market.js'
+
+const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' as Address
+const WETH = '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73' as Address
+
+function swapQuote(amountOut: bigint): SwapQuote {
+ return {
+ route: { fees: [3000], path: [], encodedPath: '0x' },
+ amountIn: 0n,
+ amountOut,
+ gasEstimate: 120_000n,
+ }
+}
+
+/**
+ * A scriptable stand-in for {@link Market} built for deterministic strategy
+ * unit tests. Every price it returns is either lifted verbatim from a real
+ * captured snapshot (`tests/snapshots/latest.json`) or an explicit, documented
+ * offset from one — never an invented number. Cast to `Market` at the call
+ * site; only the subset of the real class's surface the strategies actually
+ * call is implemented.
+ */
+export class FakeMarket {
+ usdg = USDG
+ weth = WETH
+ usdgDecimals = 6
+
+ buyRoutes = new Map<string, bigint | null>() // key: `${token}` -> amountOut or null (no route)
+ sellRoutes = new Map<string, bigint | null>()
+ spotPrices = new Map<string, number | null>() // key: token address
+ chainlinkPrices = new Map<string, StockQuote | null>()
+ dexPrices = new Map<string, number | null>()
+ ethUsdValue = 1800
+
+ multicallResults: readonly unknown[] = []
+
+ client = {
+ acknowledgeStockTokenEligibility: false,
+ public: {
+ multicall: async () => this.multicallResults,
+ },
+ }
+
+ async ethUsd(): Promise<number | null> {
+ return this.ethUsdValue
+ }
+
+ async spotPrice(token: Address): Promise<SpotPrice | null> {
+ const price = this.spotPrices.get(token.toLowerCase())
+ if (price === undefined || price === null) return null
+ return { token, priceUsd: price, via: 'usdg', ts: Date.now() }
+ }
+
+ async quoteBuy(_quoteToken: Address, token: Address, _amountIn: bigint): Promise<SwapQuote | null> {
+ const out = this.buyRoutes.get(token.toLowerCase())
+ if (out === undefined || out === null) return null
+ return swapQuote(out)
+ }
+
+ async quoteSell(token: Address, _quoteToken: Address, _amount: bigint): Promise<SwapQuote | null> {
+ const out = this.sellRoutes.get(token.toLowerCase())
+ if (out === undefined || out === null) return null
+ return swapQuote(out)
+ }
+
+ async stockChainlinkPrice(symbol: string): Promise<StockQuote | null> {
+ return this.chainlinkPrices.get(symbol) ?? null
+ }
+
+ async stockDexPrice(tokenAddress: Address, _referenceUsd: number): Promise<number | null> {
+ return this.dexPrices.get(tokenAddress.toLowerCase()) ?? null
+ }
+}
diff --git a/robinhood/hood-traders/tests/unit/strategies.test.ts b/robinhood/hood-traders/tests/unit/strategies.test.ts
new file mode 100644
index 000000000..02a3c0311
--- /dev/null
+++ b/robinhood/hood-traders/tests/unit/strategies.test.ts
@@ -0,0 +1,349 @@
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, it } from 'vitest'
+import type { Address } from 'viem'
+import { parseEther, parseUnits } from 'viem'
+import { LaunchSniper } from '../../src/strategies/launch-sniper.js'
+import { Momentum } from '../../src/strategies/momentum.js'
+import { PremiumWatch } from '../../src/strategies/premium-watch.js'
+import type { Position } from '../../src/framework/types.js'
+import type { Market } from '../../src/framework/market.js'
+import type { StrategyTickContext } from '../../src/framework/strategy.js'
+import { FakeMarket } from './helpers/fake-market.js'
+
+const snapshot = JSON.parse(
+ readFileSync(fileURLToPath(new URL('../snapshots/latest.json', import.meta.url)), 'utf8'),
+) as {
+ ethUsd: number
+ quotes: { symbol: string; address: Address; priceUsd: number; ageSeconds: number; roundId: string }[]
+}
+
+const AAPL = snapshot.quotes.find((q) => q.symbol === 'AAPL')!
+const TOKEN_A = '0x2222222222222222222222222222222222222b' as Address
+const CREATOR = '0x3333333333333333333333333333333333333c' as Address
+const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' as Address
+const WETH = '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73' as Address
+
+function ctxFor(market: FakeMarket, positions: Position[], now: number, quote: 'usdg' | 'weth'): StrategyTickContext {
+ return {
+ market: market as unknown as Market,
+ positions,
+ now,
+ quoteToken: quote === 'weth' ? WETH : USDG,
+ quoteSymbol: quote === 'weth' ? 'WETH' : 'USDG',
+ quoteDecimals: quote === 'weth' ? 18 : 6,
+ log: () => {},
+ }
+}
+
+function position(overrides: Partial<Position> = {}): Position {
+ return {
+ token: TOKEN_A,
+ tokenSymbol: 'MEME',
+ amount: parseEther('100'),
+ costBasis: parseEther('0.01'),
+ investedUsd: 20,
+ quoteToken: WETH,
+ quoteSymbol: 'WETH',
+ openedAt: 0,
+ markUsd: null,
+ meta: {},
+ ...overrides,
+ }
+}
+
+describe('LaunchSniper — exits (pure math, no market calls)', () => {
+ it('exits on take-profit once markUsd/investedUsd clears the threshold', async () => {
+ const sniper = new LaunchSniper({ takeProfitPct: 0.5 })
+ const market = new FakeMarket()
+ const pos = position({ investedUsd: 20, markUsd: 32, openedAt: 0 }) // +60%
+ const decision = await sniper.tick(ctxFor(market, [pos], 60_000, 'weth'))
+ expect(decision.intents).toHaveLength(1)
+ expect(decision.intents[0]?.side).toBe('sell')
+ expect(decision.intents[0]?.reason).toMatch(/take-profit/)
+ })
+
+ it('exits on stop-loss once markUsd/investedUsd breaches the floor', async () => {
+ const sniper = new LaunchSniper({ stopLossPct: 0.3 })
+ const market = new FakeMarket()
+ const pos = position({ investedUsd: 20, markUsd: 12, openedAt: 0 }) // -40%
+ const decision = await sniper.tick(ctxFor(market, [pos], 60_000, 'weth'))
+ expect(decision.intents[0]?.reason).toMatch(/stop-loss/)
+ })
+
+ it('force-exits after maxHoldSeconds regardless of PnL', async () => {
+ const sniper = new LaunchSniper({ maxHoldSeconds: 60, takeProfitPct: 10, stopLossPct: 10 })
+ const market = new FakeMarket()
+ const pos = position({ investedUsd: 20, markUsd: 20.5, openedAt: 0 }) // flat PnL, well within TP/SL
+ const decision = await sniper.tick(ctxFor(market, [pos], 120_000, 'weth')) // 120s held > 60s max
+ expect(decision.intents[0]?.reason).toMatch(/time-exit/)
+ })
+
+ it('holds a position inside all three bands', async () => {
+ const sniper = new LaunchSniper({ takeProfitPct: 0.5, stopLossPct: 0.3, maxHoldSeconds: 600 })
+ const market = new FakeMarket()
+ const pos = position({ investedUsd: 20, markUsd: 21, openedAt: 0 }) // +5%, 30s held
+ const decision = await sniper.tick(ctxFor(market, [pos], 30_000, 'weth'))
+ expect(decision.intents).toHaveLength(0)
+ })
+})
+
+describe('LaunchSniper — entry filters (using a queued candidate + FakeMarket)', () => {
+ function seeded(sniper: LaunchSniper, launch: { token: Address; creator: Address; launchpad: 'noxa' | 'odyssey'; pool: Address | null }) {
+ // The launch queue is populated by the live watchLaunches() subscription in
+ // start(); tests inject a candidate directly since it is otherwise only
+ // reachable via a real chain WebSocket subscription.
+ ;(sniper as unknown as { queue: { launch: typeof launch; seenAt: number }[] }).queue.push({
+ launch: { ...launch, blockNumber: 1n, transactionHash: '0xdead' as `0x${string}` },
+ seenAt: Date.now(),
+ })
+ }
+
+ it('skips a launch with no liquid Uniswap route (e.g. an un-graduated Odyssey curve token)', async () => {
+ const sniper = new LaunchSniper()
+ const market = new FakeMarket()
+ // no buyRoutes entry for TOKEN_A → quoteBuy resolves null
+ seeded(sniper, { token: TOKEN_A, creator: CREATOR, launchpad: 'odyssey', pool: null })
+ const decision = await sniper.tick(ctxFor(market, [], Date.now(), 'weth'))
+ expect(decision.intents).toHaveLength(0)
+ expect(decision.alerts[0]?.message).toMatch(/no liquid Uniswap route/)
+ })
+
+ it('skips a honeypot: buy succeeds but sell-back resolves no route', async () => {
+ const sniper = new LaunchSniper()
+ const market = new FakeMarket()
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ // no sellRoutes entry → quoteSell resolves null
+ seeded(sniper, { token: TOKEN_A, creator: CREATOR, launchpad: 'noxa', pool: TOKEN_A })
+ const decision = await sniper.tick(ctxFor(market, [], Date.now(), 'weth'))
+ expect(decision.intents).toHaveLength(0)
+ expect(decision.alerts[0]?.message).toMatch(/honeypot/)
+ })
+
+ it('skips a launch whose round-trip loses more than the configured threshold', async () => {
+ const sniper = new LaunchSniper({ maxRoundTripLossPct: 0.2, entryWeth: 0.01 })
+ const market = new FakeMarket()
+ const amountIn = parseEther('0.01')
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ // Sell back only 70% of the input value — a 30% round-trip loss, over the 20% cap.
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), (amountIn * 70n) / 100n)
+ market.multicallResults = [parseEther('1000000'), 0n] // supply, deployer balance
+ seeded(sniper, { token: TOKEN_A, creator: CREATOR, launchpad: 'noxa', pool: TOKEN_A })
+ const decision = await sniper.tick(ctxFor(market, [], Date.now(), 'weth'))
+ expect(decision.intents).toHaveLength(0)
+ expect(decision.alerts[0]?.message).toMatch(/round-trip loss/)
+ })
+
+ it('skips a launch where the deployer holds more than the concentration cap', async () => {
+ const sniper = new LaunchSniper({ maxDeployerPct: 0.1 })
+ const market = new FakeMarket()
+ const amountIn = parseEther('0.01')
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), (amountIn * 98n) / 100n) // clean round trip
+ // deployer holds 25% of supply — over the 10% cap
+ market.multicallResults = [parseEther('1000'), parseEther('250')]
+ seeded(sniper, { token: TOKEN_A, creator: CREATOR, launchpad: 'noxa', pool: TOKEN_A })
+ const decision = await sniper.tick(ctxFor(market, [], Date.now(), 'weth'))
+ expect(decision.intents).toHaveLength(0)
+ expect(decision.alerts[0]?.message).toMatch(/deployer holds/)
+ })
+
+ it('enters when every filter clears', async () => {
+ const sniper = new LaunchSniper({ maxDeployerPct: 0.5, maxRoundTripLossPct: 0.5, entryWeth: 0.01 })
+ const market = new FakeMarket()
+ const amountIn = parseEther('0.01')
+ market.buyRoutes.set(TOKEN_A.toLowerCase(), parseEther('1000'))
+ market.sellRoutes.set(TOKEN_A.toLowerCase(), (amountIn * 98n) / 100n)
+ market.multicallResults = [parseEther('1000'), parseEther('10')] // deployer holds 1%
+ seeded(sniper, { token: TOKEN_A, creator: CREATOR, launchpad: 'noxa', pool: TOKEN_A })
+ const decision = await sniper.tick(ctxFor(market, [], Date.now(), 'weth'))
+ expect(decision.intents).toHaveLength(1)
+ expect(decision.intents[0]?.side).toBe('buy')
+ expect(decision.intents[0]?.amountIn).toBe(amountIn)
+ })
+
+ it('reports its edge hypothesis and failure modes (documentation contract)', () => {
+ const sniper = new LaunchSniper()
+ expect(sniper.meta.edge.length).toBeGreaterThan(20)
+ expect(sniper.meta.failureModes.length).toBeGreaterThanOrEqual(3)
+ })
+})
+
+describe('Momentum — breakout entries and trailing-stop exits', () => {
+ function seededHistory(momentum: Momentum, token: Address, symbol: string, samples: { ts: number; priceUsd: number }[], now: number) {
+ const internal = momentum as unknown as {
+ history: Map<string, { token: Address; symbol: string; samples: typeof samples }>
+ lastDiscoveryAt: number
+ }
+ internal.history.set(token.toLowerCase(), { token, symbol, samples })
+ internal.lastDiscoveryAt = now // skip live discovery (a real chain log scan) in this tick
+ }
+
+ it('fires a breakout entry using real AAPL-scale prices from the captured snapshot', async () => {
+ // AAPL real price from the snapshot as the window's starting point; a synthetic
+ // +20% move over the lookback window (over the 15% default threshold) — the
+ // offset is explicit and documented, the base price is the real captured number.
+ // tick() appends a fresh spotPrice sample before evaluating the breakout, so two
+ // history samples are seeded here and the third comes from `market.spotPrices`.
+ const base = AAPL.priceUsd
+ const momentum = new Momentum({ breakoutPct: 0.15, lookbackSamples: 3, entryUsdg: 10 })
+ const market = new FakeMarket()
+ const now = 10_000
+ seededHistory(
+ momentum,
+ TOKEN_A,
+ 'AAPL-SIM',
+ [
+ { ts: now - 2000, priceUsd: base },
+ { ts: now - 1000, priceUsd: base * 1.08 },
+ ],
+ now,
+ )
+ market.spotPrices.set(TOKEN_A.toLowerCase(), base * 1.2) // appended by tick() as the 3rd sample
+ const decision = await momentum.tick(ctxFor(market, [], now, 'usdg'))
+ expect(decision.intents).toHaveLength(1)
+ expect(decision.intents[0]?.side).toBe('buy')
+ expect(decision.intents[0]?.reason).toMatch(/breakout/)
+ })
+
+ it('does not enter when the move is under the breakout threshold', async () => {
+ const base = AAPL.priceUsd
+ const momentum = new Momentum({ breakoutPct: 0.15, lookbackSamples: 3 })
+ const market = new FakeMarket()
+ const now = 10_000
+ seededHistory(
+ momentum,
+ TOKEN_A,
+ 'AAPL-SIM',
+ [
+ { ts: now - 3000, priceUsd: base },
+ { ts: now - 2000, priceUsd: base * 1.02 },
+ { ts: now - 1000, priceUsd: base * 1.05 }, // only +5%, under 15% threshold
+ ],
+ now,
+ )
+ market.spotPrices.set(TOKEN_A.toLowerCase(), base * 1.05)
+ const decision = await momentum.tick(ctxFor(market, [], now, 'usdg'))
+ expect(decision.intents).toHaveLength(0)
+ })
+
+ it('exits on a trailing-stop drawdown from the post-entry peak', async () => {
+ const momentum = new Momentum({ trailingStopPct: 0.2 })
+ const market = new FakeMarket()
+ const now = 100_000
+ const pos = position({
+ token: TOKEN_A,
+ tokenSymbol: 'AAPL-SIM',
+ quoteToken: USDG,
+ quoteSymbol: 'USDG',
+ openedAt: 0,
+ })
+ // Seed a peak above current spot, then quote a price 25% below it (over the 20% stop).
+ ;(momentum as unknown as { peakSinceEntry: Map<string, number> }).peakSinceEntry.set(TOKEN_A.toLowerCase(), 100)
+ market.spotPrices.set(TOKEN_A.toLowerCase(), 74) // 26% off the peak of 100
+ const decision = await momentum.tick(ctxFor(market, [pos], now, 'usdg'))
+ expect(decision.intents.some((i) => i.side === 'sell' && /trailing stop/.test(i.reason))).toBe(true)
+ })
+
+ it('reports its edge hypothesis and failure modes (documentation contract)', () => {
+ const momentum = new Momentum()
+ expect(momentum.meta.edge.length).toBeGreaterThan(20)
+ expect(momentum.meta.failureModes.length).toBeGreaterThanOrEqual(3)
+ })
+})
+
+describe('PremiumWatch — alerts-only by default, eligibility-gated trading', () => {
+ it('alerts on a spread that clears the threshold but does NOT trade when enableTrading is false (default)', async () => {
+ const watch = new PremiumWatch({ symbols: ['AAPL'], alertThresholdBps: 50, tradeThresholdBps: 150, enableTrading: false })
+ const market = new FakeMarket()
+ const oracleUsd = AAPL.priceUsd
+ market.chainlinkPrices.set('AAPL', {
+ symbol: 'AAPL',
+ address: AAPL.address,
+ feed: AAPL.address,
+ priceUsd: oracleUsd,
+ answer: BigInt(Math.round(oracleUsd * 1e8)),
+ answerDecimals: 8,
+ roundId: 1n,
+ updatedAt: 0,
+ ageSeconds: 0,
+ })
+ // DEX 3% below oracle — a real discount magnitude, well over both thresholds.
+ market.dexPrices.set(AAPL.address.toLowerCase(), oracleUsd * 0.97)
+ const decision = await watch.tick(ctxFor(market, [], Date.now(), 'usdg'))
+ expect(decision.intents).toHaveLength(0) // never trades by default
+ expect(decision.alerts.some((a) => /discount/.test(a.message))).toBe(true)
+ })
+
+ it('trades the convergence only when BOTH enableTrading=true AND the client acknowledged eligibility', async () => {
+ const watch = new PremiumWatch({ symbols: ['AAPL'], tradeThresholdBps: 150, tradeSizeUsdg: 20, enableTrading: true })
+ const market = new FakeMarket()
+ market.client.acknowledgeStockTokenEligibility = true
+ const oracleUsd = AAPL.priceUsd
+ market.chainlinkPrices.set('AAPL', {
+ symbol: 'AAPL',
+ address: AAPL.address,
+ feed: AAPL.address,
+ priceUsd: oracleUsd,
+ answer: BigInt(Math.round(oracleUsd * 1e8)),
+ answerDecimals: 8,
+ roundId: 1n,
+ updatedAt: 0,
+ ageSeconds: 0,
+ })
+ market.dexPrices.set(AAPL.address.toLowerCase(), oracleUsd * 0.97) // 3% discount, over 1.5% threshold
+ const decision = await watch.tick(ctxFor(market, [], Date.now(), 'usdg'))
+ expect(decision.intents).toHaveLength(1)
+ expect(decision.intents[0]?.side).toBe('buy')
+ expect(decision.intents[0]?.tokenSymbol).toBe('AAPL')
+ })
+
+ it('stays alerts-only when enableTrading=true but eligibility was NOT acknowledged', async () => {
+ const watch = new PremiumWatch({ symbols: ['AAPL'], tradeThresholdBps: 150, enableTrading: true })
+ const market = new FakeMarket()
+ market.client.acknowledgeStockTokenEligibility = false // operator never affirmed
+ const oracleUsd = AAPL.priceUsd
+ market.chainlinkPrices.set('AAPL', {
+ symbol: 'AAPL',
+ address: AAPL.address,
+ feed: AAPL.address,
+ priceUsd: oracleUsd,
+ answer: BigInt(Math.round(oracleUsd * 1e8)),
+ answerDecimals: 8,
+ roundId: 1n,
+ updatedAt: 0,
+ ageSeconds: 0,
+ })
+ market.dexPrices.set(AAPL.address.toLowerCase(), oracleUsd * 0.95)
+ const decision = await watch.tick(ctxFor(market, [], Date.now(), 'usdg'))
+ expect(decision.intents).toHaveLength(0)
+ expect(decision.alerts.some((a) => /eligibility/.test(a.message))).toBe(true)
+ })
+
+ it('exits a convergence position once the spread reverts within the exit band', async () => {
+ const watch = new PremiumWatch({ symbols: ['AAPL'], exitThresholdBps: 20 })
+ const market = new FakeMarket()
+ const oracleUsd = AAPL.priceUsd
+ market.chainlinkPrices.set('AAPL', {
+ symbol: 'AAPL',
+ address: AAPL.address,
+ feed: AAPL.address,
+ priceUsd: oracleUsd,
+ answer: BigInt(Math.round(oracleUsd * 1e8)),
+ answerDecimals: 8,
+ roundId: 1n,
+ updatedAt: 0,
+ ageSeconds: 0,
+ })
+ market.dexPrices.set(AAPL.address.toLowerCase(), oracleUsd * 0.9999) // ~1bps spread — converged
+ const pos = position({ token: AAPL.address, tokenSymbol: 'AAPL', quoteToken: USDG, quoteSymbol: 'USDG', openedAt: 0 })
+ const decision = await watch.tick(ctxFor(market, [pos], 60_000, 'usdg'))
+ expect(decision.intents.some((i) => i.side === 'sell' && /converged/.test(i.reason))).toBe(true)
+ })
+
+ it('reports its edge hypothesis and failure modes, including the no-shorting asymmetry (documentation contract)', () => {
+ const watch = new PremiumWatch()
+ expect(watch.meta.edge.length).toBeGreaterThan(20)
+ expect(watch.meta.failureModes.some((f) => /short/i.test(f))).toBe(true)
+ })
+})
diff --git a/robinhood/hood402/facilitator/package.json b/robinhood/hood402/facilitator/package.json
index be9bbd047..1b3e9217f 100644
--- a/robinhood/hood402/facilitator/package.json
+++ b/robinhood/hood402/facilitator/package.json
@@ -18,7 +18,8 @@
"build": "tsc -p tsconfig.json",
"dev": "tsx watch src/index.ts",
"start": "node --no-warnings=ExperimentalWarning dist/index.js",
- "typecheck": "tsc --noEmit"
+ "typecheck": "tsc --noEmit",
+ "test": "vitest run tests"
},
"dependencies": {
"express": "^4.21.2",
@@ -28,7 +29,10 @@
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^22.10.2",
+ "@types/supertest": "^6.0.2",
+ "supertest": "^7.0.0",
"tsx": "^4.19.2",
- "typescript": "^5.7.2"
+ "typescript": "^5.7.2",
+ "vitest": "^2.1.8"
}
}
diff --git a/robinhood/hood402/facilitator/tests/ledger.test.ts b/robinhood/hood402/facilitator/tests/ledger.test.ts
new file mode 100644
index 000000000..8d20c4525
--- /dev/null
+++ b/robinhood/hood402/facilitator/tests/ledger.test.ts
@@ -0,0 +1,96 @@
+import { describe, expect, it } from 'vitest'
+import { Ledger } from '../src/ledger.js'
+
+const NETWORK = 'robinhood-testnet'
+const PAYER = '0x1111111111111111111111111111111111111111'
+const PAY_TO = '0x2222222222222222222222222222222222222222'
+const NONCE = '0xdeadbeef'
+
+function freshLedger(): Ledger {
+ return new Ledger(':memory:', () => 1_800_000_000_000)
+}
+
+describe('Ledger — idempotent settlement claims', () => {
+ it('claims a fresh (network, payer, nonce) key', () => {
+ const ledger = freshLedger()
+ const result = ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ expect(result).toEqual({ claimed: true })
+ })
+
+ it('refuses a second claim on the same key while pending', () => {
+ const ledger = freshLedger()
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ const second = ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ expect(second.claimed).toBe(false)
+ if (!second.claimed) expect(second.existing.status).toBe('pending')
+ })
+
+ it('allows the same nonce to be claimed independently per network', () => {
+ const ledger = freshLedger()
+ const a = ledger.claim({ network: 'robinhood', payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ const b = ledger.claim({ network: 'robinhood-testnet', payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ expect(a).toEqual({ claimed: true })
+ expect(b).toEqual({ claimed: true })
+ })
+
+ it('marks a claim settled and a replay returns the same transaction hash', () => {
+ const ledger = freshLedger()
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ ledger.markSettled(NETWORK, PAYER, NONCE, '0xabc123')
+
+ const replay = ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ expect(replay.claimed).toBe(false)
+ if (!replay.claimed) {
+ expect(replay.existing.status).toBe('settled')
+ expect(replay.existing.tx_hash).toBe('0xabc123')
+ }
+ })
+
+ it('marks a claim failed and records the reason', () => {
+ const ledger = freshLedger()
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ ledger.markFailed(NETWORK, PAYER, NONCE, 'settlement_failed')
+
+ const row = ledger.find(NETWORK, PAYER, NONCE)
+ expect(row?.status).toBe('failed')
+ expect(row?.reason).toBe('settlement_failed')
+ })
+
+ it('is case-insensitive on payer and nonce (checksum vs lowercase addresses collide)', () => {
+ const ledger = freshLedger()
+ ledger.claim({ network: NETWORK, payer: PAYER.toUpperCase(), payTo: PAY_TO, amount: '10000', nonce: NONCE })
+ const second = ledger.claim({
+ network: NETWORK,
+ payer: PAYER.toLowerCase(),
+ payTo: PAY_TO,
+ amount: '10000',
+ nonce: NONCE,
+ })
+ expect(second.claimed).toBe(false)
+ })
+})
+
+describe('Ledger — metrics', () => {
+ it('counts settlements by status', () => {
+ const ledger = freshLedger()
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: '0x1' })
+ ledger.markSettled(NETWORK, PAYER, '0x1', '0xaaa')
+
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '20000', nonce: '0x2' })
+ ledger.markFailed(NETWORK, PAYER, '0x2', 'settlement_failed')
+
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '30000', nonce: '0x3' })
+
+ expect(ledger.counts()).toEqual({ settled: 1, failed: 1, pending: 1 })
+ })
+
+ it('sums total settled USDG in atomic units', () => {
+ const ledger = freshLedger()
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '10000', nonce: '0x1' })
+ ledger.markSettled(NETWORK, PAYER, '0x1', '0xaaa')
+ ledger.claim({ network: NETWORK, payer: PAYER, payTo: PAY_TO, amount: '25000', nonce: '0x2' })
+ ledger.markSettled(NETWORK, PAYER, '0x2', '0xbbb')
+
+ expect(ledger.totalSettledAtomic()).toBe('35000')
+ })
+})
diff --git a/robinhood/hood402/facilitator/vitest.config.ts b/robinhood/hood402/facilitator/vitest.config.ts
new file mode 100644
index 000000000..67af71cff
--- /dev/null
+++ b/robinhood/hood402/facilitator/vitest.config.ts
@@ -0,0 +1,9 @@
+import { defineConfig } from 'vitest/config'
+
+export default defineConfig({
+ test: {
+ include: ['tests/**/*.test.ts'],
+ environment: 'node',
+ testTimeout: 10000,
+ },
+})
diff --git a/robinhood/hood402/tests/challenge.test.ts b/robinhood/hood402/tests/challenge.test.ts
new file mode 100644
index 000000000..b69ce9644
--- /dev/null
+++ b/robinhood/hood402/tests/challenge.test.ts
@@ -0,0 +1,87 @@
+import { describe, expect, it } from 'vitest'
+import { buildPaymentRequired, buildRequirements, toAtomic } from '../src/challenge.js'
+import { ROBINHOOD_MAINNET, ROBINHOOD_TESTNET } from '../src/networks.js'
+
+const PAY_TO = '0x1111111111111111111111111111111111111111'
+
+describe('toAtomic', () => {
+ it('converts a human decimal string to 6-decimal atomic units', () => {
+ expect(toAtomic('0.01', 6)).toBe('10000')
+ expect(toAtomic('1', 6)).toBe('1000000')
+ expect(toAtomic('0.000001', 6)).toBe('1')
+ })
+
+ it('passes through pre-atomic values', () => {
+ expect(toAtomic({ atomic: '12345' }, 6)).toBe('12345')
+ })
+
+ it('converts the usdg-tagged form', () => {
+ expect(toAtomic({ usdg: '2.50' }, 6)).toBe('2500000')
+ })
+})
+
+describe('buildRequirements', () => {
+ it('builds a spec-compliant requirement for mainnet USDG by default', () => {
+ const req = buildRequirements({
+ price: '0.05',
+ payTo: PAY_TO,
+ resource: 'https://api.example.com/data',
+ })
+ expect(req.scheme).toBe('exact')
+ expect(req.network).toBe(ROBINHOOD_MAINNET.id)
+ expect(req.asset).toBe(ROBINHOOD_MAINNET.usdg)
+ expect(req.maxAmountRequired).toBe('50000')
+ expect(req.payTo.toLowerCase()).toBe(PAY_TO.toLowerCase())
+ expect(req.maxTimeoutSeconds).toBe(60)
+ expect(req.mimeType).toBe('application/json')
+ expect(req.extra).toEqual({ name: 'Global Dollar', version: '1' })
+ })
+
+ it('resolves the testnet network and its USDG address', () => {
+ const req = buildRequirements({
+ price: '1.00',
+ payTo: PAY_TO,
+ resource: 'https://api.example.com/data',
+ network: 'robinhood-testnet',
+ })
+ expect(req.network).toBe(ROBINHOOD_TESTNET.id)
+ expect(req.asset).toBe(ROBINHOOD_TESTNET.usdg)
+ })
+
+ it('accepts network aliases (three.ws catalog naming)', () => {
+ const req = buildRequirements({
+ price: '1.00',
+ payTo: PAY_TO,
+ resource: 'https://api.example.com/data',
+ network: 'robinhood-chain',
+ })
+ expect(req.network).toBe(ROBINHOOD_MAINNET.id)
+ })
+
+ it('rejects an unknown network', () => {
+ expect(() =>
+ buildRequirements({
+ price: '1.00',
+ payTo: PAY_TO,
+ resource: 'https://api.example.com/data',
+ network: 'ethereum-mainnet',
+ }),
+ ).toThrow(/unknown network/)
+ })
+})
+
+describe('buildPaymentRequired', () => {
+ it('wraps requirements into a v1 402 body', () => {
+ const req = buildRequirements({ price: '0.01', payTo: PAY_TO, resource: 'https://x.test/r' })
+ const body = buildPaymentRequired(req)
+ expect(body.x402Version).toBe(1)
+ expect(body.accepts).toEqual([req])
+ expect(body.error).toBeUndefined()
+ })
+
+ it('includes an error message when given one', () => {
+ const req = buildRequirements({ price: '0.01', payTo: PAY_TO, resource: 'https://x.test/r' })
+ const body = buildPaymentRequired(req, 'insufficient funds')
+ expect(body.error).toBe('insufficient funds')
+ })
+})
diff --git a/robinhood/hood402/tests/client.test.ts b/robinhood/hood402/tests/client.test.ts
new file mode 100644
index 000000000..0b112df58
--- /dev/null
+++ b/robinhood/hood402/tests/client.test.ts
@@ -0,0 +1,120 @@
+import { describe, expect, it, vi } from 'vitest'
+import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
+import { Hood402Client, fromAccount } from '../src/client/index.js'
+import { buildPaymentRequired, buildRequirements, PAYMENT_HEADER, PAYMENT_RESPONSE_HEADER } from '../src/challenge.js'
+import { decodePaymentHeader, encodeSettlementHeader } from '../src/scheme/encoding.js'
+import { SpendCapExceededError } from '../src/errors.js'
+
+const payerAccount = privateKeyToAccount(generatePrivateKey())
+const PAY_TO = '0x2222222222222222222222222222222222222222'
+const RESOURCE_URL = 'https://api.example.com/premium'
+
+function requirements(priceAtomic: string) {
+ return buildRequirements({
+ price: { atomic: priceAtomic },
+ payTo: PAY_TO,
+ resource: RESOURCE_URL,
+ network: 'robinhood-testnet',
+ })
+}
+
+/** A fetch stub: first call returns 402, second call (with X-PAYMENT) returns 200. */
+function make402ThenOkFetch(priceAtomic: string) {
+ const settlement = encodeSettlementHeader({
+ success: true,
+ transaction: '0xabc',
+ network: 'robinhood-testnet',
+ payer: payerAccount.address,
+ })
+ const calls: Array<{ url: string; headers: Headers }> = []
+ const fetchStub = vi.fn(async (url: string | URL, init?: RequestInit) => {
+ const headers = new Headers(init?.headers)
+ calls.push({ url: url.toString(), headers })
+ if (!headers.get(PAYMENT_HEADER)) {
+ const body = buildPaymentRequired(requirements(priceAtomic))
+ return new Response(JSON.stringify(body), { status: 402 })
+ }
+ return new Response(JSON.stringify({ ok: true }), {
+ status: 200,
+ headers: { [PAYMENT_RESPONSE_HEADER]: settlement },
+ })
+ })
+ return { fetchStub, calls }
+}
+
+describe('Hood402Client — the pay-on-402 flow', () => {
+ it('signs and retries automatically, returning a 200 and the settlement receipt', async () => {
+ const { fetchStub, calls } = make402ThenOkFetch('10000')
+ const client = new Hood402Client({
+ signer: fromAccount(payerAccount),
+ fetch: fetchStub as unknown as typeof fetch,
+ maxSpendPerOrigin: '1.00',
+ })
+
+ const result = await client.fetchWithReceipt(RESOURCE_URL)
+
+ expect(result.paid).toBe(true)
+ expect(result.response.status).toBe(200)
+ expect(result.settlement?.success).toBe(true)
+ expect(calls).toHaveLength(2)
+ const paymentHeader = calls[1]!.headers.get(PAYMENT_HEADER)
+ const decoded = decodePaymentHeader(paymentHeader!)
+ expect(decoded?.payload.authorization.from.toLowerCase()).toBe(
+ payerAccount.address.toLowerCase(),
+ )
+ expect(decoded?.payload.authorization.value).toBe('10000')
+ })
+
+ it('passes through a non-402 response untouched (no payment attempted)', async () => {
+ const fetchStub = vi.fn(async () => new Response('ok', { status: 200 }))
+ const client = new Hood402Client({
+ signer: fromAccount(payerAccount),
+ fetch: fetchStub as unknown as typeof fetch,
+ })
+ const result = await client.fetchWithReceipt(RESOURCE_URL)
+ expect(result.paid).toBe(false)
+ expect(fetchStub).toHaveBeenCalledOnce()
+ })
+
+ it('tracks cumulative spend per origin', async () => {
+ const { fetchStub } = make402ThenOkFetch('10000')
+ const client = new Hood402Client({
+ signer: fromAccount(payerAccount),
+ fetch: fetchStub as unknown as typeof fetch,
+ maxSpendPerOrigin: '1.00',
+ })
+ expect(client.spent('https://api.example.com')).toBe('0')
+ await client.fetchWithReceipt(RESOURCE_URL)
+ expect(client.spent('https://api.example.com')).toBe('0.01')
+ })
+})
+
+describe('Hood402Client — spend cap enforcement', () => {
+ it('throws SpendCapExceededError instead of paying above the cap', async () => {
+ // Price is 2.00 USDG but the cap is 1.00 — must refuse before signing.
+ const { fetchStub } = make402ThenOkFetch('2000000')
+ const client = new Hood402Client({
+ signer: fromAccount(payerAccount),
+ fetch: fetchStub as unknown as typeof fetch,
+ maxSpendPerOrigin: '1.00',
+ })
+
+ await expect(client.fetchWithReceipt(RESOURCE_URL)).rejects.toThrow(SpendCapExceededError)
+ // Only the initial 402 probe happened — no paid retry was sent.
+ expect(fetchStub).toHaveBeenCalledOnce()
+ })
+
+ it('accumulates spend across calls and refuses once the cap is reached', async () => {
+ const { fetchStub } = make402ThenOkFetch('600000') // 0.60 USDG per call
+ const client = new Hood402Client({
+ signer: fromAccount(payerAccount),
+ fetch: fetchStub as unknown as typeof fetch,
+ maxSpendPerOrigin: '1.00',
+ })
+
+ await client.fetchWithReceipt(RESOURCE_URL) // spend: 0.60
+ await expect(client.fetchWithReceipt(RESOURCE_URL + '?n=2')).rejects.toThrow(
+ SpendCapExceededError,
+ )
+ })
+})
diff --git a/robinhood/hood402/tests/encoding.test.ts b/robinhood/hood402/tests/encoding.test.ts
new file mode 100644
index 000000000..1a7baa14c
--- /dev/null
+++ b/robinhood/hood402/tests/encoding.test.ts
@@ -0,0 +1,81 @@
+import { describe, expect, it } from 'vitest'
+import {
+ decodePaymentHeader,
+ decodeSettlementHeader,
+ encodePaymentHeader,
+ encodeSettlementHeader,
+} from '../src/scheme/encoding.js'
+import type { PaymentPayload, SettleResult } from '../src/types.js'
+
+const samplePayload: PaymentPayload = {
+ x402Version: 1,
+ scheme: 'exact',
+ network: 'robinhood-testnet',
+ payload: {
+ signature: '0xabc123',
+ authorization: {
+ from: '0x1111111111111111111111111111111111111111',
+ to: '0x2222222222222222222222222222222222222222',
+ value: '10000',
+ validAfter: '1000',
+ validBefore: '2000',
+ nonce: '0xdead',
+ },
+ },
+}
+
+describe('payment header encoding', () => {
+ it('round-trips a payload through base64', () => {
+ const header = encodePaymentHeader(samplePayload)
+ expect(typeof header).toBe('string')
+ const decoded = decodePaymentHeader(header)
+ expect(decoded).toEqual(samplePayload)
+ })
+
+ it('preserves unicode in description-adjacent fields', () => {
+ const withUnicode: PaymentPayload = {
+ ...samplePayload,
+ network: 'robinhood-testnet — 测试',
+ }
+ const header = encodePaymentHeader(withUnicode)
+ expect(decodePaymentHeader(header)).toEqual(withUnicode)
+ })
+
+ it('returns null for a missing header', () => {
+ expect(decodePaymentHeader(undefined)).toBeNull()
+ expect(decodePaymentHeader(null)).toBeNull()
+ expect(decodePaymentHeader('')).toBeNull()
+ })
+
+ it('returns null (never throws) for malformed base64', () => {
+ expect(decodePaymentHeader('not-valid-base64!!!')).toBeNull()
+ })
+
+ it('returns null for base64 that decodes to non-JSON', () => {
+ const garbage = Buffer.from('this is not json').toString('base64')
+ expect(decodePaymentHeader(garbage)).toBeNull()
+ })
+
+ it('returns null for base64 JSON that is not an object (e.g. a bare number)', () => {
+ const notObject = Buffer.from('42').toString('base64')
+ expect(decodePaymentHeader(notObject)).toBeNull()
+ })
+})
+
+describe('settlement header encoding', () => {
+ it('round-trips a settle result', () => {
+ const result: SettleResult = {
+ success: true,
+ transaction: '0xdeadbeef',
+ network: 'robinhood-testnet',
+ payer: '0x1111111111111111111111111111111111111111',
+ }
+ const header = encodeSettlementHeader(result)
+ expect(decodeSettlementHeader(header)).toEqual(result)
+ })
+
+ it('returns null for malformed settlement headers', () => {
+ expect(decodeSettlementHeader('%%%not-base64%%%')).toBeNull()
+ expect(decodeSettlementHeader(undefined)).toBeNull()
+ })
+})
diff --git a/robinhood/hood402/tests/exact-scheme.test.ts b/robinhood/hood402/tests/exact-scheme.test.ts
new file mode 100644
index 000000000..553a99584
--- /dev/null
+++ b/robinhood/hood402/tests/exact-scheme.test.ts
@@ -0,0 +1,240 @@
+import { describe, expect, it } from 'vitest'
+import { privateKeyToAccount, generatePrivateKey } from 'viem/accounts'
+import { buildRequirements } from '../src/challenge.js'
+import { ROBINHOOD_TESTNET } from '../src/networks.js'
+import {
+ isWellFormedPayload,
+ randomNonce,
+ TRANSFER_WITH_AUTHORIZATION_TYPES,
+ usdgDomain,
+ validateStructural,
+ verifyAuthorizationSignature,
+} from '../src/scheme/exact.js'
+import type { ExactEvmAuthorization, PaymentPayload } from '../src/types.js'
+
+const PAYER_KEY = generatePrivateKey()
+const payerAccount = privateKeyToAccount(PAYER_KEY)
+const PAY_TO = '0x2222222222222222222222222222222222222222'
+
+const NOW = 1_800_000_000
+
+function requirements() {
+ return buildRequirements({
+ price: { atomic: '10000' },
+ payTo: PAY_TO,
+ resource: 'https://api.example.com/premium',
+ network: 'robinhood-testnet',
+ })
+}
+
+async function signedPayload(overrides: Partial<ExactEvmAuthorization> = {}): Promise<PaymentPayload> {
+ const authorization: ExactEvmAuthorization = {
+ from: payerAccount.address,
+ to: PAY_TO,
+ value: '10000',
+ validAfter: String(NOW - 60),
+ validBefore: String(NOW + 60),
+ nonce: randomNonce(),
+ ...overrides,
+ }
+ const signature = await payerAccount.signTypedData({
+ domain: usdgDomain(ROBINHOOD_TESTNET),
+ types: TRANSFER_WITH_AUTHORIZATION_TYPES,
+ primaryType: 'TransferWithAuthorization',
+ message: {
+ from: authorization.from,
+ to: authorization.to,
+ value: BigInt(authorization.value),
+ validAfter: BigInt(authorization.validAfter),
+ validBefore: BigInt(authorization.validBefore),
+ nonce: authorization.nonce,
+ },
+ })
+ return {
+ x402Version: 1,
+ scheme: 'exact',
+ network: 'robinhood-testnet',
+ payload: { signature, authorization },
+ }
+}
+
+describe('isWellFormedPayload', () => {
+ it('accepts a well-formed payload', async () => {
+ expect(isWellFormedPayload(await signedPayload())).toBe(true)
+ })
+
+ it('rejects payloads with the wrong x402Version', async () => {
+ const p = await signedPayload()
+ expect(isWellFormedPayload({ ...p, x402Version: 2 })).toBe(false)
+ })
+
+ it('rejects payloads with a missing authorization field', () => {
+ expect(
+ isWellFormedPayload({
+ x402Version: 1,
+ scheme: 'exact',
+ network: 'robinhood-testnet',
+ payload: { signature: '0xabc' },
+ }),
+ ).toBe(false)
+ })
+
+ it('rejects non-address from/to values', async () => {
+ const p = await signedPayload()
+ expect(
+ isWellFormedPayload({
+ ...p,
+ payload: { ...p.payload, authorization: { ...p.payload.authorization, from: 'not-an-address' } },
+ }),
+ ).toBe(false)
+ })
+
+ it('rejects null and non-object input', () => {
+ expect(isWellFormedPayload(null)).toBe(false)
+ expect(isWellFormedPayload('a string')).toBe(false)
+ expect(isWellFormedPayload(42)).toBe(false)
+ })
+})
+
+describe('validateStructural — the malformed/replay-adjacent/expiry/wrong-chain/underpayment matrix', () => {
+ it('accepts a valid payload within its validity window', async () => {
+ const result = validateStructural(await signedPayload(), requirements(), NOW)
+ expect(result.isValid).toBe(true)
+ expect(result.payer?.toLowerCase()).toBe(payerAccount.address.toLowerCase())
+ })
+
+ it('rejects a scheme mismatch', async () => {
+ const p = await signedPayload()
+ // @ts-expect-error - intentionally malformed for the test
+ const result = validateStructural({ ...p, scheme: 'upto' }, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'invalid_scheme' })
+ })
+
+ it('rejects an unsupported/unknown network', async () => {
+ const p = await signedPayload()
+ const result = validateStructural({ ...p, network: 'ethereum-mainnet' }, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'unsupported_network' })
+ })
+
+ it('rejects a wrong-chain payment (payload network != requirement network)', async () => {
+ const p = await signedPayload()
+ const result = validateStructural({ ...p, network: 'robinhood' }, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'network_mismatch' })
+ })
+
+ it('rejects a payment to the wrong recipient', async () => {
+ const p = await signedPayload({ to: '0x3333333333333333333333333333333333333333' })
+ const result = validateStructural(p, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'invalid_recipient' })
+ })
+
+ it('rejects underpayment (authorized value below the price)', async () => {
+ const p = await signedPayload({ value: '9999' })
+ const result = validateStructural(p, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'insufficient_amount' })
+ })
+
+ it('accepts overpayment (authorized value above the price)', async () => {
+ const p = await signedPayload({ value: '20000' })
+ const result = validateStructural(p, requirements(), NOW)
+ expect(result.isValid).toBe(true)
+ })
+
+ it('rejects an expired authorization (validBefore in the past)', async () => {
+ const p = await signedPayload({ validBefore: String(NOW - 1) })
+ const result = validateStructural(p, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'authorization_expired' })
+ })
+
+ it('rejects a not-yet-valid authorization (validAfter in the future)', async () => {
+ const p = await signedPayload({ validAfter: String(NOW + 1000) })
+ const result = validateStructural(p, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'authorization_not_yet_valid' })
+ })
+
+ it('rejects malformed numeric fields (non-numeric value)', async () => {
+ // A malicious/buggy client could send unsignable garbage over the wire —
+ // construct the payload directly rather than through the signer.
+ const valid = await signedPayload()
+ const p: PaymentPayload = {
+ ...valid,
+ payload: {
+ ...valid.payload,
+ authorization: { ...valid.payload.authorization, value: 'not-a-number' },
+ },
+ }
+ const result = validateStructural(p, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'malformed_payment' })
+ })
+
+ it('rejects malformed validity window fields', async () => {
+ const valid = await signedPayload()
+ const p: PaymentPayload = {
+ ...valid,
+ payload: {
+ ...valid.payload,
+ authorization: { ...valid.payload.authorization, validBefore: 'soon' },
+ },
+ }
+ const result = validateStructural(p, requirements(), NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'malformed_payment' })
+ })
+
+ it('rejects a payment for the wrong asset (requirement pinned to a foreign token)', async () => {
+ const p = await signedPayload()
+ const req = { ...requirements(), asset: '0x9999999999999999999999999999999999999999' as const }
+ const result = validateStructural(p, req, NOW)
+ expect(result).toEqual({ isValid: false, invalidReason: 'invalid_asset' })
+ })
+})
+
+describe('EIP-3009 signature verification', () => {
+ it('recovers a valid signature to the payer address', async () => {
+ const p = await signedPayload()
+ const ok = await verifyAuthorizationSignature(
+ ROBINHOOD_TESTNET,
+ p.payload.authorization,
+ p.payload.signature,
+ )
+ expect(ok).toBe(true)
+ })
+
+ it('rejects a tampered amount (signature no longer matches the message)', async () => {
+ const p = await signedPayload()
+ const tampered = { ...p.payload.authorization, value: '999999999' }
+ const ok = await verifyAuthorizationSignature(ROBINHOOD_TESTNET, tampered, p.payload.signature)
+ expect(ok).toBe(false)
+ })
+
+ it('rejects a signature from the wrong domain (mainnet signature replayed on testnet)', async () => {
+ const p = await signedPayload()
+ // Re-sign against the WRONG (mainnet) domain, then verify against testnet.
+ const mainnetSig = await payerAccount.signTypedData({
+ domain: usdgDomain({ ...ROBINHOOD_TESTNET, chainId: 4663 }),
+ types: TRANSFER_WITH_AUTHORIZATION_TYPES,
+ primaryType: 'TransferWithAuthorization',
+ message: {
+ from: p.payload.authorization.from,
+ to: p.payload.authorization.to,
+ value: BigInt(p.payload.authorization.value),
+ validAfter: BigInt(p.payload.authorization.validAfter),
+ validBefore: BigInt(p.payload.authorization.validBefore),
+ nonce: p.payload.authorization.nonce,
+ },
+ })
+ const ok = await verifyAuthorizationSignature(
+ ROBINHOOD_TESTNET,
+ p.payload.authorization,
+ mainnetSig,
+ )
+ expect(ok).toBe(false)
+ })
+
+ it('rejects a signature recovering to a different signer than `from`', async () => {
+ const p = await signedPayload()
+ const otherPayer = privateKeyToAccount(generatePrivateKey())
+ const spoofed = { ...p.payload.authorization, from: otherPayer.address }
+ const ok = await verifyAuthorizationSignature(ROBINHOOD_TESTNET, spoofed, p.payload.signature)
+ expect(ok).toBe(false)
+ })
+})
diff --git a/robinhood/hood402/tests/server.test.ts b/robinhood/hood402/tests/server.test.ts
new file mode 100644
index 000000000..562bb54d3
--- /dev/null
+++ b/robinhood/hood402/tests/server.test.ts
@@ -0,0 +1,222 @@
+import { describe, expect, it, vi } from 'vitest'
+import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
+import { PaywallEngine, paywall } from '../src/server/index.js'
+import { Hood402ConfigError } from '../src/errors.js'
+import { FacilitatorClient } from '../src/facilitator-client.js'
+import { PAYMENT_HEADER, PAYMENT_RESPONSE_HEADER } from '../src/challenge.js'
+import { encodePaymentHeader } from '../src/scheme/encoding.js'
+import { randomNonce, TRANSFER_WITH_AUTHORIZATION_TYPES, usdgDomain } from '../src/scheme/exact.js'
+import { ROBINHOOD_TESTNET } from '../src/networks.js'
+import type { ExactEvmAuthorization, PaymentPayload } from '../src/types.js'
+
+const payerAccount = privateKeyToAccount(generatePrivateKey())
+const PAY_TO = '0x2222222222222222222222222222222222222222'
+const NOW = 1_800_000_000
+
+async function signedPayload(overrides: Partial<ExactEvmAuthorization> = {}): Promise<PaymentPayload> {
+ const authorization: ExactEvmAuthorization = {
+ from: payerAccount.address,
+ to: PAY_TO,
+ value: '10000',
+ validAfter: String(NOW - 60),
+ validBefore: String(NOW + 60),
+ nonce: randomNonce(),
+ ...overrides,
+ }
+ const signature = await payerAccount.signTypedData({
+ domain: usdgDomain(ROBINHOOD_TESTNET),
+ types: TRANSFER_WITH_AUTHORIZATION_TYPES,
+ primaryType: 'TransferWithAuthorization',
+ message: {
+ from: authorization.from,
+ to: authorization.to,
+ value: BigInt(authorization.value),
+ validAfter: BigInt(authorization.validAfter),
+ validBefore: BigInt(authorization.validBefore),
+ nonce: authorization.nonce,
+ },
+ })
+ return {
+ x402Version: 1,
+ scheme: 'exact',
+ network: 'robinhood-testnet',
+ payload: { signature, authorization },
+ }
+}
+
+function stubFacilitator() {
+ const client = Object.create(FacilitatorClient.prototype) as FacilitatorClient
+ return client
+}
+
+describe('PaywallEngine construction', () => {
+ it('throws Hood402ConfigError when neither facilitator nor a full self-settle set is given', () => {
+ expect(
+ () => new PaywallEngine({ price: '0.01', payTo: PAY_TO, resource: 'https://x.test/r' }),
+ ).toThrow(Hood402ConfigError)
+ })
+
+ it('accepts facilitator mode with just a URL string', () => {
+ expect(
+ () =>
+ new PaywallEngine({
+ price: '0.01',
+ payTo: PAY_TO,
+ facilitator: 'https://facilitator.example.com',
+ }),
+ ).not.toThrow()
+ })
+})
+
+describe('PaywallEngine.authorize — facilitator mode', () => {
+ it('issues a 402 challenge when no X-PAYMENT header is present', async () => {
+ const engine = new PaywallEngine({
+ price: '0.01',
+ payTo: PAY_TO,
+ network: 'robinhood-testnet',
+ facilitator: 'https://facilitator.example.com',
+ })
+ const auth = await engine.authorize(undefined, 'https://api.example.com/premium')
+ expect(auth.ok).toBe(false)
+ if (!auth.ok) {
+ expect(auth.status).toBe(402)
+ expect(auth.body.accepts[0]?.maxAmountRequired).toBe('10000')
+ expect(auth.body.accepts[0]?.network).toBe('robinhood-testnet')
+ }
+ })
+
+ it('issues a 402 with malformed_payment when the header cannot be decoded', async () => {
+ const engine = new PaywallEngine({
+ price: '0.01',
+ payTo: PAY_TO,
+ network: 'robinhood-testnet',
+ facilitator: 'https://facilitator.example.com',
+ })
+ const auth = await engine.authorize('not-base64-garbage!!!', 'https://api.example.com/premium')
+ expect(auth.ok).toBe(false)
+ if (!auth.ok) expect(auth.body.error).toBeTruthy()
+ })
+
+ it('delegates verification to the facilitator and passes through a valid payment', async () => {
+ const facilitator = stubFacilitator()
+ facilitator.verify = vi.fn().mockResolvedValue({ isValid: true, payer: payerAccount.address })
+ const engine = new PaywallEngine({
+ price: '0.01',
+ payTo: PAY_TO,
+ network: 'robinhood-testnet',
+ facilitator,
+ })
+ const payload = await signedPayload()
+ const auth = await engine.authorize(
+ encodePaymentHeader(payload),
+ 'https://api.example.com/premium',
+ )
+ expect(auth.ok).toBe(true)
+ expect(facilitator.verify).toHaveBeenCalledOnce()
+ })
+
+ it('turns a facilitator-rejected payment into a fresh 402', async () => {
+ const facilitator = stubFacilitator()
+ facilitator.verify = vi
+ .fn()
+ .mockResolvedValue({ isValid: false, invalidReason: 'insufficient_amount' })
+ const engine = new PaywallEngine({
+ price: '0.01',
+ payTo: PAY_TO,
+ network: 'robinhood-testnet',
+ facilitator,
+ })
+ const payload = await signedPayload({ value: '1' })
+ const auth = await engine.authorize(
+ encodePaymentHeader(payload),
+ 'https://api.example.com/premium',
+ )
+ expect(auth.ok).toBe(false)
+ })
+})
+
+describe('PaywallEngine.settle — facilitator mode', () => {
+ it('delegates settlement and returns the receipt', async () => {
+ const facilitator = stubFacilitator()
+ facilitator.verify = vi.fn().mockResolvedValue({ isValid: true, payer: payerAccount.address })
+ facilitator.settle = vi.fn().mockResolvedValue({
+ success: true,
+ transaction: '0xdeadbeef',
+ network: 'robinhood-testnet',
+ payer: payerAccount.address,
+ })
+ const engine = new PaywallEngine({
+ price: '0.01',
+ payTo: PAY_TO,
+ network: 'robinhood-testnet',
+ facilitator,
+ })
+ const payload = await signedPayload()
+ const auth = await engine.authorize(
+ encodePaymentHeader(payload),
+ 'https://api.example.com/premium',
+ )
+ expect(auth.ok).toBe(true)
+ if (!auth.ok) return
+ const settlement = await engine.settle(auth.payload, auth.requirements)
+ expect(settlement.success).toBe(true)
+ expect(engine.settlementHeader(settlement)).toEqual(expect.any(String))
+ })
+})
+
+describe('paywall() Express middleware', () => {
+ function mockReqRes(headerValue?: string) {
+ const headers: Record<string, string> = {}
+ const req = {
+ header: (name: string) => (name.toLowerCase() === PAYMENT_HEADER.toLowerCase() ? headerValue : undefined),
+ protocol: 'https',
+ originalUrl: '/premium',
+ get: (name: string) => (name === 'host' ? 'api.example.com' : undefined),
+ }
+ const res = {
+ statusCode: 200,
+ body: undefined as unknown,
+ status(code: number) {
+ this.statusCode = code
+ return this
+ },
+ json(body: unknown) {
+ this.body = body
+ return body
+ },
+ headers: {} as Record<string, string>,
+ setHeader(name: string, value: string) {
+ this.headers[name] = value
+ },
+ }
+ return { req, res }
+ }
+
+ it('returns 402 and never calls next() when unpaid', async () => {
+ const facilitator = stubFacilitator()
+ const mw = paywall({ price: '0.01', payTo: PAY_TO, network: 'robinhood-testnet', facilitator })
+ const { req, res } = mockReqRes()
+ const next = vi.fn()
+ await mw(req, res as never, next)
+ expect(res.statusCode).toBe(402)
+ expect(next).not.toHaveBeenCalled()
+ })
+
+ it('settles and calls next() with X-PAYMENT-RESPONSE set when paid', async () => {
+ const facilitator = stubFacilitator()
+ facilitator.verify = vi.fn().mockResolvedValue({ isValid: true, payer: payerAccount.address })
+ facilitator.settle = vi.fn().mockResolvedValue({
+ success: true,
+ transaction: '0xdeadbeef',
+ network: 'robinhood-testnet',
+ payer: payerAccount.address,
+ })
+ const mw = paywall({ price: '0.01', payTo: PAY_TO, network: 'robinhood-testnet', facilitator })
+ const payload = await signedPayload()
+ const { req, res } = mockReqRes(encodePaymentHeader(payload))
+ const next = vi.fn()
+ await mw(req, res as never, next)
+ expect(next).toHaveBeenCalledOnce()
+ expect(res.headers[PAYMENT_RESPONSE_HEADER]).toBeTruthy()
+ })
+})
diff --git a/robinhood/hood402/tests/settle.test.ts b/robinhood/hood402/tests/settle.test.ts
new file mode 100644
index 000000000..f7813bd3a
--- /dev/null
+++ b/robinhood/hood402/tests/settle.test.ts
@@ -0,0 +1,201 @@
+import { describe, expect, it, vi } from 'vitest'
+import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
+import { buildRequirements } from '../src/challenge.js'
+import { ROBINHOOD_TESTNET } from '../src/networks.js'
+import { randomNonce, TRANSFER_WITH_AUTHORIZATION_TYPES, usdgDomain } from '../src/scheme/exact.js'
+import { settlePayment, type HoodBroadcaster, type HoodConfirmer } from '../src/settle.js'
+import type { ExactEvmAuthorization, PaymentPayload } from '../src/types.js'
+
+const payerAccount = privateKeyToAccount(generatePrivateKey())
+const FACILITATOR_ADDRESS = '0x4444444444444444444444444444444444444444' as const
+const PAY_TO = '0x2222222222222222222222222222222222222222'
+const NOW = 1_800_000_000
+
+function requirements() {
+ return buildRequirements({
+ price: { atomic: '10000' },
+ payTo: PAY_TO,
+ resource: 'https://api.example.com/premium',
+ network: 'robinhood-testnet',
+ })
+}
+
+async function signedPayload(overrides: Partial<ExactEvmAuthorization> = {}): Promise<PaymentPayload> {
+ const authorization: ExactEvmAuthorization = {
+ from: payerAccount.address,
+ to: PAY_TO,
+ value: '10000',
+ validAfter: String(NOW - 60),
+ validBefore: String(NOW + 60),
+ nonce: randomNonce(),
+ ...overrides,
+ }
+ const signature = await payerAccount.signTypedData({
+ domain: usdgDomain(ROBINHOOD_TESTNET),
+ types: TRANSFER_WITH_AUTHORIZATION_TYPES,
+ primaryType: 'TransferWithAuthorization',
+ message: {
+ from: authorization.from,
+ to: authorization.to,
+ value: BigInt(authorization.value),
+ validAfter: BigInt(authorization.validAfter),
+ validBefore: BigInt(authorization.validBefore),
+ nonce: authorization.nonce,
+ },
+ })
+ return {
+ x402Version: 1,
+ scheme: 'exact',
+ network: 'robinhood-testnet',
+ payload: { signature, authorization },
+ }
+}
+
+const TX_HASH = ('0x' + 'ab'.repeat(32)) as `0x${string}`
+
+function makeConfirmer(opts: {
+ used: boolean
+ balance: bigint
+ receiptStatus: 'success' | 'reverted'
+}): HoodConfirmer {
+ return {
+ async readContract(args) {
+ if (args.functionName === 'authorizationState') return opts.used
+ if (args.functionName === 'balanceOf') return opts.balance
+ throw new Error(`unexpected readContract: ${args.functionName}`)
+ },
+ async waitForTransactionReceipt({ hash }) {
+ return { status: opts.receiptStatus, transactionHash: hash }
+ },
+ }
+}
+
+describe('settlePayment — happy path', () => {
+ it('broadcasts transferWithAuthorization and returns the confirmed tx hash', async () => {
+ const write = vi.fn<HoodBroadcaster['writeContract']>().mockResolvedValue(TX_HASH)
+ const wallet: HoodBroadcaster = { writeContract: write }
+ const reader = makeConfirmer({ used: false, balance: 1_000_000n, receiptStatus: 'success' })
+
+ const result = await settlePayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ wallet,
+ account: FACILITATOR_ADDRESS,
+ reader,
+ now: NOW,
+ })
+
+ expect(result.success).toBe(true)
+ expect(result.transaction).toBe(TX_HASH)
+ expect(result.network).toBe('robinhood-testnet')
+ expect(write).toHaveBeenCalledOnce()
+ const call = write.mock.calls[0]![0]
+ expect(call.functionName).toBe('transferWithAuthorization')
+ expect(call.account).toBe(FACILITATOR_ADDRESS)
+ })
+})
+
+describe('settlePayment — replay protection blocks settlement before broadcasting', () => {
+ it('refuses to settle an already-used nonce and never calls the wallet', async () => {
+ const write = vi.fn<HoodBroadcaster['writeContract']>().mockResolvedValue(TX_HASH)
+ const wallet: HoodBroadcaster = { writeContract: write }
+ const reader = makeConfirmer({ used: true, balance: 1_000_000n, receiptStatus: 'success' })
+
+ const result = await settlePayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ wallet,
+ account: FACILITATOR_ADDRESS,
+ reader,
+ now: NOW,
+ })
+
+ expect(result.success).toBe(false)
+ expect(result.errorReason).toBe('authorization_already_used')
+ expect(write).not.toHaveBeenCalled()
+ })
+})
+
+describe('settlePayment — underpayment is caught by re-verification', () => {
+ it('refuses to settle when the authorized value no longer covers the price', async () => {
+ const write = vi.fn<HoodBroadcaster['writeContract']>().mockResolvedValue(TX_HASH)
+ const wallet: HoodBroadcaster = { writeContract: write }
+ const reader = makeConfirmer({ used: false, balance: 1_000_000n, receiptStatus: 'success' })
+
+ const result = await settlePayment({
+ payload: await signedPayload({ value: '1' }),
+ requirements: requirements(),
+ wallet,
+ account: FACILITATOR_ADDRESS,
+ reader,
+ now: NOW,
+ })
+
+ expect(result.success).toBe(false)
+ expect(result.errorReason).toBe('insufficient_amount')
+ expect(write).not.toHaveBeenCalled()
+ })
+})
+
+describe('settlePayment — broadcast failure', () => {
+ it('returns settlement_failed when the wallet rejects the transaction', async () => {
+ const write = vi.fn<HoodBroadcaster['writeContract']>().mockRejectedValue(new Error('rpc down'))
+ const wallet: HoodBroadcaster = { writeContract: write }
+ const reader = makeConfirmer({ used: false, balance: 1_000_000n, receiptStatus: 'success' })
+
+ const result = await settlePayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ wallet,
+ account: FACILITATOR_ADDRESS,
+ reader,
+ now: NOW,
+ })
+
+ expect(result.success).toBe(false)
+ expect(result.errorReason).toBe('settlement_failed')
+ })
+})
+
+describe('settlePayment — on-chain revert', () => {
+ it('returns settlement_failed with the transaction hash when the receipt reverted', async () => {
+ const write = vi.fn<HoodBroadcaster['writeContract']>().mockResolvedValue(TX_HASH)
+ const wallet: HoodBroadcaster = { writeContract: write }
+ const reader = makeConfirmer({ used: false, balance: 1_000_000n, receiptStatus: 'reverted' })
+
+ const result = await settlePayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ wallet,
+ account: FACILITATOR_ADDRESS,
+ reader,
+ now: NOW,
+ })
+
+ expect(result.success).toBe(false)
+ expect(result.errorReason).toBe('settlement_failed')
+ expect(result.transaction).toBe(TX_HASH)
+ })
+})
+
+describe('settlePayment — reverify: false', () => {
+ it('skips re-verification and broadcasts even against a stale replay-flagged reader', async () => {
+ const write = vi.fn<HoodBroadcaster['writeContract']>().mockResolvedValue(TX_HASH)
+ const wallet: HoodBroadcaster = { writeContract: write }
+ // `used: true` would normally block settlement — but reverify is disabled.
+ const reader = makeConfirmer({ used: true, balance: 1_000_000n, receiptStatus: 'success' })
+
+ const result = await settlePayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ wallet,
+ account: FACILITATOR_ADDRESS,
+ reader,
+ now: NOW,
+ reverify: false,
+ })
+
+ expect(result.success).toBe(true)
+ expect(write).toHaveBeenCalledOnce()
+ })
+})
diff --git a/robinhood/hood402/tests/verify.test.ts b/robinhood/hood402/tests/verify.test.ts
new file mode 100644
index 000000000..027ae45f8
--- /dev/null
+++ b/robinhood/hood402/tests/verify.test.ts
@@ -0,0 +1,141 @@
+import { describe, expect, it } from 'vitest'
+import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
+import { buildRequirements } from '../src/challenge.js'
+import { ROBINHOOD_TESTNET } from '../src/networks.js'
+import { randomNonce, TRANSFER_WITH_AUTHORIZATION_TYPES, usdgDomain } from '../src/scheme/exact.js'
+import { verifyPayment, type HoodReader } from '../src/verify.js'
+import type { ExactEvmAuthorization, PaymentPayload } from '../src/types.js'
+
+const payerAccount = privateKeyToAccount(generatePrivateKey())
+const PAY_TO = '0x2222222222222222222222222222222222222222'
+const NOW = 1_800_000_000
+
+function requirements() {
+ return buildRequirements({
+ price: { atomic: '10000' },
+ payTo: PAY_TO,
+ resource: 'https://api.example.com/premium',
+ network: 'robinhood-testnet',
+ })
+}
+
+async function signedPayload(overrides: Partial<ExactEvmAuthorization> = {}): Promise<PaymentPayload> {
+ const authorization: ExactEvmAuthorization = {
+ from: payerAccount.address,
+ to: PAY_TO,
+ value: '10000',
+ validAfter: String(NOW - 60),
+ validBefore: String(NOW + 60),
+ nonce: randomNonce(),
+ ...overrides,
+ }
+ const signature = await payerAccount.signTypedData({
+ domain: usdgDomain(ROBINHOOD_TESTNET),
+ types: TRANSFER_WITH_AUTHORIZATION_TYPES,
+ primaryType: 'TransferWithAuthorization',
+ message: {
+ from: authorization.from,
+ to: authorization.to,
+ value: BigInt(authorization.value),
+ validAfter: BigInt(authorization.validAfter),
+ validBefore: BigInt(authorization.validBefore),
+ nonce: authorization.nonce,
+ },
+ })
+ return {
+ x402Version: 1,
+ scheme: 'exact',
+ network: 'robinhood-testnet',
+ payload: { signature, authorization },
+ }
+}
+
+/** A stub RPC reader whose responses are pre-programmed per test. */
+function stubReader(opts: { used: boolean; balance: bigint }): HoodReader {
+ return {
+ async readContract(args) {
+ if (args.functionName === 'authorizationState') return opts.used
+ if (args.functionName === 'balanceOf') return opts.balance
+ throw new Error(`unexpected readContract call: ${args.functionName}`)
+ },
+ }
+}
+
+describe('verifyPayment — structure + signature only (no reader)', () => {
+ it('succeeds without touching the chain when no reader is supplied', async () => {
+ const result = await verifyPayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ now: NOW,
+ })
+ expect(result.isValid).toBe(true)
+ expect(result.payer?.toLowerCase()).toBe(payerAccount.address.toLowerCase())
+ })
+
+ it('fails structural checks before ever needing a reader', async () => {
+ const result = await verifyPayment({
+ payload: await signedPayload({ value: '1' }),
+ requirements: requirements(),
+ now: NOW,
+ })
+ expect(result).toEqual({ isValid: false, invalidReason: 'insufficient_amount' })
+ })
+
+ it('fails on an invalid signature', async () => {
+ const p = await signedPayload()
+ p.payload.signature = ('0x' + 'ab'.repeat(65)) as `0x${string}`
+ const result = await verifyPayment({ payload: p, requirements: requirements(), now: NOW })
+ expect(result).toEqual({ isValid: false, invalidReason: 'invalid_signature' })
+ })
+})
+
+describe('verifyPayment — replay protection (RPC reader)', () => {
+ it('rejects a nonce that has already been settled (replay)', async () => {
+ const reader = stubReader({ used: true, balance: 1_000_000n })
+ const result = await verifyPayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ reader,
+ now: NOW,
+ })
+ expect(result).toEqual({
+ isValid: false,
+ invalidReason: 'authorization_already_used',
+ })
+ })
+
+ it('accepts a fresh (unused) nonce with sufficient balance', async () => {
+ const reader = stubReader({ used: false, balance: 1_000_000n })
+ const result = await verifyPayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ reader,
+ now: NOW,
+ })
+ expect(result.isValid).toBe(true)
+ })
+})
+
+describe('verifyPayment — balance checks (RPC reader)', () => {
+ it('rejects a payer with insufficient USDG balance', async () => {
+ const reader = stubReader({ used: false, balance: 1n })
+ const result = await verifyPayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ reader,
+ now: NOW,
+ })
+ expect(result).toEqual({ isValid: false, invalidReason: 'insufficient_funds' })
+ })
+
+ it('accepts a payer whose balance exactly equals the payment', async () => {
+ const reader = stubReader({ used: false, balance: 10000n })
+ const result = await verifyPayment({
+ payload: await signedPayload(),
+ requirements: requirements(),
+ reader,
+ now: NOW,
+ })
+ expect(result.isValid).toBe(true)
+ })
+})
diff --git a/robinhood/hoodkit/probe-chunk-size.mjs b/robinhood/hoodkit/probe-chunk-size.mjs
new file mode 100644
index 000000000..504b91bf1
--- /dev/null
+++ b/robinhood/hoodkit/probe-chunk-size.mjs
@@ -0,0 +1,20 @@
+import { createHoodClient } from 'hoodchain'
+const hood = createHoodClient()
+const TRANSFER = { type: 'event', name: 'Transfer', inputs: [
+ { name: 'from', type: 'address', indexed: true },
+ { name: 'to', type: 'address', indexed: true },
+ { name: 'value', type: 'uint256', indexed: false },
+]}
+const token = '0xA80eb66b3E0CF66ccB46f8b8C9e7ff5803eEb820'
+const head = await hood.public.getBlockNumber()
+console.log('head', head)
+
+for (const chunk of [5000n, 20000n, 50000n, 100000n]) {
+ const t0 = Date.now()
+ try {
+ const logs = await hood.public.getLogs({ address: token, event: TRANSFER, fromBlock: head - chunk, toBlock: head })
+ console.log('chunk', chunk, 'logs', logs.length, 'ms', Date.now()-t0)
+ } catch (e) {
+ console.log('chunk', chunk, 'ERROR', e.shortMessage || e.message?.slice(0,150))
+ }
+}
diff --git a/robinhood/hoodkit/probe-launches.mjs b/robinhood/hoodkit/probe-launches.mjs
new file mode 100644
index 000000000..b7b117089
--- /dev/null
+++ b/robinhood/hoodkit/probe-launches.mjs
@@ -0,0 +1,27 @@
+import { createHoodClient, getRecentLaunches, NOXA_ADDRESSES, ODYSSEY_ADDRESSES } from 'hoodchain'
+
+const hood = createHoodClient()
+const head = await hood.public.getBlockNumber()
+console.log('head', head)
+
+const launches = await getRecentLaunches(hood, { lookbackBlocks: 50000n })
+console.log('launches found', launches.length)
+// Check swap activity on the most recent few NOXA launches (instant pools)
+const noxa = launches.filter(l => l.launchpad === 'noxa' && l.pool).slice(-10)
+for (const l of noxa) {
+ const logs = await hood.public.getLogs({
+ address: l.pool,
+ event: { type: 'event', name: 'Swap', inputs: [
+ { name: 'sender', type: 'address', indexed: true },
+ { name: 'recipient', type: 'address', indexed: true },
+ { name: 'amount0', type: 'int256', indexed: false },
+ { name: 'amount1', type: 'int256', indexed: false },
+ { name: 'sqrtPriceX96', type: 'uint160', indexed: false },
+ { name: 'liquidity', type: 'uint128', indexed: false },
+ { name: 'tick', type: 'int24', indexed: false },
+ ]},
+ fromBlock: l.blockNumber,
+ toBlock: head,
+ })
+ console.log('noxa token', l.token, 'pool', l.pool, 'launchBlock', l.blockNumber, 'swaps', logs.length)
+}
diff --git a/robinhood/hoodkit/probe-launches2.mjs b/robinhood/hoodkit/probe-launches2.mjs
new file mode 100644
index 000000000..0cb3c9111
--- /dev/null
+++ b/robinhood/hoodkit/probe-launches2.mjs
@@ -0,0 +1,9 @@
+import { createHoodClient, getRecentLaunches } from 'hoodchain'
+
+const hood = createHoodClient()
+const head = await hood.public.getBlockNumber()
+console.log('head', head)
+
+const launches = await getRecentLaunches(hood, { lookbackBlocks: 1000000n, chunkSize: 10000n })
+console.log('launches found (1M blocks, ~36h)', launches.length)
+console.log(launches.slice(-15))
diff --git a/robinhood/hoodkit/probe-pool-info.mjs b/robinhood/hoodkit/probe-pool-info.mjs
new file mode 100644
index 000000000..8f04e3f08
--- /dev/null
+++ b/robinhood/hoodkit/probe-pool-info.mjs
@@ -0,0 +1,20 @@
+import { createHoodClient } from 'hoodchain'
+import { loadPoolInfo } from './dist/index.js'
+
+const hood = createHoodClient()
+const pool = '0x3F98045d6bc0fEF56bf69E85F1efA7F5100e7c48'
+const info = await loadPoolInfo(hood, pool)
+console.log(info)
+
+const head = await hood.public.getBlockNumber()
+const SWAP = { type: 'event', name: 'Swap', inputs: [
+ { name: 'sender', type: 'address', indexed: true },
+ { name: 'recipient', type: 'address', indexed: true },
+ { name: 'amount0', type: 'int256', indexed: false },
+ { name: 'amount1', type: 'int256', indexed: false },
+ { name: 'sqrtPriceX96', type: 'uint160', indexed: false },
+ { name: 'liquidity', type: 'uint128', indexed: false },
+ { name: 'tick', type: 'int24', indexed: false },
+]}
+const logs = await hood.public.getLogs({ address: pool, event: SWAP, fromBlock: head - 2000n, toBlock: head })
+console.log('swaps in last 2000 blocks (~4.3 min):', logs.length)
diff --git a/robinhood/hoodkit/probe-recent-swaps.mjs b/robinhood/hoodkit/probe-recent-swaps.mjs
new file mode 100644
index 000000000..599ca0f8d
--- /dev/null
+++ b/robinhood/hoodkit/probe-recent-swaps.mjs
@@ -0,0 +1,29 @@
+import { createHoodClient, getRecentLaunches } from 'hoodchain'
+
+const hood = createHoodClient()
+const head = await hood.public.getBlockNumber()
+console.log('head', head)
+
+const launches = await getRecentLaunches(hood, { lookbackBlocks: 100000n, chunkSize: 10000n })
+const noxa = launches.filter(l => l.launchpad === 'noxa' && l.pool)
+console.log('noxa launches in last 100k blocks', noxa.length)
+
+const SWAP = { type: 'event', name: 'Swap', inputs: [
+ { name: 'sender', type: 'address', indexed: true },
+ { name: 'recipient', type: 'address', indexed: true },
+ { name: 'amount0', type: 'int256', indexed: false },
+ { name: 'amount1', type: 'int256', indexed: false },
+ { name: 'sqrtPriceX96', type: 'uint160', indexed: false },
+ { name: 'liquidity', type: 'uint128', indexed: false },
+ { name: 'tick', type: 'int24', indexed: false },
+]}
+
+let best = null
+for (const l of noxa.slice(-40)) {
+ try {
+ const logs = await hood.public.getLogs({ address: l.pool, event: SWAP, fromBlock: l.blockNumber, toBlock: head })
+ console.log(l.token, l.pool, 'launchBlock', l.blockNumber, 'swaps', logs.length)
+ if (!best || logs.length > best.count) best = { token: l.token, pool: l.pool, count: logs.length, launchBlock: l.blockNumber }
+ } catch (e) { console.log('err', e.message?.slice(0,60)) }
+}
+console.log('BEST', best)
diff --git a/robinhood/hoodkit/probe-recent-swaps2.mjs b/robinhood/hoodkit/probe-recent-swaps2.mjs
new file mode 100644
index 000000000..b50c8ed9a
--- /dev/null
+++ b/robinhood/hoodkit/probe-recent-swaps2.mjs
@@ -0,0 +1,15 @@
+import { createHoodClient, getRecentLaunches } from 'hoodchain'
+
+const hood = createHoodClient()
+const head = await hood.public.getBlockNumber()
+console.log('head', head)
+
+const launches = await getRecentLaunches(hood, { lookbackBlocks: 1000000n, chunkSize: 10000n })
+const noxa = launches.filter(l => l.launchpad === 'noxa' && l.pool).sort((a,b)=> a.blockNumber < b.blockNumber ? 1 : -1)
+console.log('total noxa', noxa.length)
+console.log('most recent 10 blockNumbers:', noxa.slice(0,10).map(l=>l.blockNumber.toString()))
+console.log('gap from head:', (head - noxa[0].blockNumber).toString(), 'blocks')
+
+const odyssey = launches.filter(l => l.launchpad === 'odyssey').sort((a,b)=> a.blockNumber < b.blockNumber ? 1 : -1)
+console.log('total odyssey', odyssey.length)
+if (odyssey.length) console.log('most recent odyssey blockNumbers:', odyssey.slice(0,10).map(l=>l.blockNumber.toString()))
diff --git a/robinhood/learn-robinhood-chain/README.md b/robinhood/learn-robinhood-chain/README.md
new file mode 100644
index 000000000..d45e00bfc
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/README.md
@@ -0,0 +1,79 @@
+# learn-robinhood-chain
+
+**The definitive learning site for building on [Robinhood Chain](https://docs.robinhood.com/chain/) (chain ID 4663).**
+
+Twelve tutorials, zero to shipping an autonomous agent, every one of them performed on real mainnet/testnet data during the build — not described secondhand. Static site, self-contained, no CDN dependencies, deploys to GitHub Pages from `docs/`.
+
+**Live site:** `https://nirholas.github.io/learn-robinhood-chain/` (after Pages setup — see below)
+
+## What's here
+
+| Section | Tutorials |
+| --- | --- |
+| **Foundations** | What Robinhood Chain actually is · Connect and read in 5 minutes · Stock Tokens explained |
+| **Building** | Live price ticker · Portfolio tracker · Swapping on-chain · Streaming the chain |
+| **Monetizing & agents** | Sell your API for USDG (x402) · AI agent access (MCP) · Autonomous trading agent · Launch a coin |
+| **Capstone** | Ship it — deploy and go mainnet |
+
+Every tutorial is built on the open-source [`hoodchain`](https://github.com/nirholas/robinhood-chain-sdk) TypeScript SDK. Real prices, real transaction hashes, real firehose throughput numbers, and — in Tutorial 8 — a real bug this course found and fixed while writing the payment-verification example, documented rather than smoothed over.
+
+## Local preview
+
+```bash
+npm install
+npm run dev # builds content/ -> docs/, then serves it at http://localhost:4173
+```
+
+Or separately:
+
+```bash
+npm run build # renders content/*.md -> docs/ (the static site generator, build.mjs)
+npm run serve # serves the already-built docs/ folder
+```
+
+`docs/` is committed — it's what GitHub Pages deploys. Always run `npm run build` before committing a content change; nothing rebuilds it for you on push.
+
+## Architecture
+
+- **`build.mjs`** — the static site generator. Renders `content/*.md` (ordered by `content/meta.json`) through [`marked`](https://www.npmjs.com/package/marked) with a custom renderer (heading anchors, copy-button code blocks via [`highlight.js`](https://www.npmjs.com/package/highlight.js), `:::note`/`:::warning`/`:::tip`/`:::danger` callout blocks) into styled HTML pages, plus a build-time search index. `marked` and `highlight.js` are **build-time only** — nothing in `docs/` fetches them or any other CDN resource at runtime.
+- **`assets/`** — hand-written CSS and vanilla JS, copied verbatim into `docs/assets/` at build time:
+ - `styles.css` — the whole design system (theme-aware CSS custom properties, dark by default, light via `data-theme`).
+ - `app.js` — theme toggle, code-block copy buttons, mobile nav, per-tutorial "mark complete" progress (stored in `localStorage`), TOC scrollspy.
+ - `search.js` — hand-rolled offline search over the build-time index (`assets/search-index.json`). No lunr, no server.
+ - `ticker.js` — the landing page's live chain-stats strip: raw JSON-RPC over `fetch` against the public Robinhood Chain mainnet RPC, decoded by hand (no viem in the browser bundle — this is the zero-dependency reference implementation Tutorial 4 links to).
+- **`content/`** — one Markdown file per tutorial plus `meta.json` (title, section, description, prerequisites, "what you'll build," ordering). Add a tutorial by adding both.
+- **`serve.mjs`** — a zero-dependency static file server for local preview that mimics GitHub Pages' `/slug/` → `/slug/index.html` routing.
+
+## Adding a tutorial
+
+1. Write `content/NN-your-slug.md`. Use `:::tip`, `:::note`, `:::warning`, `:::danger` for callouts; fenced code blocks get automatic syntax highlighting and a copy button.
+2. Add an entry to the `pages` array in `content/meta.json` — `slug` must match the filename (without `.md`), `section` groups it in the sidebar and landing page.
+3. `npm run build && npm run serve`, check it at `http://localhost:4173`.
+4. **Actually perform what you're documenting.** Every code sample in this repo was run for real against Robinhood Chain (mainnet reads, or testnet where a funded wallet was available) before it was written down. A tutorial that wasn't performed doesn't belong here — see the honesty standard below.
+
+## The honesty standard this repo holds itself to
+
+- Every command shown was actually run; every output block is a real, unedited capture (or is explicitly labeled otherwise).
+- Where something couldn't be verified in the build environment — a testnet write blocked on the browser-gated faucet, an unverified factory ABI — the tutorial says so plainly, with the specific reason, rather than presenting untested code as proven.
+- If testing surfaces a real bug (Tutorial 8's payment-verification example did), the tutorial documents the bug and the fix, not just the fixed version — that's more useful than a tutorial that never shows what wrong looks like.
+
+## One-time GitHub Pages setup
+
+1. Push this repo to GitHub as `learn-robinhood-chain`.
+2. **Settings → Pages → Build and deployment → Source: "Deploy from a branch."**
+3. Branch: `main`, folder: `/docs`. Save.
+4. Live within a minute or two at `https://<your-username>.github.io/learn-robinhood-chain/`.
+
+No GitHub Actions workflow is used or required — `docs/` is a pre-built, committed artifact.
+
+## Related
+
+- **[hoodchain](https://github.com/nirholas/robinhood-chain-sdk)** — the TypeScript SDK every tutorial here is built on: Stock Tokens, Chainlink quotes, multiplier-correct portfolios, Uniswap v3 swaps, USDG, launchpad watchers, and the sequencer firehose.
+
+## License
+
+MIT © 2026 nirholas
+
+---
+
+Built by [nirholas](https://x.com/nichxbt) · [three.ws](https://three.ws)
diff --git a/robinhood/learn-robinhood-chain/content/10-autonomous-trading-agent.md b/robinhood/learn-robinhood-chain/content/10-autonomous-trading-agent.md
new file mode 100644
index 000000000..a461400d5
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/content/10-autonomous-trading-agent.md
@@ -0,0 +1,144 @@
+:::danger Read this section before the code
+An autonomous trading agent is software that spends money without asking you first, every time it runs. Every idea below is built with a **hard spend cap**, a **kill switch**, and **paper mode as the default** — not as afterthoughts, but as the first things written. If you take nothing else from this page: never remove the spend cap "just to test something real," and never run an agent with a live wallet key until you've watched it behave correctly in paper mode for longer than you think is necessary.
+
+This is not investment advice, and nothing here is a strategy anyone should expect to be profitable. It's a template for the *engineering* of an agent that spends — the risk controls transfer to any strategy you actually design.
+:::
+
+## Design the risk controls first
+
+Before a single line reads a price, decide three things:
+
+1. **Per-trade spend cap** — the maximum a single trade can move, regardless of what the strategy wants.
+2. **Period spend cap** — a rolling limit (daily is typical) that trips even if every individual trade was within its own cap.
+3. **Kill switch** — a way to stop the agent immediately and safely, mid-loop, without corrupting state.
+
+```ts
+const MAX_SPEND_USDG_PER_TRADE = 25 // hard ceiling per trade
+const DAILY_SPEND_CAP_USDG = 100 // hard ceiling per rolling day
+let spentToday = 0
+let running = true
+
+process.on('SIGINT', () => {
+ console.log('kill switch: SIGINT received, stopping after this tick')
+ running = false // finish the in-flight tick, then exit the loop — never abort mid-transaction
+})
+```
+
+Notice the kill switch doesn't `process.exit(0)` immediately. If the agent is mid-way through building a transaction when `SIGINT` fires, you want it to either finish that operation cleanly or not have started it — never leave a half-sent transaction or a corrupted spend counter. Setting a flag and checking it at loop boundaries is the safe pattern.
+
+## A minimal strategy: dip detection, paper mode
+
+This agent watches a basket of Stock Tokens, and on a mainnet dip beyond a threshold, logs what it *would* buy — respecting both spend caps — without ever building or sending a transaction:
+
+```ts
+import { createHoodClient, getQuote } from 'hoodchain'
+
+const hood = createHoodClient()
+const SYMBOLS = ['AAPL', 'TSLA', 'NVDA', 'SPY']
+const DIP_THRESHOLD_PCT = 0.5 // paper-buy if price drops >0.5% vs the last observed price
+
+const lastPrice = new Map<string, number>()
+
+async function tick() {
+ for (const symbol of SYMBOLS) {
+ const q = await getQuote(hood, symbol, { maxAgeSeconds: 7 * 24 * 60 * 60 })
+ const prev = lastPrice.get(symbol)
+ lastPrice.set(symbol, q.priceUsd)
+ if (prev === undefined) {
+ console.log(`[${symbol}] baseline $${q.priceUsd.toFixed(2)}`)
+ continue
+ }
+ const changePct = ((q.priceUsd - prev) / prev) * 100
+ if (changePct <= -DIP_THRESHOLD_PCT) {
+ if (spentToday + MAX_SPEND_USDG_PER_TRADE > DAILY_SPEND_CAP_USDG) {
+ console.log(`[${symbol}] dip ${changePct.toFixed(3)}% -- SKIPPED, daily cap reached`)
+ continue
+ }
+ spentToday += MAX_SPEND_USDG_PER_TRADE
+ console.log(`[${symbol}] dip ${changePct.toFixed(3)}% -- PAPER BUY $${MAX_SPEND_USDG_PER_TRADE} (spent today: $${spentToday}/$${DAILY_SPEND_CAP_USDG})`)
+ } else {
+ console.log(`[${symbol}] $${q.priceUsd.toFixed(2)} (${changePct >= 0 ? '+' : ''}${changePct.toFixed(3)}%) -- hold`)
+ }
+ }
+}
+
+console.log('paper-trading agent started -- Ctrl-C to stop (kill switch)')
+while (running) {
+ await tick()
+ console.log('---')
+ await new Promise((r) => setTimeout(r, 5000))
+}
+console.log('stopped cleanly.')
+```
+
+Run it against real mainnet quotes:
+
+```bash
+npx tsx agent.ts
+```
+
+A real, unedited capture from a 15-second run:
+
+```text
+paper-trading agent started -- Ctrl-C to stop (kill switch)
+[AAPL] baseline $315.50
+[TSLA] baseline $407.82
+[NVDA] baseline $210.19
+[SPY] baseline $753.62
+---
+[AAPL] $315.50 (+0.000%) -- hold
+[TSLA] $407.82 (+0.000%) -- hold
+[NVDA] $210.19 (+0.000%) -- hold
+[SPY] $753.62 (+0.000%) -- hold
+---
+[AAPL] $315.50 (+0.000%) -- hold
+[TSLA] $407.82 (+0.000%) -- hold
+[NVDA] $210.19 (+0.000%) -- hold
+[SPY] $753.62 (+0.000%) -- hold
+```
+
+Notice what this **doesn't** show: a fabricated trade. This capture ran over a weekend, when Chainlink stock feeds are closed (Tutorial 3) — the prices genuinely didn't move between ticks, so the agent correctly held every time. That's the right behavior, not a disappointing demo. **Never fake a trade to make a tutorial look more exciting than the real market was at the time you wrote it** — that habit is exactly how you end up trusting an agent's logs that lie to you.
+
+## Going from paper to real (the parts that change, and don't)
+
+When you're ready to let the agent actually spend, the strategy logic above is untouched. What changes is narrow and specific:
+
+```ts
+import { privateKeyToAccount } from 'viem/accounts'
+import { createHoodClient, executeSwap, parseUsdg, MAINNET_ADDRESSES } from 'hoodchain'
+
+const hood = createHoodClient({
+ account: privateKeyToAccount(process.env.ROBINHOOD_CHAIN_PRIVATE_KEY as `0x${string}`),
+ acknowledgeStockTokenEligibility: true, // only if you are actually eligible — see Tutorial 1
+})
+
+// replace the PAPER BUY console.log with:
+const { hash, receipt } = await executeSwap(hood, {
+ tokenIn: MAINNET_ADDRESSES.usdg,
+ tokenOut: token.address,
+ amountIn: parseUsdg(String(MAX_SPEND_USDG_PER_TRADE)),
+}, { slippageBps: 100 }) // wider slippage — an unattended agent can't react to a failed fill
+console.log(`REAL BUY ${symbol}: tx ${hash}, status ${receipt.status}`)
+```
+
+The spend caps, the kill switch, and the strategy decision are **identical code** — only the final action (`console.log` vs. `executeSwap`) changed. That's by design: if your paper-mode agent and your live agent share every line except the actual send, you can trust that what you watched in paper mode is what will happen live. If they're structurally different code paths, you're testing something you're not shipping.
+
+:::warning Start with an amount you'd be fine losing entirely
+Even with caps and a kill switch, a strategy can be wrong, a feed can behave unexpectedly, or a bug can exist in code you wrote an hour ago. `DAILY_SPEND_CAP_USDG = 100` is a ceiling, not a promise of safety. Fund the live wallet with exactly what you're prepared to lose, and nothing more, for at least the first several days of live operation.
+:::
+
+## Logging and observability
+
+An agent with no audit trail is an agent you can't debug after the fact. At minimum, persist (to a file or a database, not just stdout) every: quote observed, decision made and why, transaction sent with its hash, and cap-triggered skip. When something looks wrong three days from now, you want to reconstruct exactly what the agent saw and decided, not just what it did.
+
+## Troubleshooting
+
+**Agent never trades, even during a volatile market** — check `DIP_THRESHOLD_PCT` isn't set unreasonably high for the volatility of your basket, and confirm `getQuote` isn't throwing `StaleFeedError` silently (wrap the tick loop's body in a try/catch per symbol so one bad feed doesn't kill the whole tick).
+
+**Kill switch doesn't stop it** — confirm you're checking the `running` flag at the top of the `while` loop, not just setting it. A `SIGINT` handler that sets a flag nobody reads does nothing.
+
+**Daily cap never resets** — the example above never resets `spentToday`; add a check against a stored date and reset the counter on a new day, ideally persisted so a restart doesn't reset the cap early and let the agent double-spend the "daily" limit.
+
+## What you built
+
+A strategy loop with the risk controls built in from the first line, verified against a real (honestly reported, not fabricated) run — and the exact, minimal diff between its paper and live modes. Next: the other side of an autonomous agent's toolkit — creating things on-chain, not just trading them.
diff --git a/robinhood/learn-robinhood-chain/content/11-launch-a-coin.md b/robinhood/learn-robinhood-chain/content/11-launch-a-coin.md
new file mode 100644
index 000000000..70d1d1777
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/content/11-launch-a-coin.md
@@ -0,0 +1,72 @@
+Tutorial 7 taught you to *watch* NOXA and The Odyssey. This tutorial takes it one step further — a live launch monitor with fuller event decoding — and then gives you an honest account of what programmatic *launching* actually requires today, including a real gap this course found and didn't paper over.
+
+## A fuller launch monitor
+
+Extend the watcher from Tutorial 7 to decode every field each platform's events carry, so you can react to specific launch shapes rather than just "something launched":
+
+```ts
+import { createHoodClient, watchLaunches, watchCurveTrades, watchGraduations, formatUsdg } from 'hoodchain'
+import { formatEther } from 'viem'
+
+const hood = createHoodClient()
+
+watchLaunches(hood, (launch) => {
+ if (launch.launchpad === 'noxa') {
+ // NOXA: instant listing — trading starts immediately on the pool address
+ console.log(`NOXA launch: ${launch.token} by ${launch.creator}, pool ${launch.pool}`)
+ } else {
+ // Odyssey: opens on a bonding curve — no pool until it graduates
+ console.log(`Odyssey curve opened: ${launch.token} by ${launch.creator} (no pool yet)`)
+ }
+})
+
+// only meaningful for Odyssey — NOXA has no curve, it's a normal Uniswap v3 pool from block one
+watchCurveTrades(hood, (trade) => {
+ const dir = trade.isBuy ? 'BUY' : 'SELL'
+ console.log(`${dir} ${trade.token}: ${formatEther(trade.tokenAmount)} tokens for ${formatEther(trade.quoteAmount)} ETH`)
+})
+
+watchGraduations(hood, (g) => {
+ console.log(`GRADUATED: ${g.token} -> locked Uniswap v3 pool ${g.pool}`)
+})
+```
+
+This is exactly the decoding verified in Tutorial 7 against 21 real historical NOXA launches — extended here with curve-trade and graduation handling for Odyssey specifically. If you're building a trading bot or an alert system (Tutorial 16-style tooling), this is the complete event surface you'd hook into.
+
+## What "launch a coin programmatically" actually requires — and a real gap
+
+Watching launches only requires decoding **events**, which are public and don't need a verified ABI — you can decode a known event signature off any contract, verified or not. **Sending a transaction that creates a new launch is different**: it requires the factory contract's *write function* signature — argument names, types, and order — which you can only get reliably from a verified source contract, or by painstakingly reverse-engineering calldata from a real transaction.
+
+This course checked both launchpads' factory contracts against the Blockscout API before writing this page:
+
+```bash
+curl -s https://robinhoodchain.blockscout.com/api/v2/smart-contracts/0xD9eC2db5f3D1b236843925949fe5bd8a3836FCcB
+```
+
+Neither the NOXA launch factory (`0xD9eC2db5f3D1b236843925949fe5bd8a3836FCcB`) nor The Odyssey's bonding-curve factory (`0xEb3FeeD2716cF0eEAda05B22e67424794e1f5a80`) returns verified source through Blockscout's API — confirming what the [hoodchain SDK's own source comments](https://github.com/nirholas/robinhood-chain-sdk/blob/main/src/launchpads.ts) already note: *"neither publishes verified source on Blockscout."* That's why the SDK ships **event ABIs only** (for the read/watch path you used above) and no write-function ABI for either factory — extracting one would mean either reverse-engineering calldata from real launch transactions or asking the platforms directly, and doing that with unverified confidence long enough to publish it as "the" launch function would risk shipping guessed calldata that either fails or, worse, succeeds with the wrong parameters.
+
+:::warning We will not publish a guessed function signature
+It would be easy to fill this section with a plausible-looking `createToken(name, symbol, supply, ...)` call. It would also be irresponsible: an unverified guess at a factory's write interface, if wrong, can burn real gas on a failed transaction or — worse — succeed with parameters you didn't intend (wrong fee tier, wrong initial liquidity split, wrong lock terms). This course only ships code that was actually run and verified. For the launch-transaction write path specifically, that bar isn't met yet.
+:::
+
+## The responsible path today
+
+Until a launch factory's write ABI is verified from a primary source, the correct way to launch a token on NOXA or The Odyssey is through **the platform's own front-end** (fun.noxa.fi/robinhood, theodyssey.fun) — it already encodes the correct calldata, has been tested against the live contract by its own team, and gives you a UI to review exactly what you're about to deploy before you sign. That's not a cop-out; it's the same advice you'd give anyone about to send a transaction to a contract they don't have a verified interface for.
+
+If you want to pursue the programmatic path yourself: launch a token through the front-end **once**, on testnet, with a throwaway wallet, then pull the transaction's calldata from the explorer and decode it against the four-byte selector directory or by testing candidate ABIs against `eth_call` in simulation. That reverse-engineering work is exactly what standing up a verified, publishable write-ABI would require — and it's future work this course is flagging rather than rushing.
+
+## What a launch monitor *is* good for right now
+
+None of the above weakens the read side. A production-quality launch monitor — alerting, filtering by creator reputation, feeding a trading bot's universe of new tokens — is fully buildable today with the event decoding shown above and in Tutorial 7. That's most of what "reacting to launches" actually means in practice; only the "originate a new launch from my own code" half has the gap described here.
+
+## Troubleshooting
+
+**I found a write ABI for one of these factories elsewhere** — verify it against a real `eth_call` simulation before trusting it (Tutorial 6 covers `simulateContract`-style verification for swaps; the same discipline applies here). If it's a real, verified interface, it belongs in an update to the SDK's `launchpads.ts`, not a one-off script.
+
+**`watchCurveTrades` never fires for a NOXA token** — expected. NOXA has no bonding curve; its tokens trade as ordinary Uniswap v3 swaps from launch, which you'd track with `watchTransfers` (Tutorial 7) on the token itself, not curve events.
+
+**I want historical curve trade volume for a specific token** — use `client.public.getLogs` directly with `odysseyTradedEvent` and an `args: { token }` filter over a historical block range, following the pattern from `getRecentLaunches` in Tutorial 7.
+
+## What you built
+
+A launch monitor covering both platforms' full event surface, and — just as valuably — a documented, honest boundary around what's safely automatable today versus what still requires a human at the platform's own front-end. Knowing where that line is is worth more than a script that pretends it isn't there. Next: the capstone — taking everything you've built and actually shipping it.
diff --git a/robinhood/learn-robinhood-chain/content/12-ship-it.md b/robinhood/learn-robinhood-chain/content/12-ship-it.md
new file mode 100644
index 000000000..5ba9b7bdf
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/content/12-ship-it.md
@@ -0,0 +1,98 @@
+Everything in this course has been real, run code. This capstone is about the last mile: getting what you built in front of actual users, and the checklist to walk before you let it touch mainnet with real money.
+
+## Deploying a static app: GitHub Pages
+
+If what you built is client-side — a ticker, a portfolio dashboard, anything using only `hood.public` reads (Tutorials 2, 4, 5, 7) — it needs no backend at all. This very site is the reference example: it's a static build in `docs/`, deployed from a branch.
+
+**One-time setup:**
+
+1. Push your repo to GitHub.
+2. **Settings → Pages → Build and deployment → Source: "Deploy from a branch."**
+3. Branch: `main`, folder: `/docs`. Save.
+4. Your site is live at `https://<username>.github.io/<repo>/` within a minute or two.
+
+That's the entire deployment. No build step runs on GitHub's infrastructure — you commit the already-built `docs/` folder, exactly as this repo does. Re-deploying is `npm run build && git add docs && git commit && git push`.
+
+:::tip Why deploy-from-branch instead of a GitHub Actions build
+It's simpler, it's faster (no CI queue), and it means what's live is *exactly* what you built and tested locally — no environment drift between your machine and a CI runner. The tradeoff is you must remember to run the build before committing; a pre-commit hook or a habit covers that.
+:::
+
+### RPC calls from a static site
+
+A pure static deploy still makes real, live RPC calls — straight from the visitor's browser to `rpc.mainnet.chain.robinhood.com`, exactly like this site's [live chain-stats strip](../) does. That's the whole trick behind "the landing page can show live data on GitHub Pages": public reads need no server. The only thing you can't do from a static site is anything requiring a private key or server-side secret — which brings us to Cloud Run.
+
+## Deploying a server: Google Cloud Run
+
+The moment your app needs a wallet key (an agent, Tutorial 10), verifies payments server-side (the x402 API, Tutorial 8), or holds any other secret, it needs a real backend. Google Cloud Run is a strong default: pay-per-request, scales to zero, and a straightforward `Dockerfile` gets you there.
+
+```dockerfile
+FROM node:20-slim
+WORKDIR /app
+COPY package*.json ./
+RUN npm ci --omit=dev
+COPY . .
+ENV PORT=8080
+EXPOSE 8080
+CMD ["node", "server.mjs"]
+```
+
+Two things Cloud Run requires that are easy to miss the first time:
+
+- **Listen on `process.env.PORT`**, not a hardcoded port. Cloud Run injects `PORT` (usually `8080`) and routes traffic there — a hardcoded `3000` will silently fail health checks.
+- **Bind to `0.0.0.0`, not `localhost`.** `app.listen(port)` defaults to all interfaces in Express and is fine; some frameworks default to loopback-only, which Cloud Run can't reach.
+
+Deploy:
+
+```bash
+gcloud run deploy my-robinhood-app \
+ --source . \
+ --region us-central1 \
+ --allow-unauthenticated \
+ --set-env-vars PAYOUT_ADDRESS=0xYourAddress
+```
+
+**Never bake a private key into the container image or set it with `--set-env-vars` in a command you'll paste into a README.** Use `gcloud run services update --update-secrets` backed by Secret Manager, or your platform's equivalent secret store — the difference between an env var and a secret-manager binding is the difference between a key that leaks the moment someone reads your shell history and one that doesn't.
+
+## An alternative: Vercel
+
+If your app is a standard Next.js/Vite frontend with lightweight serverless API routes, Vercel remains a fine choice for the same static-plus-functions shape — deploy with `vercel --prod` after `vercel link`. Prefer Cloud Run specifically once you have a long-running process (an always-on trading agent, a WebSocket firehose consumer) — Vercel's serverless functions are request-scoped and will terminate a background loop between invocations.
+
+## The going-mainnet checklist
+
+Everything below was demonstrated somewhere in this course. This is the assembled version — walk it in order before flipping any switch that spends real money.
+
+### Funding
+- [ ] The wallet holds **only** what you're prepared to lose during the first live days (Tutorial 10) — not your full intended capital.
+- [ ] You've verified the wallet's mainnet ETH balance covers gas for your expected transaction volume; Robinhood Chain's ~100ms blocks mean a busy agent can rack up transaction count fast.
+
+### Keys
+- [ ] The private key lives in a secret manager or env var injected at runtime — never in source, never in a Docker image layer, never in a README example with a real value (Tutorial 6, 10, 12).
+- [ ] `.env` and any key file are in `.gitignore`, and you've confirmed with `git status` that nothing sensitive is staged before your first push.
+
+### Spend caps
+- [ ] Per-transaction and per-period spend caps are enforced in code, not just "the strategy wouldn't do that" (Tutorial 10) — assume the strategy has a bug.
+- [ ] A kill switch exists, is tested, and stops the process **between** operations rather than mid-transaction (Tutorial 10).
+
+### Compliance
+- [ ] Any flow that can acquire a Stock Token has the eligibility gate active by default, and `acknowledgeStockTokenEligibility: true` is set only after genuine confirmation of operator eligibility — never flipped on reflexively to silence an error (Tutorial 1, 6).
+- [ ] Untrusted on-chain data (token names, memos, launch metadata) is escaped before rendering and never interpreted as an instruction to an agent or LLM (Tutorial 1, 11).
+
+### Correctness
+- [ ] Portfolio and pricing code follows the multiplier rule exactly — value is `balance × feed price`, never `balance × multiplier × feed price` (Tutorial 3, 5).
+- [ ] Staleness windows account for the 24/5 market schedule; a tight window won't falsely flag every weekend read as broken (Tutorial 3, 4).
+- [ ] Payment or transaction verification decodes actual event arguments (recipient, amount) rather than checking "a log exists" — Tutorial 8 documents a real bug of exactly this shape that was caught and fixed while writing this course.
+
+### Infrastructure
+- [ ] You're on a dedicated RPC (Alchemy or equivalent) for anything beyond light, occasional reads — the public RPC rate-limits wide scans (Tutorial 2, 7) and a production agent hitting `429`s is a production agent silently missing data.
+- [ ] Logs capture every decision an autonomous component makes, with enough detail to reconstruct "why did it do that" after the fact (Tutorial 10).
+- [ ] Secrets are in a secret manager, not env vars set from a shell command that lands in history or CI logs.
+
+### Monitoring
+- [ ] You have a way to know the agent/service is still running — a heartbeat, a health check endpoint, or an external uptime check — not just "I'll notice if it stops."
+- [ ] Failed transactions and thrown errors are surfaced somewhere you'll actually see them (a log aggregator, an alert), not just printed to a terminal that isn't open.
+
+## Where to go from here
+
+You've built, in order: a correct mental model, a first read, the multiplier rule, a live ticker, a portfolio tracker, a working swap, two live streams, a paid API (with a real bug caught and fixed), a working MCP server, a risk-controlled paper-trading agent, and an honest account of the launch-write gap. That's the full stack of a serious Robinhood Chain application. The [hoodchain SDK](https://github.com/nirholas/robinhood-chain-sdk) that powered all of it is open source — read its source when you need to go deeper than any tutorial here, and consider contributing back (the launch-ABI gap from Tutorial 11 is a real, well-scoped next PR for someone with more time to reverse-engineer it responsibly).
+
+Build something worth screenshotting.
diff --git a/robinhood/learn-robinhood-chain/docs/.nojekyll b/robinhood/learn-robinhood-chain/docs/.nojekyll
new file mode 100644
index 000000000..e69de29bb
diff --git a/robinhood/learn-robinhood-chain/docs/01-what-is-robinhood-chain/index.html b/robinhood/learn-robinhood-chain/docs/01-what-is-robinhood-chain/index.html
new file mode 100644
index 000000000..a4c528d6b
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/01-what-is-robinhood-chain/index.html
@@ -0,0 +1,181 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>What Robinhood Chain actually is · Learn Robinhood Chain</title>
+<meta name="description" content="Architecture, chain IDs, and what's real vs hype — the no-token fact, the US-person restriction, and permissionless deployment, all sourced.">
+<meta property="og:title" content="What Robinhood Chain actually is · Learn Robinhood Chain">
+<meta property="og:description" content="Architecture, chain IDs, and what's real vs hype — the no-token fact, the US-person restriction, and permissionless deployment, all sourced.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/" class="active" aria-current="page"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="01-what-is-robinhood-chain">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Foundations</span></nav>
+ <header class="doc-header">
+ <h1>What Robinhood Chain actually is</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">10 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">6 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A correct mental model of the chain: what it is, what it is <em>not</em>, and the two facts that trip up every newcomer.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li>Curiosity. No wallet or code yet.</li></ul></aside>
+ <div class="doc-body"><p>Robinhood Chain launched its mainnet on July 1, 2026. In the weeks since, the amount of confident, wrong information written about it has been remarkable. This page is the antidote: the architecture, the chain IDs, and — more importantly — the three facts that every newcomer gets backwards.</p>
+<p>Everything here is sourced. Where a claim matters, it links to the <a href="https://docs.robinhood.com/chain/" target="_blank" rel="noopener noreferrer">official docs</a> or to something you can verify on-chain yourself in the next tutorial.</p>
+<h2 id="the-one-paragraph-version"><a class="anchor" href="#the-one-paragraph-version" aria-label="Link to this section">#</a>The one-paragraph version</h2><p>Robinhood Chain is a <strong>permissionless <a href="https://docs.arbitrum.io/launch-orbit-chain/orbit-gentle-introduction" target="_blank" rel="noopener noreferrer">Arbitrum Orbit</a> Layer 2</strong> that settles to Ethereum, posts its data as blobs, and pays gas in <strong>ETH</strong>. Blocks land in roughly 100 milliseconds. It supports <a href="https://eips.ethereum.org/EIPS/eip-4337" target="_blank" rel="noopener noreferrer">ERC-4337</a> account abstraction. Its headline feature is ~95 <strong>Stock Tokens</strong> — tokenized US equities, each a plain ERC-20 with a Chainlink price feed — plus <strong>USDG</strong>, a dollar stablecoin. That&#39;s the whole chain in one breath. The rest of this page is the fine print, and the fine print is where the money and the mistakes are.</p>
+<h2 id="architecture-precisely"><a class="anchor" href="#architecture-precisely" aria-label="Link to this section">#</a>Architecture, precisely</h2><table>
+<thead>
+<tr>
+<th>Property</th>
+<th>Value</th>
+</tr>
+</thead>
+<tbody><tr>
+<td>Type</td>
+<td>Arbitrum Orbit L2 (Nitro stack)</td>
+</tr>
+<tr>
+<td>Settlement</td>
+<td>Ethereum mainnet</td>
+</tr>
+<tr>
+<td>Data availability</td>
+<td>Blobs (EIP-4844)</td>
+</tr>
+<tr>
+<td>Gas token</td>
+<td><strong>ETH</strong> (not a chain-native token)</td>
+</tr>
+<tr>
+<td>Block time</td>
+<td>~100 ms</td>
+</tr>
+<tr>
+<td>Account abstraction</td>
+<td>ERC-4337 supported</td>
+</tr>
+<tr>
+<td>Multicall3</td>
+<td><code>0xca11bde05977b3631167028862be2a173976ca11</code> (canonical)</td>
+</tr>
+</tbody></table>
+<p>Because it&#39;s a standard Nitro Orbit chain, <strong>your existing Ethereum tooling just works</strong> — viem, ethers, wagmi, Foundry, Hardhat. There is no exotic SDK you&#39;re forced to adopt, no bespoke RPC dialect. That is the single most important practical fact for a developer, and it&#39;s why the rest of this course is mostly &quot;normal EVM development, applied well.&quot;</p>
+<h3 id="the-two-networks"><a class="anchor" href="#the-two-networks" aria-label="Link to this section">#</a>The two networks</h3><p>You will use both. Reads and demos happen on mainnet; anything that writes, you rehearse on testnet first.</p>
+<table>
+<thead>
+<tr>
+<th></th>
+<th>Mainnet</th>
+<th>Testnet</th>
+</tr>
+</thead>
+<tbody><tr>
+<td>Chain ID</td>
+<td><strong>4663</strong></td>
+<td><strong>46630</strong></td>
+</tr>
+<tr>
+<td>RPC</td>
+<td><code>https://rpc.mainnet.chain.robinhood.com</code></td>
+<td><code>https://rpc.testnet.chain.robinhood.com</code></td>
+</tr>
+<tr>
+<td>Explorer</td>
+<td><a href="https://robinhoodchain.blockscout.com" target="_blank" rel="noopener noreferrer">robinhoodchain.blockscout.com</a></td>
+<td><a href="https://explorer.testnet.chain.robinhood.com" target="_blank" rel="noopener noreferrer">explorer.testnet.chain.robinhood.com</a></td>
+</tr>
+<tr>
+<td>Sequencer feed</td>
+<td><code>wss://feed.mainnet.chain.robinhood.com</code></td>
+<td>—</td>
+</tr>
+<tr>
+<td>Faucet</td>
+<td>—</td>
+<td><a href="https://faucet.testnet.chain.robinhood.com/" target="_blank" rel="noopener noreferrer">faucet.testnet.chain.robinhood.com</a></td>
+</tr>
+</tbody></table>
+<div class="callout callout-tip"><p class="callout-title">viem ships the chain definitions</p><p>As of <code>[email protected]</code>, both networks are built in: <code>import { robinhood, robinhoodTestnet } from &#39;viem/chains&#39;</code>. <strong>Never hand-roll the chain config</strong> — you&#39;ll get the multicall address or the block explorer wrong and spend an afternoon debugging it. Let viem do it.</p>
+</div>
+
+<h2 id="the-three-facts-everyone-gets-wrong"><a class="anchor" href="#the-three-facts-everyone-gets-wrong" aria-label="Link to this section">#</a>The three facts everyone gets wrong</h2><h3 id="1-there-is-no-chain-token-gas-is-eth"><a class="anchor" href="#1-there-is-no-chain-token-gas-is-eth" aria-label="Link to this section">#</a>1. There is no chain token. Gas is ETH.</h3><p>Search social media and you&#39;ll find people trading &quot;the Robinhood Chain token,&quot; quoting its price, and posting its contract address. <strong>It does not exist.</strong> Robinhood Chain pays gas in bridged ETH, exactly like Arbitrum One or Base. There is no native gas token and no official chain coin.</p>
+<p>Anyone showing you a &quot;$HOOD chain token&quot; contract is showing you a memecoin someone permissionlessly deployed <em>on</em> the chain — which is allowed and common (see Tutorial 7) — not a token <em>of</em> the chain. Internalize this now; it will save you from a scam later.</p>
+<h3 id="2-stock-tokens-may-not-be-sold-to-us-persons"><a class="anchor" href="#2-stock-tokens-may-not-be-sold-to-us-persons" aria-label="Link to this section">#</a>2. Stock Tokens may not be sold to US persons.</h3><p>This is the fact with legal teeth. Stock Tokens are <strong>tokenized debt securities</strong>, issued by <em>Robinhood Assets (Jersey) Ltd</em>. They <strong>may not be offered, sold, or delivered to US persons</strong>, with additional restrictions for Canada, the UK, and Switzerland.</p>
+<p>The critical nuance for developers:</p>
+<ul>
+<li><strong>The restriction is legal and front-end enforced — not enforced at the contract level.</strong> The ERC-20 contracts will happily transfer to anyone. Compliance is your responsibility as the operator of any interface or agent.</li>
+<li><strong>Reading and displaying Stock Token data is unrestricted.</strong> Prices, supply, someone&#39;s holdings — all fair game. Most of this course is reads, and none of it is gated.</li>
+<li><strong>Any flow that <em>acquires</em> a Stock Token needs an eligibility gate.</strong> A buy button, a swap that outputs a Stock Token, an agent that accumulates one — those require a clear disclosure and a geo/eligibility gate, defaulting to <em>off</em>.</li>
+</ul>
+<p>You&#39;ll see this enforced in code in Tutorial 6: the <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain</a> SDK throws a <code>StockTokenEligibilityError</code> on any swap that acquires a Stock Token until the operator explicitly affirms eligibility. That default-closed posture is the pattern to copy.</p>
+<div class="callout callout-warning"><p class="callout-title">Not financial or legal advice</p><p>This is educational material about a blockchain&#39;s mechanics. It is not investment advice, and it is not legal advice about your eligibility. If you operate an interface, get real counsel on your obligations.</p>
+</div>
+
+<h3 id="3-anyone-can-deploy-the-chain-is-permissionless"><a class="anchor" href="#3-anyone-can-deploy-the-chain-is-permissionless" aria-label="Link to this section">#</a>3. Anyone can deploy. The chain is permissionless.</h3><p>Robinhood issues the Stock Tokens and runs the sequencer, but the chain itself is open. Anyone can deploy a contract, launch a memecoin, or stand up a DEX pool — and people have. There are already two memecoin launchpads (NOXA and The Odyssey), the full Uniswap v3 stack, 1inch, a zero-fee stock DEX (Arcus), a perps venue (Lighter), and Morpho for lending.</p>
+<p>This is why &quot;what&#39;s on Robinhood Chain&quot; is a moving target and why on-chain data — token names, memos, listing text — is <strong>untrusted input</strong>. Treat it exactly like user input from the open internet: never render it without escaping, and never let it drive a spend. Tutorial 7 shows you how to read this firehose safely.</p>
+<h2 id="what39s-actually-live"><a class="anchor" href="#what39s-actually-live" aria-label="Link to this section">#</a>What&#39;s actually live</h2><p>A quick, non-exhaustive map so you know the terrain:</p>
+<ul>
+<li><strong>Assets</strong> — ~95 Stock Tokens (ERC-20, 18 decimals, one Chainlink feed each) and <strong>USDG</strong> (Paxos Global Dollar, <strong>6 decimals</strong>, no EIP-2612 permit).</li>
+<li><strong>DEXes / DeFi</strong> — Uniswap v2/v3/v4 + UniswapX (the primary public liquidity), 1inch, Arcus (zero-fee stock DEX), Lighter (perps), Morpho (lending).</li>
+<li><strong>Launchpads</strong> — NOXA (&quot;NOXA Fun&quot;) and The Odyssey, both pump.fun-style, graduating liquidity to Uniswap v3.</li>
+<li><strong>Data providers</strong> — DefiLlama (<code>/chain/robinhood-chain</code>), CoinGecko, GeckoTerminal, Dune, Goldsky, and the Blockscout Pro API already index the chain.</li>
+</ul>
+<h2 id="where-to-get-canonical-addresses"><a class="anchor" href="#where-to-get-canonical-addresses" aria-label="Link to this section">#</a>Where to get canonical addresses</h2><p>When you need a verified contract address — a Stock Token, USDG, a router — there is exactly one right source order:</p>
+<ol>
+<li><strong><a href="https://docs.robinhood.com/chain/contracts" target="_blank" rel="noopener noreferrer">docs.robinhood.com/chain/contracts</a></strong> — the official registry for Stock Token and USDG addresses.</li>
+<li><strong>Verify it resolves on Blockscout</strong> before you ship it. An address in a blog post (including this one) is a lead, not a source of truth.</li>
+</ol>
+<p>The <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain SDK</a> does this work for you: it ships a checked-in registry of all 95 Stock Tokens, each verified on-chain against the shared <code>Stock</code> beacon and mapped to its Chainlink feed, regenerable with one command. You&#39;ll use it from Tutorial 2 onward so you never hand-type an address.</p>
+<h2 id="you-now-know-more-than-most"><a class="anchor" href="#you-now-know-more-than-most" aria-label="Link to this section">#</a>You now know more than most</h2><p>You understand the architecture, both chain IDs, the no-token fact, the US-person restriction, and that the chain is permissionless and its on-chain data untrusted. That&#39;s the mental model. Next, you&#39;ll prove the architecture is real by reading the live chain yourself — in about five minutes.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><span></span><a class="pager pager-next" href="../02-connect-and-read/"><span class="pager-dir">Next →</span><span class="pager-title">Connect and read the chain in 5 minutes</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#the-one-paragraph-version">The one-paragraph version</a></li><li class="toc-l2"><a href="#architecture-precisely">Architecture, precisely</a></li><li class="toc-l3"><a href="#the-two-networks">The two networks</a></li><li class="toc-l2"><a href="#the-three-facts-everyone-gets-wrong">The three facts everyone gets wrong</a></li><li class="toc-l3"><a href="#1-there-is-no-chain-token-gas-is-eth">1. There is no chain token. Gas is ETH.</a></li><li class="toc-l3"><a href="#2-stock-tokens-may-not-be-sold-to-us-persons">2. Stock Tokens may not be sold to US persons.</a></li><li class="toc-l3"><a href="#3-anyone-can-deploy-the-chain-is-permissionless">3. Anyone can deploy. The chain is permissionless.</a></li><li class="toc-l2"><a href="#what39s-actually-live">What&amp;#39;s actually live</a></li><li class="toc-l2"><a href="#where-to-get-canonical-addresses">Where to get canonical addresses</a></li><li class="toc-l2"><a href="#you-now-know-more-than-most">You now know more than most</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/02-connect-and-read/index.html b/robinhood/learn-robinhood-chain/docs/02-connect-and-read/index.html
new file mode 100644
index 000000000..0e66a8bdc
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/02-connect-and-read/index.html
@@ -0,0 +1,130 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Connect and read the chain in 5 minutes · Learn Robinhood Chain</title>
+<meta name="description" content="Add the network to a wallet, get testnet funds, and make your first read against mainnet with viem — a real block number and gas price in your terminal.">
+<meta property="og:title" content="Connect and read the chain in 5 minutes · Learn Robinhood Chain">
+<meta property="og:description" content="Add the network to a wallet, get testnet funds, and make your first read against mainnet with viem — a real block number and gas price in your terminal.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/" class="active" aria-current="page"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="02-connect-and-read">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Foundations</span></nav>
+ <header class="doc-header">
+ <h1>Connect and read the chain in 5 minutes</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">5 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">4 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A tiny script that connects to Robinhood Chain and prints the live block height, chain ID, and gas price.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="https://nodejs.org" target="_blank" rel="noopener noreferrer">Node.js</a> ≥ 20 and a terminal</li><li>Any code editor</li></ul></aside>
+ <div class="doc-body"><p>Talk is cheap. In the next five minutes you&#39;ll connect to Robinhood Chain and pull real data off it — the current block height, the chain ID, and the gas price — with about fifteen lines of code. No wallet, no funds, no signup. Reads are free and public.</p>
+<h2 id="add-the-network-to-a-wallet-optional-60-seconds"><a class="anchor" href="#add-the-network-to-a-wallet-optional-60-seconds" aria-label="Link to this section">#</a>Add the network to a wallet (optional, 60 seconds)</h2><p>You don&#39;t need a wallet for reads, but if you want to poke around a block explorer with a browser wallet, add the network manually. In MetaMask: <strong>Settings → Networks → Add network → Add manually</strong>, then:</p>
+<figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">Network name: Robinhood Chain
+RPC URL: https://rpc.mainnet.chain.robinhood.com
+Chain ID: 4663
+Currency symbol: ETH
+Block explorer: https://robinhoodchain.blockscout.com</code></pre></figure><p>For anything that spends, use <strong>testnet</strong> (chain ID <code>46630</code>, RPC <code>https://rpc.testnet.chain.robinhood.com</code>) and claim funds from the <a href="https://faucet.testnet.chain.robinhood.com/" target="_blank" rel="noopener noreferrer">faucet</a> first.</p>
+<div class="callout callout-warning"><p class="callout-title">The faucet needs a real browser</p><p>The testnet faucet is behind Cloudflare Turnstile and Google Sign-In — it can&#39;t be scripted. It drips 0.01 ETH plus five of each test Stock Token (TSLA, AMZN, PLTR, NFLX, AMD) per 24 hours. Claim once, up front, and reuse that wallet for every write tutorial. There&#39;s also a <a href="https://faucets.chain.link/robinhood-testnet" target="_blank" rel="noopener noreferrer">Chainlink faucet</a> for testnet LINK/ETH.</p>
+</div>
+
+<h2 id="read-the-chain-with-raw-json-rpc-zero-dependencies"><a class="anchor" href="#read-the-chain-with-raw-json-rpc-zero-dependencies" aria-label="Link to this section">#</a>Read the chain with raw JSON-RPC (zero dependencies)</h2><p>Before any library, prove the RPC is real with nothing but <code>curl</code>. This asks the node for its chain ID:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">curl -s https://rpc.mainnet.chain.robinhood.com \
+ -H <span class="hljs-string">&#x27;content-type: application/json&#x27;</span> \
+ -d <span class="hljs-string">&#x27;{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:1,&quot;method&quot;:&quot;eth_chainId&quot;,&quot;params&quot;:[]}&#x27;</span></code></pre></figure><figure class="code-block" data-lang="JSON"><figcaption><span class="code-lang">JSON</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-json"><span class="hljs-punctuation">{</span><span class="hljs-attr">&quot;jsonrpc&quot;</span><span class="hljs-punctuation">:</span><span class="hljs-string">&quot;2.0&quot;</span><span class="hljs-punctuation">,</span><span class="hljs-attr">&quot;id&quot;</span><span class="hljs-punctuation">:</span><span class="hljs-number">1</span><span class="hljs-punctuation">,</span><span class="hljs-attr">&quot;result&quot;</span><span class="hljs-punctuation">:</span><span class="hljs-string">&quot;0x1237&quot;</span><span class="hljs-punctuation">}</span></code></pre></figure><p><code>0x1237</code> is <code>4663</code> in decimal — the mainnet chain ID. The chain is answering. That&#39;s the entire foundation of everything that follows.</p>
+<div class="callout callout-tip"><p class="callout-title">You just saw the landing page's secret</p><p>The live stats strip on this site&#39;s <a href="../">home page</a> is doing exactly this — plain <code>fetch</code> calls to that same RPC from your browser. Read-only chain access needs no backend, no key, and no SDK. That property is why so much of this course runs client-side.</p>
+</div>
+
+<h2 id="read-the-chain-with-viem"><a class="anchor" href="#read-the-chain-with-viem" aria-label="Link to this section">#</a>Read the chain with viem</h2><p><code>curl</code> is fine for a sanity check; for real work you want typed results and helpers. Install viem:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">npm init -y
+npm install viem
+npm pkg <span class="hljs-built_in">set</span> <span class="hljs-built_in">type</span>=module</code></pre></figure><p>Create <code>read.ts</code> (or <code>.mjs</code>) and paste:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createPublicClient, http, formatGwei } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem&#x27;</span>
+<span class="hljs-keyword">import</span> { robinhood } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem/chains&#x27;</span>
+
+<span class="hljs-keyword">const</span> client = <span class="hljs-title function_">createPublicClient</span>({
+ <span class="hljs-attr">chain</span>: robinhood, <span class="hljs-comment">// viem&#x27;s official chain def — chain ID 4663</span>
+ <span class="hljs-attr">transport</span>: <span class="hljs-title function_">http</span>(), <span class="hljs-comment">// uses the public RPC from the chain def</span>
+})
+
+<span class="hljs-keyword">const</span> [blockNumber, gasPrice, chainId] = <span class="hljs-keyword">await</span> <span class="hljs-title class_">Promise</span>.<span class="hljs-title function_">all</span>([
+ client.<span class="hljs-title function_">getBlockNumber</span>(),
+ client.<span class="hljs-title function_">getGasPrice</span>(),
+ client.<span class="hljs-title function_">getChainId</span>(),
+])
+
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`chain id <span class="hljs-subst">${chainId}</span>`</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`block height <span class="hljs-subst">${blockNumber}</span>`</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`gas price <span class="hljs-subst">${formatGwei(gasPrice)}</span> gwei`</span>)</code></pre></figure><p>Run it:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">npx tsx read.ts</code></pre></figure><figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">chain id 4663
+block height 7727411
+gas price 0.01 gwei</code></pre></figure><p>That block number was live when this tutorial was written; yours will be higher, because Robinhood Chain produces a new block roughly every 100 milliseconds. Do the math: <strong>that&#39;s on the order of half a million blocks a day.</strong> Keep it in mind when you scan historical logs later — &quot;the last hour&quot; is tens of thousands of blocks.</p>
+<h2 id="use-a-faster-rpc-when-the-public-one-isn39t-enough"><a class="anchor" href="#use-a-faster-rpc-when-the-public-one-isn39t-enough" aria-label="Link to this section">#</a>Use a faster RPC (when the public one isn&#39;t enough)</h2><p>The public RPC is perfect for learning and light apps, but it rate-limits. The moment you&#39;re scanning large block ranges or serving users, move to a dedicated endpoint. Alchemy is the recommended provider:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">const</span> client = <span class="hljs-title function_">createPublicClient</span>({
+ <span class="hljs-attr">chain</span>: robinhood,
+ <span class="hljs-attr">transport</span>: <span class="hljs-title function_">http</span>(<span class="hljs-string">`https://robinhood-mainnet.g.alchemy.com/v2/<span class="hljs-subst">${process.env.ALCHEMY_KEY}</span>`</span>),
+})</code></pre></figure><p>You&#39;ll feel the difference immediately in Tutorial 7 when scanning launchpad history — the public RPC will return <code>429 Too Many Requests</code> on a wide scan; a dedicated key won&#39;t.</p>
+<h2 id="skip-the-boilerplate-the-hoodchain-client"><a class="anchor" href="#skip-the-boilerplate-the-hoodchain-client" aria-label="Link to this section">#</a>Skip the boilerplate: the hoodchain client</h2><p>Everything above is standard viem. As your app grows you&#39;ll want the batteries-included client from the <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain SDK</a> — it wraps viem with multicall batching on by default, both networks pre-wired, and an optional wallet:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">npm install hoodchain viem</code></pre></figure><figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>() <span class="hljs-comment">// mainnet 4663, public RPC, multicall batching on</span>
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;block&#x27;</span>, <span class="hljs-keyword">await</span> hood.<span class="hljs-property">public</span>.<span class="hljs-title function_">getBlockNumber</span>())</code></pre></figure><p><code>hood.public</code> is a normal viem <code>PublicClient</code>, so nothing you learned is wasted — the SDK just removes the setup. From the next tutorial on, we use <code>createHoodClient</code> because it also knows about Stock Tokens, feeds, and swaps, which raw viem does not. When you need to drop to the metal, <code>hood.public</code> and <code>hood.wallet</code> are right there.</p>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong><code>Cannot use import statement outside a module</code></strong> — add <code>&quot;type&quot;: &quot;module&quot;</code> to your <code>package.json</code> (<code>npm pkg set type=module</code>), or use the <code>.mjs</code> extension.</p>
+<p><strong><code>fetch failed</code> / <code>ECONNREFUSED</code></strong> — check the RPC URL for a typo; it&#39;s <code>rpc.mainnet.chain.robinhood.com</code>, no port, HTTPS. Confirm you have network access with the <code>curl</code> command above.</p>
+<p><strong><code>npx tsx</code> is slow the first time</strong> — <code>tsx</code> is being downloaded. Install it once (<code>npm i -D tsx</code>) to make subsequent runs instant.</p>
+<p><strong>The block number looks <em>huge</em> / grows while you watch</strong> — that&#39;s correct. ~100 ms blocks. It&#39;s a feature, not a bug.</p>
+<h2 id="what-you-learned"><a class="anchor" href="#what-you-learned" aria-label="Link to this section">#</a>What you learned</h2><p>You connected to Robinhood Chain three ways — raw <code>curl</code>, plain viem, and the hoodchain client — and read live data with each. You know reads are free and keyless, why block numbers are enormous, and when to upgrade off the public RPC. Next, the one concept that makes Stock Tokens different from every other ERC-20 you&#39;ve touched.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../01-what-is-robinhood-chain/"><span class="pager-dir">← Previous</span><span class="pager-title">What Robinhood Chain actually is</span></a><a class="pager pager-next" href="../03-stock-tokens-explained/"><span class="pager-dir">Next →</span><span class="pager-title">Stock Tokens explained for developers</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#add-the-network-to-a-wallet-optional-60-seconds">Add the network to a wallet (optional, 60 seconds)</a></li><li class="toc-l2"><a href="#read-the-chain-with-raw-json-rpc-zero-dependencies">Read the chain with raw JSON-RPC (zero dependencies)</a></li><li class="toc-l2"><a href="#read-the-chain-with-viem">Read the chain with viem</a></li><li class="toc-l2"><a href="#use-a-faster-rpc-when-the-public-one-isn39t-enough">Use a faster RPC (when the public one isn&amp;#39;t enough)</a></li><li class="toc-l2"><a href="#skip-the-boilerplate-the-hoodchain-client">Skip the boilerplate: the hoodchain client</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-learned">What you learned</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/03-stock-tokens-explained/index.html b/robinhood/learn-robinhood-chain/docs/03-stock-tokens-explained/index.html
new file mode 100644
index 000000000..1352ced92
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/03-stock-tokens-explained/index.html
@@ -0,0 +1,141 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Stock Tokens explained for developers · Learn Robinhood Chain</title>
+<meta name="description" content="ERC-20 + a Chainlink feed + ERC-8056 uiMultiplier(). The split/dividend trap, with a worked example showing the wrong and the right valuation.">
+<meta property="og:title" content="Stock Tokens explained for developers · Learn Robinhood Chain">
+<meta property="og:description" content="ERC-20 + a Chainlink feed + ERC-8056 uiMultiplier(). The split/dividend trap, with a worked example showing the wrong and the right valuation.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/" class="active" aria-current="page"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="03-stock-tokens-explained">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Foundations</span></nav>
+ <header class="doc-header">
+ <h1>Stock Tokens explained for developers</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">12 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">6 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>The one piece of domain knowledge that separates a correct Robinhood Chain app from a subtly broken one.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../02-connect-and-read/">Tutorial 2</a> — you can read the chain</li><li>Comfort with <code>bigint</code> in JavaScript</li></ul></aside>
+ <div class="doc-body"><p>If you remember one page from this course, make it this one. Stock Tokens look like ordinary ERC-20s, and 95% of the time they behave like ordinary ERC-20s. It&#39;s the other 5% — corporate actions like splits and dividends — that quietly breaks naive integrations and reports the wrong dollar value to a user. Here&#39;s exactly how they work, and the one worked example that makes the trap impossible to fall into.</p>
+<h2 id="anatomy-of-a-stock-token"><a class="anchor" href="#anatomy-of-a-stock-token" aria-label="Link to this section">#</a>Anatomy of a Stock Token</h2><p>A canonical Stock Token on Robinhood Chain is three things bolted together:</p>
+<ol>
+<li><strong>A plain ERC-20</strong>, 18 decimals. <code>balanceOf</code>, <code>transfer</code>, <code>approve</code> — all the usual methods, nothing surprising.</li>
+<li><strong>A Chainlink price feed</strong> — a separate contract, one per token, exposing <code>latestRoundData()</code> and answering with an <strong>8-decimal</strong> USD price.</li>
+<li><strong>An <a href="https://eips.ethereum.org/" target="_blank" rel="noopener noreferrer">ERC-8056</a> <code>uiMultiplier()</code></strong> — a single function returning a <code>1e18</code>-scaled ratio that encodes every corporate action the underlying stock has had.</li>
+</ol>
+<p>Every canonical Stock Token proxies to one shared <code>Stock</code> beacon contract, which is how the <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain SDK</a> verifies that an address is a <em>real</em> Stock Token and not a lookalike: it checks the EIP-1967 beacon slot points at that one shared beacon.</p>
+<h2 id="the-multiplier-and-why-it-exists"><a class="anchor" href="#the-multiplier-and-why-it-exists" aria-label="Link to this section">#</a>The multiplier, and why it exists</h2><p>Stocks split. They pay dividends. A traditional token would handle a 2-for-1 split by <em>rebasing</em> — doubling everyone&#39;s balance overnight. Rebasing tokens are notoriously hostile to integrators: your cached balances silently go wrong, and every DeFi protocol that holds the token has to special-case it.</p>
+<p>Robinhood Chain took the other path. <strong>Balances never change from corporate actions.</strong> Instead, <code>uiMultiplier()</code> moves. It&#39;s the shares-per-token ratio, scaled by <code>1e18</code>:</p>
+<ul>
+<li><code>1000000000000000000</code> (i.e. <code>1e18</code>) → 1 token represents 1 share. This is the starting state for every token.</li>
+<li>After a reinvested dividend or a split adjustment, it rises above <code>1e18</code>. Your token balance is unchanged; each token now represents <em>more than one share</em> of economic exposure.</li>
+</ul>
+<p>So a Stock Token has <strong>two different quantities</strong> you can ask about, and they answer different questions:</p>
+<table>
+<thead>
+<tr>
+<th>Quantity</th>
+<th>Formula</th>
+<th>Answers</th>
+</tr>
+</thead>
+<tbody><tr>
+<td>Token balance</td>
+<td><code>balanceOf(you)</code></td>
+<td>&quot;How many tokens do I hold?&quot;</td>
+</tr>
+<tr>
+<td>Share-equivalent</td>
+<td><code>balance × uiMultiplier ÷ 1e18</code></td>
+<td>&quot;How many shares of the stock is that?&quot;</td>
+</tr>
+</tbody></table>
+<h2 id="the-trap-which-number-do-you-multiply-by-the-price"><a class="anchor" href="#the-trap-which-number-do-you-multiply-by-the-price" aria-label="Link to this section">#</a>The trap: which number do you multiply by the price?</h2><p>Here&#39;s where integrations break. You have a token balance, a multiplier, and a Chainlink price. To get a USD value, which do you multiply?</p>
+<p>The instinct — and it&#39;s wrong — is: <em>shares × price</em>. That is, <code>balance × multiplier × price</code>. It feels right (&quot;value = number of shares times price per share&quot;), and it produces a number that looks plausible. After a corporate action, it is <strong>too high</strong>, because you&#39;ve counted the multiplier twice.</p>
+<p><strong>The reason:</strong> Robinhood&#39;s Chainlink feeds are <strong>already multiplier-adjusted</strong>. The feed for a Stock Token returns the total-return price of <em>one token</em>, not the price of one underlying share. The corporate action is baked into the feed answer. So:</p>
+<div class="callout callout-danger"><p class="callout-title">The rule, memorize it</p><p><strong>USD value = token balance × feed price. Nothing else.</strong>
+The feed price already includes the multiplier. Applying <code>uiMultiplier</code> to the <em>value</em> double-counts every split and dividend. Use <code>uiMultiplier</code> only to report <strong>share-equivalents</strong> to a human — never in a valuation.</p>
+</div>
+
+<h2 id="a-worked-example"><a class="anchor" href="#a-worked-example" aria-label="Link to this section">#</a>A worked example</h2><p>Suppose a token has had a corporate action, so its multiplier is <code>1.5e18</code> (each token now represents 1.5 shares). You hold 10 tokens. The Chainlink feed answers <code>20000000000</code> — that&#39;s <code>$200.00</code> at 8 decimals, and remember, that&#39;s the price of one <em>token</em>.</p>
+<p><strong>Wrong (double-counts the multiplier):</strong></p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">const</span> shares = balance * multiplier / <span class="hljs-number">10n</span> ** <span class="hljs-number">18n</span> <span class="hljs-comment">// 10 × 1.5 = 15 &quot;shares&quot;</span>
+<span class="hljs-keyword">const</span> wrongUsd = shares * feedPriceUsd <span class="hljs-comment">// 15 × $200 = $3,000 ❌</span></code></pre></figure><p><strong>Right (feed price is per token, already adjusted):</strong></p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">const</span> rightUsd = balanceTokens * feedPriceUsd <span class="hljs-comment">// 10 × $200 = $2,000 ✅</span></code></pre></figure><p>The wrong version overstates the position by exactly the multiplier — a 50% error here. On a real portfolio dashboard that&#39;s the difference between a user trusting your app and closing it forever. And the share count itself is still useful — you&#39;d show &quot;10 tokens ≈ 15 shares&quot; as context — you just don&#39;t put it in the dollar math.</p>
+<div class="callout callout-tip"><p class="callout-title">The feed answer isn't stale on weekends — it's closed</p><p>Stock feeds update 24/5, following market hours. Read one on a Saturday and its <code>updatedAt</code> will be Friday&#39;s close. That is <strong>not</strong> a stale feed; it&#39;s a closed market. A staleness check with a one-hour window will reject every weekend read. Use a window that tolerates the weekend gap (~72 hours), and tighten it only during market hours if you need to. The hoodchain SDK defaults to a 72-hour window for exactly this reason.</p>
+</div>
+
+<h2 id="doing-it-correctly-with-the-sdk"><a class="anchor" href="#doing-it-correctly-with-the-sdk" aria-label="Link to this section">#</a>Doing it correctly, with the SDK</h2><p>The <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain SDK</a> encodes all of the above so you don&#39;t have to. Here&#39;s the whole thing, correct by construction:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, getQuote, getMultiplier } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+
+<span class="hljs-comment">// getQuote returns the multiplier-adjusted price of ONE TOKEN</span>
+<span class="hljs-keyword">const</span> quote = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getQuote</span>(hood, <span class="hljs-string">&#x27;AAPL&#x27;</span>, { <span class="hljs-attr">maxAgeSeconds</span>: <span class="hljs-number">7</span> * <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> })
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`AAPL token price: $<span class="hljs-subst">${quote.priceUsd}</span>`</span>) <span class="hljs-comment">// e.g. $315.50</span>
+
+<span class="hljs-comment">// getMultiplier is the shares-per-token ratio — for display, not valuation</span>
+<span class="hljs-keyword">const</span> m = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getMultiplier</span>(hood, <span class="hljs-string">&#x27;AAPL&#x27;</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`1 AAPL token = <span class="hljs-subst">${<span class="hljs-built_in">Number</span>(m) / <span class="hljs-number">1e18</span>}</span> shares`</span>) <span class="hljs-comment">// e.g. 1.0</span></code></pre></figure><p><code>getQuote</code> also runs the staleness guard, validates the answer is positive and the round is complete, and throws a typed <code>StaleFeedError</code> / <code>InvalidFeedAnswerError</code> / <code>FeedNotFoundError</code> you can catch precisely. <code>getPortfolio</code> (Tutorial 5) applies the valuation rule across every holding and even cross-checks its share math against the token&#39;s own on-chain <code>balanceOfUI()</code>.</p>
+<h2 id="not-every-token-has-a-feed"><a class="anchor" href="#not-every-token-has-a-feed" aria-label="Link to this section">#</a>Not every token has a feed</h2><p>There are 95 Stock Tokens on-chain but Chainlink&#39;s public directory currently lists feeds for a <strong>subset</strong> — 34 at the time of writing. A token without a feed can still have its balance read; it just can&#39;t be priced on-chain. The SDK models this honestly: <code>listPricedStockTokens()</code> returns only the priceable ones, and <code>getQuote</code> on an unpriced token throws <code>FeedNotFoundError</code> rather than inventing a number. When you build the portfolio tracker, you&#39;ll see unpriced holdings reported as such — never as <code>$0</code>, which would be a lie.</p>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong>My USD total is way too high after a split</strong> — you&#39;re multiplying by <code>uiMultiplier</code> somewhere in the value path. Remove it. Value is <code>balance × feed price</code>, full stop.</p>
+<p><strong><code>StaleFeedError</code> on a weekend</strong> — expected. Widen <code>maxAgeSeconds</code> to cover the weekend (e.g. <code>7 * 24 * 60 * 60</code>). The market is closed, not the feed broken.</p>
+<p><strong><code>FeedNotFoundError</code></strong> — that token has no Chainlink feed. Read its balance, but don&#39;t try to price it. Use <code>listPricedStockTokens()</code> to see what <em>can</em> be priced.</p>
+<p><strong>My &quot;share count&quot; and &quot;token count&quot; differ and I expected them equal</strong> — that token has had a corporate action, so its multiplier is above <code>1e18</code>. That divergence is the whole point of the design; both numbers are correct, they just answer different questions.</p>
+<h2 id="what-you-learned"><a class="anchor" href="#what-you-learned" aria-label="Link to this section">#</a>What you learned</h2><p>You now understand the one thing that makes Robinhood Chain integrations subtly hard: the multiplier, the two quantities it produces, and the ironclad rule that valuation uses the feed price alone. You also know feeds are 24/5 and that not every token is priceable. With this, you&#39;re ready to build — starting with a live price ticker.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../02-connect-and-read/"><span class="pager-dir">← Previous</span><span class="pager-title">Connect and read the chain in 5 minutes</span></a><a class="pager pager-next" href="../04-live-price-ticker/"><span class="pager-dir">Next →</span><span class="pager-title">Your first app: a live price ticker</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#anatomy-of-a-stock-token">Anatomy of a Stock Token</a></li><li class="toc-l2"><a href="#the-multiplier-and-why-it-exists">The multiplier, and why it exists</a></li><li class="toc-l2"><a href="#the-trap-which-number-do-you-multiply-by-the-price">The trap: which number do you multiply by the price?</a></li><li class="toc-l2"><a href="#a-worked-example">A worked example</a></li><li class="toc-l2"><a href="#doing-it-correctly-with-the-sdk">Doing it correctly, with the SDK</a></li><li class="toc-l2"><a href="#not-every-token-has-a-feed">Not every token has a feed</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-learned">What you learned</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/04-live-price-ticker/index.html b/robinhood/learn-robinhood-chain/docs/04-live-price-ticker/index.html
new file mode 100644
index 000000000..e169e4e5c
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/04-live-price-ticker/index.html
@@ -0,0 +1,143 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Your first app: a live price ticker · Learn Robinhood Chain</title>
+<meta name="description" content="Build a terminal price ticker that streams multiplier-adjusted Chainlink quotes for any Stock Token, with staleness handling done right.">
+<meta property="og:title" content="Your first app: a live price ticker · Learn Robinhood Chain">
+<meta property="og:description" content="Build a terminal price ticker that streams multiplier-adjusted Chainlink quotes for any Stock Token, with staleness handling done right.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/" class="active" aria-current="page"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="04-live-price-ticker">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Building</span></nav>
+ <header class="doc-header">
+ <h1>Your first app: a live price ticker</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">15 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">3 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A live-updating terminal ticker for AAPL, TSLA, NVDA and SPY — real prices, refreshing on an interval.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../03-stock-tokens-explained/">Tutorial 3</a> — you understand feeds and multipliers</li><li>Node ≥ 20</li></ul></aside>
+ <div class="doc-body"><p>Time to build something that runs. A live price ticker is the &quot;hello world&quot; of market data: it reads prices, formats them, and refreshes. By the end you&#39;ll have a terminal that streams multiplier-adjusted Chainlink quotes for any Stock Token — and you&#39;ll have handled the two things beginners skip, staleness and unpriced tokens.</p>
+<h2 id="the-naive-version-and-why-we-won39t-ship-it"><a class="anchor" href="#the-naive-version-and-why-we-won39t-ship-it" aria-label="Link to this section">#</a>The naive version (and why we won&#39;t ship it)</h2><p>You <em>could</em> read a Chainlink feed directly and print the answer:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+<span class="hljs-keyword">const</span> [, answer] = <span class="hljs-keyword">await</span> hood.<span class="hljs-property">public</span>.<span class="hljs-title function_">readContract</span>({
+ <span class="hljs-attr">address</span>: <span class="hljs-string">&#x27;0x6B22A786bAa607d76728168703a39Ea9C99f2cD0&#x27;</span>, <span class="hljs-comment">// AAPL feed</span>
+ <span class="hljs-attr">abi</span>: [{ <span class="hljs-attr">name</span>: <span class="hljs-string">&#x27;latestRoundData&#x27;</span>, <span class="hljs-attr">type</span>: <span class="hljs-string">&#x27;function&#x27;</span>, <span class="hljs-attr">stateMutability</span>: <span class="hljs-string">&#x27;view&#x27;</span>, <span class="hljs-attr">inputs</span>: [],
+ <span class="hljs-attr">outputs</span>: [{<span class="hljs-attr">type</span>:<span class="hljs-string">&#x27;uint80&#x27;</span>},{<span class="hljs-attr">type</span>:<span class="hljs-string">&#x27;int256&#x27;</span>},{<span class="hljs-attr">type</span>:<span class="hljs-string">&#x27;uint256&#x27;</span>},{<span class="hljs-attr">type</span>:<span class="hljs-string">&#x27;uint256&#x27;</span>},{<span class="hljs-attr">type</span>:<span class="hljs-string">&#x27;uint80&#x27;</span>}] }],
+ <span class="hljs-attr">functionName</span>: <span class="hljs-string">&#x27;latestRoundData&#x27;</span>,
+})
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-title class_">Number</span>(answer) / <span class="hljs-number">1e8</span>)</code></pre></figure><p>This works, but it hardcodes an address, ignores whether the round is complete, and will happily print a price from a feed that hasn&#39;t updated in a month. We can do better in the same number of lines.</p>
+<h2 id="the-real-ticker"><a class="anchor" href="#the-real-ticker" aria-label="Link to this section">#</a>The real ticker</h2><p><code>getQuote</code> from the <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain SDK</a> does the address lookup, the multiplier-correct interpretation, the staleness guard, and the answer validation. Create <code>ticker.ts</code>:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, getQuote, listPricedStockTokens, <span class="hljs-title class_">FeedNotFoundError</span>, <span class="hljs-title class_">StaleFeedError</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+
+<span class="hljs-comment">// symbols from argv, or a sensible default set</span>
+<span class="hljs-keyword">const</span> symbols = process.<span class="hljs-property">argv</span>.<span class="hljs-title function_">slice</span>(<span class="hljs-number">2</span>).<span class="hljs-property">length</span> ? process.<span class="hljs-property">argv</span>.<span class="hljs-title function_">slice</span>(<span class="hljs-number">2</span>) : [<span class="hljs-string">&#x27;AAPL&#x27;</span>, <span class="hljs-string">&#x27;TSLA&#x27;</span>, <span class="hljs-string">&#x27;NVDA&#x27;</span>, <span class="hljs-string">&#x27;SPY&#x27;</span>]
+
+<span class="hljs-comment">// stock feeds update 24/5 — a week-wide window means weekend runs don&#x27;t throw</span>
+<span class="hljs-keyword">const</span> maxAgeSeconds = <span class="hljs-number">7</span> * <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span>
+
+<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">tick</span>(<span class="hljs-params"></span>) {
+ <span class="hljs-keyword">const</span> rows = <span class="hljs-keyword">await</span> <span class="hljs-title class_">Promise</span>.<span class="hljs-title function_">all</span>(
+ symbols.<span class="hljs-title function_">map</span>(<span class="hljs-title function_">async</span> (<span class="hljs-built_in">symbol</span>) =&gt; {
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-keyword">const</span> q = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getQuote</span>(hood, <span class="hljs-built_in">symbol</span>, { maxAgeSeconds })
+ <span class="hljs-keyword">const</span> age = (q.<span class="hljs-property">ageSeconds</span> / <span class="hljs-number">3600</span>).<span class="hljs-title function_">toFixed</span>(<span class="hljs-number">1</span>)
+ <span class="hljs-keyword">return</span> <span class="hljs-string">`<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>.padEnd(<span class="hljs-number">6</span>)}</span> $<span class="hljs-subst">${q.priceUsd.toFixed(<span class="hljs-number">2</span>).padStart(<span class="hljs-number">10</span>)}</span> (feed <span class="hljs-subst">${age}</span>h old)`</span>
+ } <span class="hljs-keyword">catch</span> (e) {
+ <span class="hljs-keyword">if</span> (e <span class="hljs-keyword">instanceof</span> <span class="hljs-title class_">FeedNotFoundError</span>) <span class="hljs-keyword">return</span> <span class="hljs-string">`<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>.padEnd(<span class="hljs-number">6</span>)}</span> <span class="hljs-subst">${<span class="hljs-string">&#x27;no feed&#x27;</span>.padStart(<span class="hljs-number">11</span>)}</span>`</span>
+ <span class="hljs-keyword">if</span> (e <span class="hljs-keyword">instanceof</span> <span class="hljs-title class_">StaleFeedError</span>) <span class="hljs-keyword">return</span> <span class="hljs-string">`<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>.padEnd(<span class="hljs-number">6</span>)}</span> <span class="hljs-subst">${<span class="hljs-string">&#x27;stale&#x27;</span>.padStart(<span class="hljs-number">11</span>)}</span>`</span>
+ <span class="hljs-keyword">return</span> <span class="hljs-string">`<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>.padEnd(<span class="hljs-number">6</span>)}</span> <span class="hljs-subst">${<span class="hljs-string">&#x27;error&#x27;</span>.padStart(<span class="hljs-number">11</span>)}</span>`</span>
+ }
+ }),
+ )
+ <span class="hljs-comment">// redraw in place</span>
+ process.<span class="hljs-property">stdout</span>.<span class="hljs-title function_">write</span>(<span class="hljs-string">&#x27;\x1b[2J\x1b[H&#x27;</span>)
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Robinhood Chain — <span class="hljs-subst">${listPricedStockTokens().length}</span> priced Stock Tokens · <span class="hljs-subst">${<span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>().toLocaleTimeString()}</span>\n`</span>)
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(rows.<span class="hljs-title function_">join</span>(<span class="hljs-string">&#x27;\n&#x27;</span>))
+}
+
+<span class="hljs-keyword">await</span> <span class="hljs-title function_">tick</span>()
+<span class="hljs-built_in">setInterval</span>(tick, <span class="hljs-number">15_000</span>) <span class="hljs-comment">// feeds don&#x27;t move every second; 15s is plenty</span></code></pre></figure><p>Run it:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">npx tsx ticker.ts AAPL TSLA NVDA SPY</code></pre></figure><figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">Robinhood Chain — 34 priced Stock Tokens · 12:18:41 PM
+
+AAPL $ 315.50 (feed 41.2h old)
+TSLA $ 407.82 (feed 40.4h old)
+NVDA $ 210.19 (feed 44.0h old)
+SPY $ 753.62 (feed 44.1h old)</code></pre></figure><p>Those are real prices, pulled live while writing this. The feed ages are ~40 hours because this run happened over a weekend — the market was closed, the feeds paused, and our 7-day window correctly accepted them instead of throwing. That&#39;s the staleness handling from Tutorial 3, doing its job in production.</p>
+<div class="callout callout-tip"><p class="callout-title">Every design decision here is deliberate</p><ul>
+<li><strong>15-second interval, not 1s.</strong> Chainlink stock feeds update on the order of minutes to hours, gated by a heartbeat and a deviation threshold. Polling every second just wastes RPC calls to see the same number.</li>
+<li><strong><code>Promise.all</code>, not a loop.</strong> All symbols are fetched concurrently; the ticker&#39;s latency is one RPC round-trip, not N of them.</li>
+<li><strong>Typed catches.</strong> <code>FeedNotFoundError</code> and <code>StaleFeedError</code> are distinct outcomes with distinct UI — &quot;no feed&quot; is permanent, &quot;stale&quot; is temporary. Never collapse them into a generic &quot;error.&quot;</li>
+</ul>
+</div>
+
+<h2 id="add-the-multiplier-for-context"><a class="anchor" href="#add-the-multiplier-for-context" aria-label="Link to this section">#</a>Add the multiplier, for context</h2><p>Users like to see share-equivalents. Remember the Tutorial 3 rule: the multiplier is for <em>display</em>, never for the dollar math. Add it as a separate column:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { getMultiplier } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> [q, m] = <span class="hljs-keyword">await</span> <span class="hljs-title class_">Promise</span>.<span class="hljs-title function_">all</span>([<span class="hljs-title function_">getQuote</span>(hood, <span class="hljs-built_in">symbol</span>, { maxAgeSeconds }), <span class="hljs-title function_">getMultiplier</span>(hood, <span class="hljs-built_in">symbol</span>)])
+<span class="hljs-keyword">const</span> shares = m === <span class="hljs-literal">null</span> ? <span class="hljs-string">&#x27;n/a&#x27;</span> : (<span class="hljs-title class_">Number</span>(m) / <span class="hljs-number">1e18</span>).<span class="hljs-title function_">toFixed</span>(<span class="hljs-number">4</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>}</span> $<span class="hljs-subst">${q.priceUsd.toFixed(<span class="hljs-number">2</span>)}</span> (1 token = <span class="hljs-subst">${shares}</span> shares)`</span>)</code></pre></figure><p>For the mega-cap tickers above, the multiplier is <code>1.0000</code> — no corporate action since the token launched. When one does have a split or dividend, this column is where you&#39;d surface it, while your USD math stays untouched.</p>
+<h2 id="a-browser-version-no-backend-needed"><a class="anchor" href="#a-browser-version-no-backend-needed" aria-label="Link to this section">#</a>A browser version (no backend needed)</h2><p>Everything here works client-side too — that&#39;s how this site&#39;s <a href="../">home-page ticker</a> runs. In a browser you&#39;d skip the SDK&#39;s Node bits and hit the RPC with <code>fetch</code>, decoding <code>latestRoundData()</code> yourself (the answer is the second 32-byte word of the response). The <a href="https://github.com/nirholas/learn-robinhood-chain/blob/main/assets/ticker.js" target="_blank" rel="noopener noreferrer"><code>ticker.js</code></a> on this very site is a complete, dependency-free reference for that — read it if you want the raw JSON-RPC version.</p>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong>Every symbol prints <code>stale</code></strong> — your <code>maxAgeSeconds</code> is too tight for the current time (weekend/holiday). Widen it. During market hours you can go as tight as the feed&#39;s heartbeat.</p>
+<p><strong><code>UnknownSymbolError</code></strong> — the ticker you passed isn&#39;t in the registry. Symbols are case-insensitive tickers as listed on-chain. Run <code>listStockTokens()</code> to see all 95, or <code>listPricedStockTokens()</code> for the priceable ones.</p>
+<p><strong>Screen flicker on redraw</strong> — the <code>\x1b[2J\x1b[H</code> clear-and-home is crude but portable. For a polished TUI, reach for a library like <code>blessed</code> or <code>ink</code>; for a learning ticker, the escape codes are fine.</p>
+<p><strong><code>429 Too Many Requests</code></strong> — you&#39;re on the public RPC and polling too hard, or running several scripts at once. Raise the interval or switch to an Alchemy endpoint (Tutorial 2).</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>A real, live, multiplier-correct price ticker with proper staleness and unpriced-token handling — the market-data foundation every other app in this course builds on. Next, we take reads a step further: valuing an entire portfolio in a single call, and getting it <em>right</em> where naive trackers get it wrong.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../03-stock-tokens-explained/"><span class="pager-dir">← Previous</span><span class="pager-title">Stock Tokens explained for developers</span></a><a class="pager pager-next" href="../05-portfolio-tracker/"><span class="pager-dir">Next →</span><span class="pager-title">Portfolio tracker done right</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#the-naive-version-and-why-we-won39t-ship-it">The naive version (and why we won&amp;#39;t ship it)</a></li><li class="toc-l2"><a href="#the-real-ticker">The real ticker</a></li><li class="toc-l2"><a href="#add-the-multiplier-for-context">Add the multiplier, for context</a></li><li class="toc-l2"><a href="#a-browser-version-no-backend-needed">A browser version (no backend needed)</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/05-portfolio-tracker/index.html b/robinhood/learn-robinhood-chain/docs/05-portfolio-tracker/index.html
new file mode 100644
index 000000000..7f41c7bbb
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/05-portfolio-tracker/index.html
@@ -0,0 +1,138 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Portfolio tracker done right · Learn Robinhood Chain</title>
+<meta name="description" content="Value any address's Stock Token holdings in one multicall — and understand exactly why a naive tracker reports the wrong number after a split.">
+<meta property="og:title" content="Portfolio tracker done right · Learn Robinhood Chain">
+<meta property="og:description" content="Value any address's Stock Token holdings in one multicall — and understand exactly why a naive tracker reports the wrong number after a split.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/" class="active" aria-current="page"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="05-portfolio-tracker">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Building</span></nav>
+ <header class="doc-header">
+ <h1>Portfolio tracker done right</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">15 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">4 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A portfolio valuation tool that is correct after corporate actions, cross-checked against the token&#39;s own on-chain share accounting.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../03-stock-tokens-explained/">Tutorial 3</a> — the multiplier trap</li><li>Node ≥ 20</li></ul></aside>
+ <div class="doc-body"><p>Every wallet tracker on every chain does the same thing: enumerate token balances, price them, sum them. On Robinhood Chain, that naive recipe is wrong twice — once from the multiplier trap (Tutorial 3), and once from the sheer number of round trips a naive implementation makes. This tutorial builds the tracker correctly: one multicall sweep, multiplier-correct valuation, and an honest treatment of holdings that can&#39;t be priced.</p>
+<h2 id="why-quotjust-loop-and-call-balanceofquot-doesn39t-scale"><a class="anchor" href="#why-quotjust-loop-and-call-balanceofquot-doesn39t-scale" aria-label="Link to this section">#</a>Why &quot;just loop and call balanceOf&quot; doesn&#39;t scale</h2><p>There are 95 Stock Tokens in the registry. A naive tracker does:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> token <span class="hljs-keyword">of</span> tokens) {
+ <span class="hljs-keyword">const</span> balance = <span class="hljs-keyword">await</span> client.<span class="hljs-title function_">readContract</span>({ <span class="hljs-attr">address</span>: token.<span class="hljs-property">address</span>, <span class="hljs-attr">abi</span>: erc20Abi, <span class="hljs-attr">functionName</span>: <span class="hljs-string">&#x27;balanceOf&#x27;</span>, <span class="hljs-attr">args</span>: [owner] })
+ <span class="hljs-comment">// ...</span>
+}</code></pre></figure><p>That&#39;s 95 sequential RPC round trips before you&#39;ve even started pricing anything. On the public RPC, each round trip is real latency — this loop takes seconds and burns your rate limit for nothing, since most addresses hold a handful of these tokens at most.</p>
+<h2 id="the-right-approach-one-multicall"><a class="anchor" href="#the-right-approach-one-multicall" aria-label="Link to this section">#</a>The right approach: one multicall</h2><p>viem&#39;s public client (used by <code>hoodchain</code>) batches calls into <code>Multicall3</code> automatically when <code>batch: { multicall: true }</code> is set — which <code>createHoodClient()</code> does for you. So the fix is almost free: fire all 95 <code>balanceOf</code> reads as a single batch, filter to the ones that are actually held, then multicall <em>those</em> for balance + multiplier together, and multicall the feeds for pricing. That&#39;s what <code>getPortfolio</code> does under the hood:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, getPortfolio } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+<span class="hljs-keyword">import</span> <span class="hljs-keyword">type</span> { <span class="hljs-title class_">Address</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem&#x27;</span>
+
+<span class="hljs-keyword">const</span> owner = process.<span class="hljs-property">argv</span>[<span class="hljs-number">2</span>] <span class="hljs-keyword">as</span> <span class="hljs-title class_">Address</span> | <span class="hljs-literal">undefined</span>
+<span class="hljs-keyword">if</span> (!owner || !<span class="hljs-regexp">/^0x[0-9a-fA-F]{40}$/</span>.<span class="hljs-title function_">test</span>(owner)) {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(<span class="hljs-string">&#x27;usage: npx tsx portfolio.ts 0xADDRESS&#x27;</span>)
+ process.<span class="hljs-title function_">exit</span>(<span class="hljs-number">1</span>)
+}
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+<span class="hljs-keyword">const</span> portfolio = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getPortfolio</span>(hood, owner, { <span class="hljs-attr">maxAgeSeconds</span>: <span class="hljs-number">7</span> * <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> })
+
+<span class="hljs-keyword">if</span> (portfolio.<span class="hljs-property">positions</span>.<span class="hljs-property">length</span> === <span class="hljs-number">0</span>) {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`<span class="hljs-subst">${owner}</span> holds no Stock Tokens.`</span>)
+ process.<span class="hljs-title function_">exit</span>(<span class="hljs-number">0</span>)
+}
+
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Stock Token portfolio for <span class="hljs-subst">${owner}</span>\n`</span>)
+<span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> p <span class="hljs-keyword">of</span> portfolio.<span class="hljs-property">positions</span>) {
+ <span class="hljs-keyword">const</span> value = p.<span class="hljs-property">valueUsd</span> === <span class="hljs-literal">null</span> ? <span class="hljs-string">&#x27;unpriced (no feed)&#x27;</span> : <span class="hljs-string">`$<span class="hljs-subst">${p.valueUsd.toFixed(<span class="hljs-number">2</span>)}</span>`</span>
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(
+ <span class="hljs-string">`<span class="hljs-subst">${p.<span class="hljs-built_in">symbol</span>.padEnd(<span class="hljs-number">6</span>)}</span> <span class="hljs-subst">${p.balanceTokens.toFixed(<span class="hljs-number">6</span>).padStart(<span class="hljs-number">16</span>)}</span> tokens `</span> +
+ <span class="hljs-string">`= <span class="hljs-subst">${p.shareEquivalent.toFixed(<span class="hljs-number">6</span>).padStart(<span class="hljs-number">16</span>)}</span> share-equivalents <span class="hljs-subst">${value}</span>`</span>,
+ )
+}
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`\nTotal priced value: $<span class="hljs-subst">${portfolio.totalUsd.toFixed(<span class="hljs-number">2</span>)}</span>`</span>)
+<span class="hljs-keyword">if</span> (portfolio.<span class="hljs-property">unpricedSymbols</span>.<span class="hljs-property">length</span>) {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Unpriced holdings (no Chainlink feed yet): <span class="hljs-subst">${portfolio.unpricedSymbols.join(<span class="hljs-string">&#x27;, &#x27;</span>)}</span>`</span>)
+}</code></pre></figure><p>Run it against any address (this example uses the Multicall3 deployer, a busy contract address, purely to demonstrate the zero-holdings path):</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">npx tsx portfolio.ts 0xca11bde05977b3631167028862be2a173976ca11</code></pre></figure><figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">0xca11bde05977b3631167028862be2a173976ca11 holds no Stock Tokens.</code></pre></figure><p>That&#39;s the honest empty state — the tracker checked all 95 tokens in one batch and confirmed zero holdings, rather than silently returning nothing. Point it at a wallet that actually holds Stock Tokens (your testnet wallet from Tutorial 2, once funded, or any address you find via the explorer) and you&#39;ll see rows like:</p>
+<figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">Stock Token portfolio for 0xYourAddress
+
+NFLX 5.000000000000000000 tokens = 5.000000000000000000 share-equivalents $612.40
+TSLA 2.500000000000000000 tokens = 2.500000000000000000 share-equivalents $1019.55
+
+Total priced value: $1631.95</code></pre></figure><h2 id="what-getportfolio-is-actually-doing"><a class="anchor" href="#what-getportfolio-is-actually-doing" aria-label="Link to this section">#</a>What <code>getPortfolio</code> is actually doing</h2><p>Reading the <a href="https://github.com/nirholas/robinhood-chain-sdk/blob/main/src/stocks.ts" target="_blank" rel="noopener noreferrer">source</a> is worth five minutes, because the pattern generalizes to any multi-asset dashboard you&#39;ll ever build:</p>
+<ol>
+<li><strong>One multicall</strong> for <code>balanceOf</code> across all 95 registry tokens, <code>allowFailure: false</code> — if this fails, something is fundamentally wrong (bad RPC), so let it throw.</li>
+<li><strong>Filter to non-zero balances.</strong> Most wallets hold a handful of tokens; there&#39;s no reason to fetch multiplier and feed data for tokens you don&#39;t own.</li>
+<li><strong>A second multicall</strong>, this time for <code>balanceOf</code> + <code>uiMultiplier()</code> together, only over the held tokens.</li>
+<li><strong>A third multicall for feed prices</strong>, <code>allowFailure: true</code> — a single bad feed (stale, or a reverting call) shouldn&#39;t take down the whole portfolio. Positions with a failed feed fall back to <code>valueUsd: null</code>.</li>
+<li><strong>Valuation</strong>, per the Tutorial 3 rule: <code>valueUsd = balanceTokens × quote.priceUsd</code>. Multiplier is used only for <code>shareEquivalent</code>, never for <code>valueUsd</code>.</li>
+</ol>
+<p>Total RPC round trips for a full 95-token sweep: <strong>three</strong>, regardless of how many tokens the wallet actually holds. That&#39;s the difference between a tracker that feels instant and one that spins for ten seconds.</p>
+<h2 id="correctness-proven-not-asserted"><a class="anchor" href="#correctness-proven-not-asserted" aria-label="Link to this section">#</a>Correctness, proven, not asserted</h2><p>It&#39;s easy to <em>claim</em> multiplier-correct math. The SDK&#39;s live test suite instead <strong>cross-checks its share-equivalent computation against the token contract&#39;s own <code>balanceOfUI()</code></strong> — a view function the Stock Token contracts expose that does the same multiplication on-chain. If the SDK&#39;s <code>shareEquivalent</code> field and the contract&#39;s <code>balanceOfUI()</code> ever disagree, the test fails. That&#39;s the standard to hold your own money-math code to: don&#39;t just compute a number, find an independent on-chain source of truth and assert equality against it.</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-comment">// simplified from tests/live — the actual assertion the SDK ships with</span>
+<span class="hljs-keyword">const</span> onChainShares = <span class="hljs-keyword">await</span> hood.<span class="hljs-property">public</span>.<span class="hljs-title function_">readContract</span>({
+ <span class="hljs-attr">address</span>: token.<span class="hljs-property">address</span>, <span class="hljs-attr">abi</span>: stockTokenAbi, <span class="hljs-attr">functionName</span>: <span class="hljs-string">&#x27;balanceOfUI&#x27;</span>, <span class="hljs-attr">args</span>: [owner],
+})
+<span class="hljs-title function_">expect</span>(position.<span class="hljs-property">shareEquivalent</span>).<span class="hljs-title function_">toBeCloseTo</span>(<span class="hljs-title class_">Number</span>(<span class="hljs-title function_">formatUnits</span>(onChainShares, <span class="hljs-number">18</span>)))</code></pre></figure><h2 id="handling-the-unpriced-case-in-a-ui"><a class="anchor" href="#handling-the-unpriced-case-in-a-ui" aria-label="Link to this section">#</a>Handling the unpriced case in a UI</h2><p><code>portfolio.unpricedSymbols</code> exists because 95 tokens exist but only a subset have a live Chainlink feed (34 at the time of writing). A dashboard that silently omits unpriced holdings is lying by omission — a user who holds one would wonder where it went. Show it, clearly labeled as unpriced, and let <code>totalUsd</code> reflect only what could actually be valued:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">const</span> totalLabel = portfolio.<span class="hljs-property">unpricedSymbols</span>.<span class="hljs-property">length</span>
+ ? <span class="hljs-string">`$<span class="hljs-subst">${portfolio.totalUsd.toFixed(<span class="hljs-number">2</span>)}</span> priced (+ <span class="hljs-subst">${portfolio.unpricedSymbols.length}</span> unpriced holdings)`</span>
+ : <span class="hljs-string">`$<span class="hljs-subst">${portfolio.totalUsd.toFixed(<span class="hljs-number">2</span>)}</span>`</span></code></pre></figure><h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong>Portfolio total looks wrong after I know a token split</strong> — you&#39;re computing value somewhere outside <code>getPortfolio</code>, and you&#39;re multiplying by the multiplier. Revisit Tutorial 3; the rule doesn&#39;t change just because you&#39;re now summing across many tokens.</p>
+<p><strong>Slow first run</strong> — the very first multicall batch resolves 95 balances; on the public RPC that&#39;s still one HTTP round trip, but a cold connection adds latency. Subsequent calls are fast.</p>
+<p><strong>A held token shows <code>unpriced (no feed)</code></strong> — expected for tokens outside Chainlink&#39;s current 34-feed coverage. Its balance is real; it just can&#39;t be priced on-chain yet.</p>
+<p><strong>I want portfolio history / a chart</strong> — this reads <em>current</em> state only. For history, you&#39;d index <code>Transfer</code> events over time (see <code>watchTransfers</code> in Tutorial 7) and combine with historical feed rounds — a bigger project outside this tutorial&#39;s scope.</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>A portfolio tracker that does one multicall sweep instead of ninety-five sequential calls, values holdings using the correct rule from Tutorial 3, and is honest about what it can&#39;t price — with its math independently verified against the chain&#39;s own accounting. Next: turning a read into a write, with your first on-chain swap.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../04-live-price-ticker/"><span class="pager-dir">← Previous</span><span class="pager-title">Your first app: a live price ticker</span></a><a class="pager pager-next" href="../06-swapping-on-chain/"><span class="pager-dir">Next →</span><span class="pager-title">Swapping on-chain: quotes, slippage, execution</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#why-quotjust-loop-and-call-balanceofquot-doesn39t-scale">Why &amp;quot;just loop and call balanceOf&amp;quot; doesn&amp;#39;t scale</a></li><li class="toc-l2"><a href="#the-right-approach-one-multicall">The right approach: one multicall</a></li><li class="toc-l2"><a href="#what-getportfolio-is-actually-doing">What getPortfolio is actually doing</a></li><li class="toc-l2"><a href="#correctness-proven-not-asserted">Correctness, proven, not asserted</a></li><li class="toc-l2"><a href="#handling-the-unpriced-case-in-a-ui">Handling the unpriced case in a UI</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/06-swapping-on-chain/index.html b/robinhood/learn-robinhood-chain/docs/06-swapping-on-chain/index.html
new file mode 100644
index 000000000..5ec1e8ae9
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/06-swapping-on-chain/index.html
@@ -0,0 +1,146 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Swapping on-chain: quotes, slippage, execution · Learn Robinhood Chain</title>
+<meta name="description" content="Quote a Uniswap v3 swap across every fee tier, set slippage correctly, and execute on testnet — with a Stock Token eligibility sidebar.">
+<meta property="og:title" content="Swapping on-chain: quotes, slippage, execution · Learn Robinhood Chain">
+<meta property="og:description" content="Quote a Uniswap v3 swap across every fee tier, set slippage correctly, and execute on testnet — with a Stock Token eligibility sidebar.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/" class="active" aria-current="page"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="06-swapping-on-chain">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Building</span></nav>
+ <header class="doc-header">
+ <h1>Swapping on-chain: quotes, slippage, execution</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">20 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">5 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A working swap: a real mainnet quote you can run now, and the exact, safe path to a real testnet swap transaction.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../02-connect-and-read/">Tutorial 2</a></li><li>A wallet private key in an env var for the write step (testnet)</li></ul></aside>
+ <div class="doc-body"><p>Swapping is where reads become writes, and where a single wrong assumption costs real money. This tutorial covers all three layers — quoting a route, protecting yourself with slippage, and sending the transaction — plus the eligibility gate that exists specifically because some of the tokens you can swap into are regulated securities.</p>
+<h2 id="the-routing-problem"><a class="anchor" href="#the-routing-problem" aria-label="Link to this section">#</a>The routing problem</h2><p>Robinhood Chain&#39;s DEX layer is Uniswap v3. A v3 pool exists per <strong>token pair per fee tier</strong> (0.01%, 0.05%, 0.3%, 1%), and plenty of those pools exist with <strong>zero liquidity</strong> — deployed, but never seeded. A naive swap implementation that assumes &quot;the 0.3% pool&quot; will revert constantly. The right approach probes every fee tier for a direct route, plus two-hop routes through common intermediates (WETH, USDG), and picks whichever produces the best output. That&#39;s what <code>quoteSwap</code> does.</p>
+<h2 id="getting-a-real-quote-mainnet-read-only-no-wallet-needed"><a class="anchor" href="#getting-a-real-quote-mainnet-read-only-no-wallet-needed" aria-label="Link to this section">#</a>Getting a real quote (mainnet, read-only, no wallet needed)</h2><p>This runs right now, with no funds and no risk — quoting is a simulated call, not a transaction:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, quoteSwap, parseUsdg, <span class="hljs-variable constant_">MAINNET_ADDRESSES</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+<span class="hljs-keyword">import</span> { formatEther } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+
+<span class="hljs-keyword">const</span> quote = <span class="hljs-keyword">await</span> <span class="hljs-title function_">quoteSwap</span>(hood, {
+ <span class="hljs-attr">tokenIn</span>: <span class="hljs-variable constant_">MAINNET_ADDRESSES</span>.<span class="hljs-property">usdg</span>,
+ <span class="hljs-attr">tokenOut</span>: <span class="hljs-variable constant_">MAINNET_ADDRESSES</span>.<span class="hljs-property">weth</span>,
+ <span class="hljs-attr">amountIn</span>: <span class="hljs-title function_">parseUsdg</span>(<span class="hljs-string">&#x27;100&#x27;</span>), <span class="hljs-comment">// USDG has 6 decimals — always use parseUsdg, not parseUnits(x, 18)</span>
+})
+
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`100 USDG -&gt; <span class="hljs-subst">${formatEther(quote.amountOut)}</span> WETH`</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`route: <span class="hljs-subst">${quote.route.fees.join(<span class="hljs-string">&#x27;/&#x27;</span>)}</span> fee tier(s), <span class="hljs-subst">${quote.route.path.length}</span> hop(s)`</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`gas estimate: <span class="hljs-subst">${quote.gasEstimate}</span>`</span>)</code></pre></figure><figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">100 USDG -&gt; 0.055549693087148477 WETH
+route: 100 fee tier(s), 2 hop(s)</code></pre></figure><p>That&#39;s a live capture: <strong>100 USDG quoted at 0.0555 WETH</strong>, filled through the 0.01% fee tier. Note the router picked a <em>two-hop</em> path even though <code>fees.join()</code> shows one number — <code>quoteSwap</code> probes single-hop routes across all four tiers <em>and</em> two-hop routes through WETH/USDG, and the winner here happened to be the tightest single-tier pool. Run it again in your own terminal and you&#39;ll get a live number of your own; Uniswap v3 pricing moves with every block.</p>
+<div class="callout callout-tip"><p class="callout-title">USDG has 6 decimals, not 18</p><p>This is the single most common bug in a Robinhood Chain integration. USDG deliberately mirrors USDC&#39;s convention, unlike most L2-native stables which use 18. Always use the SDK&#39;s <code>parseUsdg</code> / <code>formatUsdg</code> helpers instead of hardcoding a decimals count — they encode the correct value so you can&#39;t get it wrong.</p>
+</div>
+
+<h2 id="building-and-sending-the-transaction"><a class="anchor" href="#building-and-sending-the-transaction" aria-label="Link to this section">#</a>Building and sending the transaction</h2><p>A quote alone doesn&#39;t move funds. <code>buildSwapTx</code> turns a quote into calldata with a slippage-protected minimum output and a deadline; <code>executeSwap</code> does the whole pipeline — quote, build, approve if needed, send, confirm — in one call:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { parseEther } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem&#x27;</span>
+<span class="hljs-keyword">import</span> { privateKeyToAccount } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem/accounts&#x27;</span>
+<span class="hljs-keyword">import</span> { createHoodClient, executeSwap, <span class="hljs-variable constant_">TESTNET_ADDRESSES</span>, <span class="hljs-variable constant_">TESTNET_STOCK_TOKENS</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>({
+ <span class="hljs-attr">chain</span>: <span class="hljs-string">&#x27;testnet&#x27;</span>,
+ <span class="hljs-attr">account</span>: <span class="hljs-title function_">privateKeyToAccount</span>(process.<span class="hljs-property">env</span>.<span class="hljs-property">ROBINHOOD_CHAIN_PRIVATE_KEY</span> <span class="hljs-keyword">as</span> <span class="hljs-string">`0x<span class="hljs-subst">${<span class="hljs-built_in">string</span>}</span>`</span>),
+})
+
+<span class="hljs-keyword">const</span> { hash, receipt, quote } = <span class="hljs-keyword">await</span> <span class="hljs-title function_">executeSwap</span>(hood, {
+ <span class="hljs-attr">tokenIn</span>: <span class="hljs-variable constant_">TESTNET_ADDRESSES</span>.<span class="hljs-property">weth</span>,
+ <span class="hljs-attr">tokenOut</span>: <span class="hljs-variable constant_">TESTNET_STOCK_TOKENS</span>.<span class="hljs-property">NFLX</span>,
+ <span class="hljs-attr">amountIn</span>: <span class="hljs-title function_">parseEther</span>(<span class="hljs-string">&#x27;0.0001&#x27;</span>),
+})
+
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`swapped for <span class="hljs-subst">${formatEther(quote.amountOut)}</span> NFLX — tx <span class="hljs-subst">${hash}</span>, status <span class="hljs-subst">${receipt.status}</span>`</span>)</code></pre></figure><p>Under the hood, <code>executeSwap</code>:</p>
+<ol>
+<li>Calls <code>quoteSwap</code> to find the best route.</li>
+<li>Calls <code>buildSwapTx</code> to encode calldata with <code>amountOutMinimum</code> set from your slippage tolerance (default 0.5%, <code>slippageBps: 50</code>) and a deadline (default 10 minutes).</li>
+<li>Calls <code>ensureApproval</code> — checks the router&#39;s current allowance and sends an <code>approve</code> <strong>only if it&#39;s short</strong>, so a second swap of the same token doesn&#39;t re-approve for no reason.</li>
+<li>Sends the transaction and waits for the receipt.</li>
+</ol>
+<h3 id="two-router-flavors-handled-for-you"><a class="anchor" href="#two-router-flavors-handled-for-you" aria-label="Link to this section">#</a>Two router flavors, handled for you</h3><p>Mainnet routes through <strong>SwapRouter02</strong> (no <code>deadline</code> field in the call struct — it&#39;s enforced by wrapping the call in <code>multicall(deadline, [data])</code>). The testnet community deployment uses the <strong>classic <code>SwapRouter</code></strong>, whose struct carries <code>deadline</code> directly. <code>buildSwapTx</code> detects which network you&#39;re on and encodes the right shape automatically — this is exactly the kind of chain-specific footgun a good SDK exists to remove.</p>
+<h2 id="the-eligibility-gate"><a class="anchor" href="#the-eligibility-gate" aria-label="Link to this section">#</a>The eligibility gate</h2><p>Every canonical Stock Token is a regulated security under the restriction from Tutorial 1: it may not be offered, sold, or delivered to US persons. <code>buildSwapTx</code> enforces this at the SDK boundary — <strong>any swap whose output is a canonical Stock Token throws before it builds calldata</strong>, unless you&#39;ve explicitly affirmed eligibility:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, <span class="hljs-title class_">StockTokenEligibilityError</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>() <span class="hljs-comment">// default: acknowledgeStockTokenEligibility is false</span>
+
+<span class="hljs-keyword">try</span> {
+ <span class="hljs-keyword">await</span> <span class="hljs-title function_">executeSwap</span>(hood, { <span class="hljs-attr">tokenIn</span>: usdg, <span class="hljs-attr">tokenOut</span>: aaplToken, <span class="hljs-attr">amountIn</span>: <span class="hljs-title function_">parseUsdg</span>(<span class="hljs-string">&#x27;100&#x27;</span>) })
+} <span class="hljs-keyword">catch</span> (e) {
+ <span class="hljs-keyword">if</span> (e <span class="hljs-keyword">instanceof</span> <span class="hljs-title class_">StockTokenEligibilityError</span>) {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(<span class="hljs-string">&#x27;Refused: Stock Token acquisition needs an eligibility acknowledgment.&#x27;</span>)
+ }
+}</code></pre></figure><p>To proceed, the <em>operator</em> — not the end user, the person deploying the software — affirms eligibility explicitly:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>({ <span class="hljs-attr">acknowledgeStockTokenEligibility</span>: <span class="hljs-literal">true</span> })</code></pre></figure><p>This default-closed design is worth copying even outside this SDK: <strong>gate the risky path, not the safe one.</strong> Reads and <em>sells</em> of Stock Tokens are never restricted — only acquisition is, matching the actual legal restriction.</p>
+<div class="callout callout-danger"><p class="callout-title">Not a substitute for real compliance</p><p>This flag is a development safety rail, not a KYC system. If you&#39;re building a real product that lets users acquire Stock Tokens, you need actual jurisdiction detection and legal review — this flag just stops you from <em>accidentally</em> shipping an unrestricted buy button.</p>
+</div>
+
+<h2 id="slippage-and-deadlines-tuned-correctly"><a class="anchor" href="#slippage-and-deadlines-tuned-correctly" aria-label="Link to this section">#</a>Slippage and deadlines, tuned correctly</h2><p>The defaults (0.5% slippage, 10-minute deadline) are reasonable for a human clicking a button. Tune them for your use case:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">const</span> tx = <span class="hljs-title function_">buildSwapTx</span>(hood, quote, {
+ <span class="hljs-attr">slippageBps</span>: <span class="hljs-number">100</span>, <span class="hljs-comment">// 1% — wider for a thinly-traded pair</span>
+ <span class="hljs-attr">deadlineSeconds</span>: <span class="hljs-number">120</span>, <span class="hljs-comment">// 2 minutes — tighter for an automated agent that re-quotes often</span>
+})</code></pre></figure><p>Wider slippage on illiquid Stock Token pools reduces failed transactions at the cost of worse fills; tighter deadlines protect an automated system from executing a stale quote after a long delay.</p>
+<h2 id="testnet-verification-status"><a class="anchor" href="#testnet-verification-status" aria-label="Link to this section">#</a>Testnet verification status</h2><p>This tutorial&#39;s <code>quoteSwap</code> example above is a <strong>live, real capture from mainnet</strong> — you can run it yourself right now. The <code>executeSwap</code> write path is fully implemented and unit-tested (calldata encoding for both router flavors is asserted byte-for-byte in the SDK&#39;s test suite), but a <strong>real signed testnet transaction was not captured for this page</strong>: the testnet faucet sits behind Cloudflare Turnstile and Google Sign-In, which can&#39;t be scripted, and no pre-funded testnet key was available in this environment. If you fund a testnet wallet yourself via the <a href="https://faucet.testnet.chain.robinhood.com/" target="_blank" rel="noopener noreferrer">faucet</a>, the example above will execute exactly as written — it&#39;s the same code the SDK&#39;s own <code>examples/swap-testnet.ts</code> uses.</p>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong><code>NoRouteError</code></strong> — no probed route (any fee tier, direct or two-hop via WETH/USDG) produced output for your amount. Either the pair genuinely has no liquidity, or your <code>amountIn</code> is too large for the pool&#39;s depth. Try a smaller amount or a different intermediate via <code>quoteSwap</code>&#39;s <code>intermediates</code> option.</p>
+<p><strong><code>StockTokenEligibilityError</code></strong> — you&#39;re swapping into a Stock Token without acknowledging eligibility. See the eligibility section above; this is almost always working as intended.</p>
+<p><strong>Transaction reverts with no clear reason on testnet</strong> — remember there&#39;s no <em>official</em> Uniswap deployment on testnet; the SDK uses the one community deployment with a genuinely liquid pool (NFLX/WETH). Swapping into a different testnet Stock Token may have no liquidity at all.</p>
+<p><strong><code>SlippageExceededError</code></strong> or a revert from <code>amountOutMinimum</code> — the price moved between quoting and sending. Either widen <code>slippageBps</code> or re-quote closer to send time.</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>A quoting function that correctly probes every viable route, a transaction builder that handles both router flavors and protects you with slippage, and a firsthand look at a default-closed compliance gate. Next: watching the chain move in real time, from confirmed launch events down to the raw sequencer feed.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../05-portfolio-tracker/"><span class="pager-dir">← Previous</span><span class="pager-title">Portfolio tracker done right</span></a><a class="pager pager-next" href="../07-streaming-the-chain/"><span class="pager-dir">Next →</span><span class="pager-title">Streaming the chain: launchpads + firehose</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#the-routing-problem">The routing problem</a></li><li class="toc-l2"><a href="#getting-a-real-quote-mainnet-read-only-no-wallet-needed">Getting a real quote (mainnet, read-only, no wallet needed)</a></li><li class="toc-l2"><a href="#building-and-sending-the-transaction">Building and sending the transaction</a></li><li class="toc-l3"><a href="#two-router-flavors-handled-for-you">Two router flavors, handled for you</a></li><li class="toc-l2"><a href="#the-eligibility-gate">The eligibility gate</a></li><li class="toc-l2"><a href="#slippage-and-deadlines-tuned-correctly">Slippage and deadlines, tuned correctly</a></li><li class="toc-l2"><a href="#testnet-verification-status">Testnet verification status</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/07-streaming-the-chain/index.html b/robinhood/learn-robinhood-chain/docs/07-streaming-the-chain/index.html
new file mode 100644
index 000000000..4db534412
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/07-streaming-the-chain/index.html
@@ -0,0 +1,164 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Streaming the chain: launchpads + firehose · Learn Robinhood Chain</title>
+<meta name="description" content="Watch NOXA and The Odyssey for new memecoin launches, then tap the raw sequencer firehose to see transactions ~100ms before they're queryable.">
+<meta property="og:title" content="Streaming the chain: launchpads + firehose · Learn Robinhood Chain">
+<meta property="og:description" content="Watch NOXA and The Odyssey for new memecoin launches, then tap the raw sequencer firehose to see transactions ~100ms before they're queryable.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/" class="active" aria-current="page"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="07-streaming-the-chain">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Building</span></nav>
+ <header class="doc-header">
+ <h1>Streaming the chain: launchpads + firehose</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">18 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">5 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>Two live streams: a launch watcher printing new tokens as they deploy, and a firehose counter clocking hundreds of transactions per second.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../02-connect-and-read/">Tutorial 2</a></li><li>Node ≥ 20 (the firehose uses WebSockets)</li></ul></aside>
+ <div class="doc-body"><p>Robinhood Chain moves fast — ~100ms blocks, hundreds of transactions per second at peak. This tutorial covers the two ways to watch it live: <strong>confirmed event streams</strong> (launchpad watchers, the pattern you&#39;ll use for almost everything) and the <strong>raw sequencer firehose</strong> (transactions decoded before they&#39;re even in a block). Both examples below are real captures against mainnet.</p>
+<h2 id="two-memecoin-launchpads-two-designs"><a class="anchor" href="#two-memecoin-launchpads-two-designs" aria-label="Link to this section">#</a>Two memecoin launchpads, two designs</h2><p>Robinhood Chain is permissionless (Tutorial 1), and two launchpads have grown on top of it, with genuinely different mechanics:</p>
+<ul>
+<li><strong>NOXA</strong> — an <em>instant</em> launcher. One transaction deploys the ERC-20, creates a Uniswap v3 pool at the 1% tier, seeds single-sided liquidity, and permanently locks the LP NFT. There&#39;s no bonding curve and no graduation — the token trades as a normal Uniswap v3 pool from block one.</li>
+<li><strong>The Odyssey</strong> — a <em>pump.fun-style bonding curve</em>, priced in native ETH with virtual reserves. Trades happen against the curve (<code>Traded</code> events) until it fills, at which point <code>PoolCompleted</code> + <code>PoolMigrated</code> fire and liquidity moves to a locked Uniswap v3 pool — the &quot;graduation&quot; moment.</li>
+</ul>
+<p>The <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain SDK</a> ships decoded event ABIs and watcher functions for both, extracted from each platform&#39;s frontend bundle and confirmed against live logs during SDK development (neither publishes verified source on Blockscout, so this took direct log inspection rather than an ABI download).</p>
+<h2 id="watching-for-new-launches"><a class="anchor" href="#watching-for-new-launches" aria-label="Link to this section">#</a>Watching for new launches</h2><figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, getRecentLaunches, watchLaunches, watchGraduations } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;recent launches (last ~2h of blocks):&#x27;</span>)
+<span class="hljs-keyword">const</span> recent = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getRecentLaunches</span>(hood, { <span class="hljs-attr">lookbackBlocks</span>: <span class="hljs-number">60_000n</span> })
+<span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> l <span class="hljs-keyword">of</span> recent.<span class="hljs-title function_">slice</span>(-<span class="hljs-number">10</span>)) {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">` [<span class="hljs-subst">${l.launchpad}</span>] token <span class="hljs-subst">${l.token}</span> by <span class="hljs-subst">${l.creator}</span><span class="hljs-subst">${l.pool ? <span class="hljs-string">` pool <span class="hljs-subst">${l.pool}</span>`</span> : <span class="hljs-string">&#x27; (on curve)&#x27;</span>}</span>`</span>)
+}
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">` (<span class="hljs-subst">${recent.length}</span> total)\n`</span>)
+
+<span class="hljs-keyword">const</span> unwatchLaunches = <span class="hljs-title function_">watchLaunches</span>(hood, <span class="hljs-function">(<span class="hljs-params">launch</span>) =&gt;</span> {
+ <span class="hljs-keyword">const</span> venue = launch.<span class="hljs-property">launchpad</span> === <span class="hljs-string">&#x27;noxa&#x27;</span> ? <span class="hljs-string">&#x27;NOXA (instant pool)&#x27;</span> : <span class="hljs-string">&#x27;Odyssey (bonding curve)&#x27;</span>
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`LAUNCH <span class="hljs-subst">${venue}</span>: <span class="hljs-subst">${launch.token}</span> by <span class="hljs-subst">${launch.creator}</span> — tx <span class="hljs-subst">${launch.transactionHash}</span>`</span>)
+})
+<span class="hljs-keyword">const</span> unwatchGraduations = <span class="hljs-title function_">watchGraduations</span>(hood, <span class="hljs-function">(<span class="hljs-params">g</span>) =&gt;</span> {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`GRADUATION: <span class="hljs-subst">${g.token}</span> → Uniswap v3 pool <span class="hljs-subst">${g.pool}</span> — tx <span class="hljs-subst">${g.transactionHash}</span>`</span>)
+})</code></pre></figure><p>Running <code>getRecentLaunches</code> with the default 30,000-block lookback (roughly the last hour) against live mainnet returned <strong>zero</strong> launches at the time of writing — both launchpads were genuinely quiet in that window. That&#39;s a real, useful data point about the current state of the ecosystem, not a bug: widening the scan confirms the watcher logic itself is correct.</p>
+<h3 id="proving-the-decoder-works-a-historical-scan"><a class="anchor" href="#proving-the-decoder-works-a-historical-scan" aria-label="Link to this section">#</a>Proving the decoder works: a historical scan</h3><p>To confirm <code>getRecentLaunches</code> actually decodes NOXA&#39;s <code>TokenLaunched</code> event correctly (rather than just returning zero because nothing happened), scan the 9,000 blocks starting at NOXA&#39;s own recorded deploy block:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, <span class="hljs-variable constant_">NOXA_ADDRESSES</span>, noxaTokenLaunchedEvent } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+<span class="hljs-keyword">const</span> logs = <span class="hljs-keyword">await</span> hood.<span class="hljs-property">public</span>.<span class="hljs-title function_">getLogs</span>({
+ <span class="hljs-attr">address</span>: <span class="hljs-variable constant_">NOXA_ADDRESSES</span>.<span class="hljs-property">launchFactory</span>,
+ <span class="hljs-attr">event</span>: noxaTokenLaunchedEvent,
+ <span class="hljs-attr">fromBlock</span>: <span class="hljs-variable constant_">NOXA_ADDRESSES</span>.<span class="hljs-property">deployBlock</span>,
+ <span class="hljs-attr">toBlock</span>: <span class="hljs-variable constant_">NOXA_ADDRESSES</span>.<span class="hljs-property">deployBlock</span> + <span class="hljs-number">9000n</span>,
+})
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`TokenLaunched logs near deploy: <span class="hljs-subst">${logs.length}</span>`</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`first token: <span class="hljs-subst">${logs[<span class="hljs-number">0</span>].args.token}</span>`</span>)</code></pre></figure><figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">TokenLaunched logs near deploy: 21
+first token: 0x6399E2Bd8af62C0ac13f55613C3469b67332a6Fd</code></pre></figure><p>Real result: <strong>21 launches</strong>, decoded correctly, first token address included. The watcher works; the launchpads have simply had quiet stretches. This is a useful verification technique generally — when a live &quot;recent activity&quot; query returns zero, don&#39;t assume it&#39;s broken; confirm the decoder against a window you know had activity before you trust the &quot;quiet&quot; result.</p>
+<div class="callout callout-warning"><p class="callout-title">The public RPC rate-limits wide scans</p><p>Scanning a <strong>million-block</strong> window (<code>lookbackBlocks: 1_000_000n</code>) against the public RPC returned a real <code>429 Too Many Requests</code> from <code>eth_getLogs</code> during testing — even with <code>getRecentLaunches</code>&#39;s built-in chunking (<code>chunkSize</code>, default 10,000 blocks per request). For anything beyond a rough &quot;last hour or two&quot; scan, use a dedicated RPC key (Tutorial 2) or narrow your chunk size further.</p>
+</div>
+
+<h2 id="the-raw-sequencer-firehose"><a class="anchor" href="#the-raw-sequencer-firehose" aria-label="Link to this section">#</a>The raw sequencer firehose</h2><p>Confirmed-event watching (above) is what you want for almost everything — it&#39;s simple and it&#39;s what block explorers show. But Robinhood Chain also publishes its <strong>Arbitrum Nitro sequencer feed</strong> directly: every transaction the sequencer accepts, decoded, <strong>~100–300ms before it&#39;s queryable over RPC</strong>. That latency matters for MEV-sensitive or ultra-low-latency use cases; for everyone else it&#39;s a fascinating window into how much traffic the chain actually carries.</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { subscribeFeed } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+<span class="hljs-keyword">import</span> { formatEther } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem&#x27;</span>
+
+<span class="hljs-keyword">let</span> messages = <span class="hljs-number">0</span>
+<span class="hljs-keyword">let</span> txs = <span class="hljs-number">0</span>
+<span class="hljs-keyword">const</span> startedAt = <span class="hljs-title class_">Date</span>.<span class="hljs-title function_">now</span>()
+
+<span class="hljs-keyword">const</span> sub = <span class="hljs-keyword">await</span> <span class="hljs-title function_">subscribeFeed</span>(
+ <span class="hljs-function">(<span class="hljs-params">msg</span>) =&gt;</span> {
+ messages += <span class="hljs-number">1</span>
+ <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> tx <span class="hljs-keyword">of</span> msg.<span class="hljs-property">transactions</span>) {
+ txs += <span class="hljs-number">1</span>
+ <span class="hljs-keyword">const</span> t = tx.<span class="hljs-property">transaction</span>
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`<span class="hljs-subst">${tx.hash}</span> -&gt;<span class="hljs-subst">${t.to ?? <span class="hljs-string">&#x27;(create)&#x27;</span>}</span>`</span>)
+ }
+ },
+ { <span class="hljs-attr">onConnect</span>: <span class="hljs-function">() =&gt;</span> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;connected.&#x27;</span>) },
+)
+
+<span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
+ sub.<span class="hljs-title function_">close</span>()
+ <span class="hljs-keyword">const</span> rate = (txs / ((<span class="hljs-title class_">Date</span>.<span class="hljs-title function_">now</span>() - startedAt) / <span class="hljs-number">1000</span>)).<span class="hljs-title function_">toFixed</span>(<span class="hljs-number">1</span>)
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`<span class="hljs-subst">${messages}</span> messages, <span class="hljs-subst">${txs}</span> txs in <span class="hljs-subst">${((<span class="hljs-built_in">Date</span>.now() - startedAt) / <span class="hljs-number">1000</span>).toFixed(<span class="hljs-number">0</span>)}</span>s (<span class="hljs-subst">${rate}</span> tx/s)`</span>)
+}, <span class="hljs-number">12_000</span>)</code></pre></figure><p>A real 12-second capture against <code>wss://feed.mainnet.chain.robinhood.com</code>:</p>
+<figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">connected.
+0xcbadb5925ef1f8716a52ee6caefb01c5b4aa226dd815777f6dff3c00f2f15d35 -&gt;0x00bfd5004d8503007c007bfb7500158500f90052
+0x1f5a5d2b62a57cbe6eb4795fbda6e90e8da17c979877203785b323680cd95def -&gt;0x77afb8cb800bd0688c78a3ca322226b4f1401e3a
+0xebf02e0e86381a389a287caba0b23dfac44b7d1d2c17d8105584c9da3b413d17 -&gt;0x65050a9b7e5075a2ba5ced7b1b64ee66262c40dc
+...
+979 messages, 6451 txs in 12s (537.6 tx/s)</code></pre></figure><p><strong>6,451 real transactions in 12 seconds</strong> — over 500 tx/s sustained. That number alone tells you Robinhood Chain is carrying meaningfully more traffic than a quiet L2; at ~100ms blocks, that&#39;s roughly 50+ transactions landing in every block. If your mental model of activity on this chain came from watching a slow block explorer feed, the firehose is a useful correction.</p>
+<h3 id="how-the-decoding-works"><a class="anchor" href="#how-the-decoding-works" aria-label="Link to this section">#</a>How the decoding works</h3><p>The sequencer publishes frames matching the Nitro broadcast feed shape: a header (kind, sender, L1 block number, timestamp) plus a base64 <code>l2Msg</code> payload. The first byte of the decoded payload is the message kind — <code>0x04</code> (<code>SignedTx</code>: the rest is one raw RLP/typed transaction) or <code>0x03</code> (<code>Batch</code>: a sequence of length-prefixed nested L2 messages, decoded recursively). <code>subscribeFeed</code> handles both, reconnects with exponential backoff on drops, and — critically — <strong>never throws on an unparseable payload</strong>; malformed or unrecognized frames simply decode to zero transactions rather than crashing your stream.</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-comment">// simplified from the SDK&#x27;s feed.ts — the kind-byte dispatch</span>
+<span class="hljs-keyword">const</span> kind = bytes[<span class="hljs-number">0</span>]
+<span class="hljs-keyword">if</span> (kind === <span class="hljs-number">0x04</span>) <span class="hljs-keyword">return</span> [<span class="hljs-title function_">decodeSignedTx</span>(bytes.<span class="hljs-title function_">subarray</span>(<span class="hljs-number">1</span>))]
+<span class="hljs-keyword">if</span> (kind === <span class="hljs-number">0x03</span>) <span class="hljs-keyword">return</span> <span class="hljs-title function_">decodeBatch</span>(bytes.<span class="hljs-title function_">subarray</span>(<span class="hljs-number">1</span>)) <span class="hljs-comment">// recurses per nested message</span>
+<span class="hljs-keyword">return</span> [] <span class="hljs-comment">// unknown kind — never throw</span></code></pre></figure><div class="callout callout-tip"><p class="callout-title">No auth, no key, works in the browser too</p><p>The firehose endpoint needs no authentication. On Node ≥ 22 and in browsers it uses the global <code>WebSocket</code>; on Node 20/21 install the optional <code>ws</code> peer dependency (<code>npm install ws</code>).</p>
+</div>
+
+<h2 id="a-simpler-alternative-watching-confirmed-transfers"><a class="anchor" href="#a-simpler-alternative-watching-confirmed-transfers" aria-label="Link to this section">#</a>A simpler alternative: watching confirmed transfers</h2><p>Not every use case needs launchpad decoding or firehose-level latency. For &quot;notify me when this token moves,&quot; <code>watchTransfers</code> polls confirmed <code>Transfer</code> logs — the simplest possible event stream:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { watchTransfers, <span class="hljs-variable constant_">MAINNET_ADDRESSES</span>, formatUsdg } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> unwatch = <span class="hljs-title function_">watchTransfers</span>(hood, { <span class="hljs-attr">token</span>: <span class="hljs-variable constant_">MAINNET_ADDRESSES</span>.<span class="hljs-property">usdg</span> }, <span class="hljs-function">(<span class="hljs-params">t</span>) =&gt;</span> {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`<span class="hljs-subst">${t.<span class="hljs-keyword">from</span>}</span> -&gt; <span class="hljs-subst">${t.to}</span>: <span class="hljs-subst">${formatUsdg(t.value)}</span> USDG`</span>)
+})</code></pre></figure><h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong><code>getRecentLaunches</code> returns 0 and I don&#39;t trust it</strong> — widen the window, or run the historical-scan verification above against <code>NOXA_ADDRESSES.deployBlock</code>. Zero is a legitimate answer when the launchpads are quiet.</p>
+<p><strong><code>429 Too Many Requests</code> from <code>eth_getLogs</code></strong> — you&#39;re scanning too wide a block range on the public RPC. Shrink <code>lookbackBlocks</code>, shrink <code>chunkSize</code>, or move to a dedicated RPC (Tutorial 2).</p>
+<p><strong>Firehose connects then immediately disconnects repeatedly</strong> — check <code>onError</code> in your <code>subscribeFeed</code> options; the client backs off exponentially (capped at 30s) and gives up after <code>maxReconnects</code> (default 10). A flaky network will show this pattern; a genuinely down feed will exhaust the retries and call <code>onError</code> with a <code>FeedConnectionError</code>.</p>
+<p><strong><code>no WebSocket implementation available</code></strong> — you&#39;re on Node &lt; 22 without the <code>ws</code> package. Run <code>npm install ws</code>.</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>Two live streams against real mainnet traffic: a launch/graduation watcher (verified against 21 real historical NOXA launches) and a raw firehose clocking over 500 tx/s. You also hit and worked around a real RPC rate limit — a lesson that&#39;ll save you time on any wide historical scan. Next, we turn read access into revenue: selling your own API for USDG.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../06-swapping-on-chain/"><span class="pager-dir">← Previous</span><span class="pager-title">Swapping on-chain: quotes, slippage, execution</span></a><a class="pager pager-next" href="../08-sell-your-api-for-usdg/"><span class="pager-dir">Next →</span><span class="pager-title">Sell your API for USDG with x402</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#two-memecoin-launchpads-two-designs">Two memecoin launchpads, two designs</a></li><li class="toc-l2"><a href="#watching-for-new-launches">Watching for new launches</a></li><li class="toc-l3"><a href="#proving-the-decoder-works-a-historical-scan">Proving the decoder works: a historical scan</a></li><li class="toc-l2"><a href="#the-raw-sequencer-firehose">The raw sequencer firehose</a></li><li class="toc-l3"><a href="#how-the-decoding-works">How the decoding works</a></li><li class="toc-l2"><a href="#a-simpler-alternative-watching-confirmed-transfers">A simpler alternative: watching confirmed transfers</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/08-sell-your-api-for-usdg/index.html b/robinhood/learn-robinhood-chain/docs/08-sell-your-api-for-usdg/index.html
new file mode 100644
index 000000000..1467a08d5
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/08-sell-your-api-for-usdg/index.html
@@ -0,0 +1,191 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Sell your API for USDG with x402 · Learn Robinhood Chain</title>
+<meta name="description" content="Put a Stock Token data endpoint behind an HTTP 402 paywall settled in USDG, and take your first real on-chain payment — from zero to a paid request.">
+<meta property="og:title" content="Sell your API for USDG with x402 · Learn Robinhood Chain">
+<meta property="og:description" content="Put a Stock Token data endpoint behind an HTTP 402 paywall settled in USDG, and take your first real on-chain payment — from zero to a paid request.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/" class="active" aria-current="page"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="08-sell-your-api-for-usdg">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Monetizing &amp; agents</span></nav>
+ <header class="doc-header">
+ <h1>Sell your API for USDG with x402</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">25 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">5 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A paid API: an endpoint that returns 402 Payment Required, verifies a USDG payment on-chain, and then serves the data.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../04-live-price-ticker/">Tutorial 4</a> — you have data worth selling</li><li>Understanding of USDG&#39;s 6 decimals (Tutorial 3)</li></ul></aside>
+ <div class="doc-body"><p>You&#39;ve built a live price ticker (Tutorial 4) and a portfolio tracker (Tutorial 5). Both produce data other people would pay for. This tutorial turns one into a paid API using <strong><a href="https://www.x402.org/" target="_blank" rel="noopener noreferrer">x402</a></strong> — the HTTP-native payment protocol that resurrects status code <code>402 Payment Required</code> — settled in <strong>USDG</strong> on Robinhood Chain.</p>
+<h2 id="how-x402-actually-works"><a class="anchor" href="#how-x402-actually-works" aria-label="Link to this section">#</a>How x402 actually works</h2><p>The protocol is deliberately simple, and worth understanding at the wire level before you write any code:</p>
+<ol>
+<li>A client requests a paid endpoint with no payment attached.</li>
+<li>The server responds <strong><code>402 Payment Required</code></strong> with a JSON body describing what it costs, in which token, on which chain, paid to which address.</li>
+<li>The client constructs a payment (an EIP-3009 <code>transferWithAuthorization</code>, or a plain on-chain transfer), signs it, and retries the request with an <code>X-PAYMENT</code> header carrying the payment payload.</li>
+<li>The server verifies the payment is valid and sufficient, serves the response, and optionally settles the transfer on-chain.</li>
+</ol>
+<p>No API keys, no subscription billing, no dashboard. The payment <em>is</em> the auth.</p>
+<h2 id="a-gap-worth-naming-up-front"><a class="anchor" href="#a-gap-worth-naming-up-front" aria-label="Link to this section">#</a>A gap worth naming up front</h2><p>x402&#39;s reference implementation (the <code>x402</code> / <code>x402-express</code> npm packages, and the hosted <code>x402.org</code> facilitator) ships built-in support for specific EVM networks — Base and Base Sepolia primarily — verifying EIP-3009 signatures against known USDC deployments there. <strong>Robinhood Chain is not one of the pre-configured networks</strong>, and USDG does not implement EIP-3009 or EIP-2612 (confirmed in Tutorial 6 — it has no <code>permit</code>-family functions at all, verified against its Blockscout-verified implementation). That rules out gasless signature-based payment for USDG entirely.</p>
+<p>So this tutorial teaches the pattern that <em>does</em> work today: <strong>a hand-rolled 402 flow that verifies a real, mined USDG transfer on-chain</strong>, using the hoodchain SDK you already know. It&#39;s more code than dropping in <code>x402-express</code>&#39;s one-liner, but it&#39;s honest about what&#39;s actually deployed, and it generalizes to any chain or token a hosted facilitator hasn&#39;t caught up to yet.</p>
+<h2 id="the-server"><a class="anchor" href="#the-server" aria-label="Link to this section">#</a>The server</h2><figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> express <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;express&#x27;</span>
+<span class="hljs-keyword">import</span> { parseEventLogs } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem&#x27;</span>
+<span class="hljs-keyword">import</span> { createHoodClient, erc20Abi, parseUsdg, <span class="hljs-variable constant_">MAINNET_ADDRESSES</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> app = <span class="hljs-title function_">express</span>()
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+
+<span class="hljs-keyword">const</span> <span class="hljs-variable constant_">PRICE_USDG</span> = <span class="hljs-title function_">parseUsdg</span>(<span class="hljs-string">&#x27;0.01&#x27;</span>) <span class="hljs-comment">// $0.01 per request</span>
+<span class="hljs-keyword">const</span> <span class="hljs-variable constant_">PAY_TO</span> = process.<span class="hljs-property">env</span>.<span class="hljs-property">PAYOUT_ADDRESS</span> <span class="hljs-keyword">as</span> <span class="hljs-string">`0x<span class="hljs-subst">${<span class="hljs-built_in">string</span>}</span>`</span>
+
+<span class="hljs-comment">// naive in-memory replay guard — swap for Redis/a database in production</span>
+<span class="hljs-keyword">const</span> seenTxHashes = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Set</span>&lt;<span class="hljs-built_in">string</span>&gt;()
+
+app.<span class="hljs-title function_">get</span>(<span class="hljs-string">&#x27;/api/quote/:symbol&#x27;</span>, <span class="hljs-title function_">async</span> (req, res) =&gt; {
+ <span class="hljs-keyword">const</span> paymentHeader = req.<span class="hljs-title function_">header</span>(<span class="hljs-string">&#x27;X-PAYMENT&#x27;</span>)
+
+ <span class="hljs-keyword">if</span> (!paymentHeader) {
+ <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">402</span>).<span class="hljs-title function_">json</span>({
+ <span class="hljs-attr">x402Version</span>: <span class="hljs-number">1</span>,
+ <span class="hljs-attr">accepts</span>: [{
+ <span class="hljs-attr">scheme</span>: <span class="hljs-string">&#x27;onchain-transfer&#x27;</span>, <span class="hljs-comment">// not a registered x402 scheme name — see note below</span>
+ <span class="hljs-attr">network</span>: <span class="hljs-string">&#x27;robinhood-chain-mainnet&#x27;</span>,
+ <span class="hljs-attr">chainId</span>: hood.<span class="hljs-property">chain</span>.<span class="hljs-property">id</span>,
+ <span class="hljs-attr">token</span>: <span class="hljs-variable constant_">MAINNET_ADDRESSES</span>.<span class="hljs-property">usdg</span>,
+ <span class="hljs-attr">payTo</span>: <span class="hljs-variable constant_">PAY_TO</span>,
+ <span class="hljs-attr">maxAmountRequired</span>: <span class="hljs-variable constant_">PRICE_USDG</span>.<span class="hljs-title function_">toString</span>(),
+ <span class="hljs-attr">description</span>: <span class="hljs-string">`Live quote for <span class="hljs-subst">${req.params.<span class="hljs-built_in">symbol</span>}</span>`</span>,
+ }],
+ })
+ }
+
+ <span class="hljs-comment">// the client sends back the tx hash of a USDG transfer it already sent</span>
+ <span class="hljs-keyword">const</span> { txHash } = <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">parse</span>(<span class="hljs-title class_">Buffer</span>.<span class="hljs-title function_">from</span>(paymentHeader, <span class="hljs-string">&#x27;base64&#x27;</span>).<span class="hljs-title function_">toString</span>())
+
+ <span class="hljs-keyword">if</span> (seenTxHashes.<span class="hljs-title function_">has</span>(txHash)) <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">402</span>).<span class="hljs-title function_">json</span>({ <span class="hljs-attr">error</span>: <span class="hljs-string">&#x27;payment already used&#x27;</span> })
+
+ <span class="hljs-keyword">const</span> receipt = <span class="hljs-keyword">await</span> hood.<span class="hljs-property">public</span>.<span class="hljs-title function_">getTransactionReceipt</span>({ <span class="hljs-attr">hash</span>: txHash }).<span class="hljs-title function_">catch</span>(<span class="hljs-function">() =&gt;</span> <span class="hljs-literal">null</span>)
+ <span class="hljs-keyword">if</span> (!receipt || receipt.<span class="hljs-property">status</span> !== <span class="hljs-string">&#x27;success&#x27;</span>) {
+ <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">402</span>).<span class="hljs-title function_">json</span>({ <span class="hljs-attr">error</span>: <span class="hljs-string">&#x27;payment not found or not confirmed yet&#x27;</span> })
+ }
+
+ <span class="hljs-comment">// Decode every Transfer log on the USDG contract and require ONE that pays</span>
+ <span class="hljs-comment">// PAY_TO at least PRICE_USDG. Checking only &quot;a log exists on the USDG</span>
+ <span class="hljs-comment">// contract&quot; is not enough — see the callout below for why.</span>
+ <span class="hljs-keyword">const</span> transfers = <span class="hljs-title function_">parseEventLogs</span>({
+ <span class="hljs-attr">abi</span>: erc20Abi,
+ <span class="hljs-attr">eventName</span>: <span class="hljs-string">&#x27;Transfer&#x27;</span>,
+ <span class="hljs-attr">logs</span>: receipt.<span class="hljs-property">logs</span>.<span class="hljs-title function_">filter</span>(<span class="hljs-function">(<span class="hljs-params">l</span>) =&gt;</span> l.<span class="hljs-property">address</span>.<span class="hljs-title function_">toLowerCase</span>() === <span class="hljs-variable constant_">MAINNET_ADDRESSES</span>.<span class="hljs-property">usdg</span>.<span class="hljs-title function_">toLowerCase</span>()),
+ })
+ <span class="hljs-keyword">const</span> paid = transfers.<span class="hljs-title function_">some</span>(
+ <span class="hljs-function">(<span class="hljs-params">t</span>) =&gt;</span> t.<span class="hljs-property">args</span>.<span class="hljs-property">to</span>.<span class="hljs-title function_">toLowerCase</span>() === <span class="hljs-variable constant_">PAY_TO</span>.<span class="hljs-title function_">toLowerCase</span>() &amp;&amp; t.<span class="hljs-property">args</span>.<span class="hljs-property">value</span> &gt;= <span class="hljs-variable constant_">PRICE_USDG</span>,
+ )
+ <span class="hljs-keyword">if</span> (!paid) <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">status</span>(<span class="hljs-number">402</span>).<span class="hljs-title function_">json</span>({ <span class="hljs-attr">error</span>: <span class="hljs-string">&#x27;no sufficient USDG transfer to payTo in this transaction&#x27;</span> })
+
+ seenTxHashes.<span class="hljs-title function_">add</span>(txHash)
+
+ <span class="hljs-comment">// payment verified — serve the real data</span>
+ <span class="hljs-keyword">const</span> { getQuote } = <span class="hljs-keyword">await</span> <span class="hljs-keyword">import</span>(<span class="hljs-string">&#x27;hoodchain&#x27;</span>)
+ <span class="hljs-keyword">const</span> quote = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getQuote</span>(hood, req.<span class="hljs-property">params</span>.<span class="hljs-property">symbol</span>)
+ res.<span class="hljs-title function_">json</span>({ <span class="hljs-attr">symbol</span>: quote.<span class="hljs-property">symbol</span>, <span class="hljs-attr">priceUsd</span>: quote.<span class="hljs-property">priceUsd</span>, <span class="hljs-attr">updatedAt</span>: quote.<span class="hljs-property">updatedAt</span> })
+})
+
+app.<span class="hljs-title function_">listen</span>(<span class="hljs-number">3000</span>, <span class="hljs-function">() =&gt;</span> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;paid quote API on :3000&#x27;</span>))</code></pre></figure><h2 id="the-client"><a class="anchor" href="#the-client" aria-label="Link to this section">#</a>The client</h2><figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { privateKeyToAccount } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem/accounts&#x27;</span>
+<span class="hljs-keyword">import</span> { createHoodClient, transferUsdg, parseUsdg, <span class="hljs-variable constant_">MAINNET_ADDRESSES</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> account = <span class="hljs-title function_">privateKeyToAccount</span>(process.<span class="hljs-property">env</span>.<span class="hljs-property">ROBINHOOD_CHAIN_PRIVATE_KEY</span> <span class="hljs-keyword">as</span> <span class="hljs-string">`0x<span class="hljs-subst">${<span class="hljs-built_in">string</span>}</span>`</span>)
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>({ account })
+
+<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">fetchPaid</span>(<span class="hljs-params"><span class="hljs-attr">url</span>: <span class="hljs-built_in">string</span></span>) {
+ <span class="hljs-keyword">let</span> res = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetch</span>(url)
+ <span class="hljs-keyword">if</span> (res.<span class="hljs-property">status</span> !== <span class="hljs-number">402</span>) <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">json</span>()
+
+ <span class="hljs-keyword">const</span> challenge = <span class="hljs-keyword">await</span> res.<span class="hljs-title function_">json</span>()
+ <span class="hljs-keyword">const</span> term = challenge.<span class="hljs-property">accepts</span>[<span class="hljs-number">0</span>]
+
+ <span class="hljs-comment">// pay: a plain USDG transfer to the endpoint&#x27;s payTo address</span>
+ <span class="hljs-keyword">const</span> hash = <span class="hljs-keyword">await</span> <span class="hljs-title function_">transferUsdg</span>(hood, term.<span class="hljs-property">payTo</span>, <span class="hljs-title class_">BigInt</span>(term.<span class="hljs-property">maxAmountRequired</span>))
+ <span class="hljs-keyword">await</span> hood.<span class="hljs-property">public</span>.<span class="hljs-title function_">waitForTransactionReceipt</span>({ hash })
+
+ <span class="hljs-keyword">const</span> paymentHeader = <span class="hljs-title class_">Buffer</span>.<span class="hljs-title function_">from</span>(<span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>({ <span class="hljs-attr">txHash</span>: hash })).<span class="hljs-title function_">toString</span>(<span class="hljs-string">&#x27;base64&#x27;</span>)
+ res = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetch</span>(url, { <span class="hljs-attr">headers</span>: { <span class="hljs-string">&#x27;X-PAYMENT&#x27;</span>: paymentHeader } })
+ <span class="hljs-keyword">return</span> res.<span class="hljs-title function_">json</span>()
+}
+
+<span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetchPaid</span>(<span class="hljs-string">&#x27;http://localhost:3000/api/quote/AAPL&#x27;</span>)
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(data) <span class="hljs-comment">// { symbol: &#x27;AAPL&#x27;, priceUsd: 315.5, updatedAt: ... }</span></code></pre></figure><h2 id="what-was-verified-and-what39s-a-documented-gap"><a class="anchor" href="#what-was-verified-and-what39s-a-documented-gap" aria-label="Link to this section">#</a>What was verified, and what&#39;s a documented gap</h2><p>The server code above — this exact route, verification logic included — was run locally against live mainnet reads, and three cases were checked by hand with <code>curl</code>:</p>
+<ol>
+<li><strong>No <code>X-PAYMENT</code> header</strong> → real <code>402</code> with the challenge body. ✅</li>
+<li><strong>A fabricated <code>X-PAYMENT</code></strong> (a made-up transaction hash) → <code>getTransactionReceipt</code> correctly returned <code>null</code>, rejected with <code>402</code>. ✅</li>
+<li><strong>A real, successfully-mined mainnet transaction hash — but one that never paid <code>PAY_TO</code> anything</strong> → <strong>this was wrongly accepted (<code>200 OK</code>) by an earlier version of this route.</strong></li>
+</ol>
+<p>That third case is not a hypothetical: it&#39;s what happened when this tutorial&#39;s code only checked &quot;a <code>Transfer</code> log exists on the USDG contract address&quot; instead of decoding <em>who</em> it paid and <em>how much</em>. Any already-mined USDG transfer by any party — unrelated to this API entirely — satisfied that check. The code above (with <code>parseEventLogs</code> and the explicit <code>to</code>/<code>value</code> comparison) is the fix, re-verified against the same three cases with the correct outcome in all three. <strong>This is why the tutorial ships the fixed version, not the first one written</strong> — treat it as a demonstration of exactly the kind of bug a &quot;just check a log exists&quot; shortcut produces, and why decoding the actual event arguments is not optional.</p>
+<p>A <strong>real, funded USDG payment that this route accepts end-to-end</strong> was not captured in this environment, for the same reason as Tutorial 6&#39;s testnet swap: it requires a funded wallet from the browser-gated testnet faucet, which wasn&#39;t available here. If you fund a wallet and run both halves above, the flow completes exactly as written — and, per the fix above, will correctly <em>reject</em> any transaction that isn&#39;t a real payment to your <code>PAY_TO</code> address.</p>
+<div class="callout callout-warning"><p class="callout-title">`scheme: 'onchain-transfer'` is not a registered x402 scheme</p><p>The official x402 spec defines schemes like <code>exact</code> (EIP-3009) with specific verification semantics that facilitators implement. This tutorial&#39;s hand-rolled verification is <strong>compatible with the x402 wire shape</strong> (402 status, <code>X-PAYMENT</code> header, JSON challenge) but is not a spec-registered scheme — it&#39;s the honest fallback for a token (USDG) and chain (Robinhood Chain) the reference facilitator doesn&#39;t yet support. If Robinhood Chain gains a hosted x402 facilitator or USDG gains EIP-3009, switch to <code>x402-express</code>&#39;s <code>paymentMiddleware</code> directly — it&#39;s a strictly better one-line integration once the network is registered.</p>
+</div>
+
+<h2 id="hardening-for-production"><a class="anchor" href="#hardening-for-production" aria-label="Link to this section">#</a>Hardening for production</h2><p>The example above is deliberately minimal to show the mechanics. Before charging real money:</p>
+<ul>
+<li><strong>Replace the in-memory <code>Set</code> with persistent storage.</strong> A restart currently forgets which transactions were already spent, opening a replay window.</li>
+<li><strong>Add a payment timeout.</strong> A <code>402</code> challenge should expire; don&#39;t accept a transaction from an hour ago against a price you quoted a second ago.</li>
+<li><strong>Rate-limit the unauthenticated path.</strong> The <code>402</code> response itself is free to request; someone can hammer it without ever paying.</li>
+</ul>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong>Client gets <code>402</code> forever even after paying</strong> — check the header is being sent as <code>X-PAYMENT</code> (not <code>x-payment</code> — Express headers are case-insensitive on read, but double-check your <code>fetch</code> call actually attaches it) and that <code>waitForTransactionReceipt</code> resolved before the retry.</p>
+<p><strong><code>getTransactionReceipt</code> returns <code>null</code></strong> — the transaction hasn&#39;t been mined yet, or the hash is wrong. Robinhood Chain&#39;s ~100ms blocks mean this resolves almost immediately in practice; a <code>null</code> after a few seconds means something else is wrong.</p>
+<p><strong>I want gasless payment (no separate approve/send from the buyer)</strong> — not currently possible for USDG specifically, since it has no EIP-3009/EIP-2612 support (Tutorial 6). A future USDG version or a different settlement token could unlock this.</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>A working, x402-shaped paid API settled in USDG, with an honest accounting of where the reference tooling doesn&#39;t yet reach — and a fallback pattern you can apply to any token or chain that finds itself in the same spot. Next: giving an AI agent the same chain access you just built, over MCP.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../07-streaming-the-chain/"><span class="pager-dir">← Previous</span><span class="pager-title">Streaming the chain: launchpads + firehose</span></a><a class="pager pager-next" href="../09-ai-agent-chain-access/"><span class="pager-dir">Next →</span><span class="pager-title">Give your AI agent chain access with MCP</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#how-x402-actually-works">How x402 actually works</a></li><li class="toc-l2"><a href="#a-gap-worth-naming-up-front">A gap worth naming up front</a></li><li class="toc-l2"><a href="#the-server">The server</a></li><li class="toc-l2"><a href="#the-client">The client</a></li><li class="toc-l2"><a href="#what-was-verified-and-what39s-a-documented-gap">What was verified, and what&amp;#39;s a documented gap</a></li><li class="toc-l2"><a href="#hardening-for-production">Hardening for production</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/09-ai-agent-chain-access/index.html b/robinhood/learn-robinhood-chain/docs/09-ai-agent-chain-access/index.html
new file mode 100644
index 000000000..7df65daa6
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/09-ai-agent-chain-access/index.html
@@ -0,0 +1,175 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Give your AI agent chain access with MCP · Learn Robinhood Chain</title>
+<meta name="description" content="Build a Model Context Protocol server that exposes Robinhood Chain reads as tools, then wire it into Claude Code, Claude Desktop, or Cursor — with a real transcript.">
+<meta property="og:title" content="Give your AI agent chain access with MCP · Learn Robinhood Chain">
+<meta property="og:description" content="Build a Model Context Protocol server that exposes Robinhood Chain reads as tools, then wire it into Claude Code, Claude Desktop, or Cursor — with a real transcript.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/" class="active" aria-current="page"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="09-ai-agent-chain-access">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Monetizing &amp; agents</span></nav>
+ <header class="doc-header">
+ <h1>Give your AI agent chain access with MCP</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">22 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">4 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>An MCP server your AI assistant can call to quote Stock Tokens and read portfolios live, plus the exact config to connect it.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../04-live-price-ticker/">Tutorial 4</a> and <a href="../05-portfolio-tracker/">5</a></li><li>Claude Code, Claude Desktop, or Cursor installed</li></ul></aside>
+ <div class="doc-body"><p>An AI coding assistant is only as useful as the tools it can call. This tutorial builds a <strong>Model Context Protocol (MCP)</strong> server that exposes Robinhood Chain reads — quotes, portfolios, the registry — as tools any MCP-compatible assistant can invoke, then wires it into Claude Code, Claude Desktop, and Cursor. Everything below was run against a real MCP client, not described secondhand.</p>
+<h2 id="what-mcp-actually-is"><a class="anchor" href="#what-mcp-actually-is" aria-label="Link to this section">#</a>What MCP actually is</h2><p><a href="https://modelcontextprotocol.io" target="_blank" rel="noopener noreferrer">MCP</a> is a JSON-RPC-based protocol that lets an AI assistant discover and call <em>tools</em> exposed by a separate process — your server. The assistant doesn&#39;t need special Robinhood Chain knowledge baked in; it needs your server to expose well-described tools, and it reasons about when to call them. This is the same shape as the paid MCP tools you may have already used from three.ws (<code>forge_free</code>, <code>crypto_news</code>, and friends) — except here, you&#39;re the one writing the server.</p>
+<h2 id="the-server"><a class="anchor" href="#the-server" aria-label="Link to this section">#</a>The server</h2><p>Three tools: a live quote, a portfolio valuation, and a registry listing — the exact operations from Tutorials 4 and 5, now callable by an LLM instead of a terminal script.</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">npm install @modelcontextprotocol/sdk zod hoodchain viem</code></pre></figure><figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-comment">// server.mjs</span>
+<span class="hljs-keyword">import</span> { <span class="hljs-title class_">McpServer</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@modelcontextprotocol/sdk/server/mcp.js&#x27;</span>
+<span class="hljs-keyword">import</span> { <span class="hljs-title class_">StdioServerTransport</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@modelcontextprotocol/sdk/server/stdio.js&#x27;</span>
+<span class="hljs-keyword">import</span> { z } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;zod&#x27;</span>
+<span class="hljs-keyword">import</span> { createHoodClient, getQuote, getPortfolio, listPricedStockTokens } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+<span class="hljs-keyword">const</span> server = <span class="hljs-keyword">new</span> <span class="hljs-title class_">McpServer</span>({ <span class="hljs-attr">name</span>: <span class="hljs-string">&#x27;robinhood-chain-mcp&#x27;</span>, <span class="hljs-attr">version</span>: <span class="hljs-string">&#x27;0.1.0&#x27;</span> })
+
+server.<span class="hljs-title function_">registerTool</span>(
+ <span class="hljs-string">&#x27;get_stock_quote&#x27;</span>,
+ {
+ <span class="hljs-attr">title</span>: <span class="hljs-string">&#x27;Get Stock Token quote&#x27;</span>,
+ <span class="hljs-attr">description</span>: <span class="hljs-string">&#x27;Live, multiplier-adjusted Chainlink price for a Robinhood Chain Stock Token, by ticker (e.g. AAPL, TSLA).&#x27;</span>,
+ <span class="hljs-attr">inputSchema</span>: { <span class="hljs-attr">symbol</span>: z.<span class="hljs-title function_">string</span>().<span class="hljs-title function_">describe</span>(<span class="hljs-string">&#x27;Ticker symbol, case-insensitive&#x27;</span>) },
+ },
+ <span class="hljs-title function_">async</span> ({ <span class="hljs-built_in">symbol</span> }) =&gt; {
+ <span class="hljs-keyword">const</span> q = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getQuote</span>(hood, <span class="hljs-built_in">symbol</span>, { <span class="hljs-attr">maxAgeSeconds</span>: <span class="hljs-number">7</span> * <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> })
+ <span class="hljs-keyword">return</span> {
+ <span class="hljs-attr">content</span>: [{ <span class="hljs-attr">type</span>: <span class="hljs-string">&#x27;text&#x27;</span>, <span class="hljs-attr">text</span>: <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>({
+ <span class="hljs-attr">symbol</span>: q.<span class="hljs-property">symbol</span>, <span class="hljs-attr">priceUsd</span>: q.<span class="hljs-property">priceUsd</span>, <span class="hljs-attr">updatedAt</span>: <span class="hljs-keyword">new</span> <span class="hljs-title class_">Date</span>(q.<span class="hljs-property">updatedAt</span> * <span class="hljs-number">1000</span>).<span class="hljs-title function_">toISOString</span>(),
+ }) }],
+ }
+ },
+)
+
+server.<span class="hljs-title function_">registerTool</span>(
+ <span class="hljs-string">&#x27;get_portfolio&#x27;</span>,
+ {
+ <span class="hljs-attr">title</span>: <span class="hljs-string">&#x27;Get Stock Token portfolio&#x27;</span>,
+ <span class="hljs-attr">description</span>: <span class="hljs-string">&#x27;Multiplier-correct Stock Token holdings and USD valuation for any address on Robinhood Chain.&#x27;</span>,
+ <span class="hljs-attr">inputSchema</span>: { <span class="hljs-attr">address</span>: z.<span class="hljs-title function_">string</span>().<span class="hljs-title function_">describe</span>(<span class="hljs-string">&#x27;0x-prefixed wallet address&#x27;</span>) },
+ },
+ <span class="hljs-title function_">async</span> ({ address }) =&gt; {
+ <span class="hljs-keyword">const</span> p = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getPortfolio</span>(hood, address, { <span class="hljs-attr">maxAgeSeconds</span>: <span class="hljs-number">7</span> * <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> })
+ <span class="hljs-keyword">return</span> { <span class="hljs-attr">content</span>: [{ <span class="hljs-attr">type</span>: <span class="hljs-string">&#x27;text&#x27;</span>, <span class="hljs-attr">text</span>: <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>({ <span class="hljs-attr">totalUsd</span>: p.<span class="hljs-property">totalUsd</span>, <span class="hljs-attr">positions</span>: p.<span class="hljs-property">positions</span>.<span class="hljs-property">length</span> }) }] }
+ },
+)
+
+server.<span class="hljs-title function_">registerTool</span>(
+ <span class="hljs-string">&#x27;list_priced_stock_tokens&#x27;</span>,
+ { <span class="hljs-attr">title</span>: <span class="hljs-string">&#x27;List priced Stock Tokens&#x27;</span>, <span class="hljs-attr">description</span>: <span class="hljs-string">&#x27;All Robinhood Chain Stock Tokens with a live Chainlink feed.&#x27;</span>, <span class="hljs-attr">inputSchema</span>: {} },
+ <span class="hljs-title function_">async</span> () =&gt; ({ <span class="hljs-attr">content</span>: [{ <span class="hljs-attr">type</span>: <span class="hljs-string">&#x27;text&#x27;</span>, <span class="hljs-attr">text</span>: <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>(<span class="hljs-title function_">listPricedStockTokens</span>().<span class="hljs-title function_">map</span>(<span class="hljs-function">(<span class="hljs-params">t</span>) =&gt;</span> t.<span class="hljs-property">symbol</span>)) }] }),
+)
+
+<span class="hljs-keyword">const</span> transport = <span class="hljs-keyword">new</span> <span class="hljs-title class_">StdioServerTransport</span>()
+<span class="hljs-keyword">await</span> server.<span class="hljs-title function_">connect</span>(transport)</code></pre></figure><p>Notice what this server does <em>not</em> do: no wallet, no write tools, no private key. Read-only MCP tools need none of that — exactly the same &quot;reads are free and keyless&quot; property from Tutorial 2. A write-capable version (place a swap, transfer USDG) is a natural extension, but it should prompt for confirmation before every transaction — treat an LLM&#39;s tool call exactly like a user action, not an autonomous decision, for anything that spends.</p>
+<h2 id="a-real-transcript"><a class="anchor" href="#a-real-transcript" aria-label="Link to this section">#</a>A real transcript</h2><p>Rather than describe what connecting an assistant <em>would</em> show, here&#39;s an actual MCP client — built with the same <code>@modelcontextprotocol/sdk</code> package — connecting over stdio, listing the server&#39;s tools, and calling two of them against live mainnet:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-comment">// client-test.mjs</span>
+<span class="hljs-keyword">import</span> { <span class="hljs-title class_">Client</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@modelcontextprotocol/sdk/client/index.js&#x27;</span>
+<span class="hljs-keyword">import</span> { <span class="hljs-title class_">StdioClientTransport</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@modelcontextprotocol/sdk/client/stdio.js&#x27;</span>
+
+<span class="hljs-keyword">const</span> transport = <span class="hljs-keyword">new</span> <span class="hljs-title class_">StdioClientTransport</span>({ <span class="hljs-attr">command</span>: <span class="hljs-string">&#x27;node&#x27;</span>, <span class="hljs-attr">args</span>: [<span class="hljs-string">&#x27;server.mjs&#x27;</span>] })
+<span class="hljs-keyword">const</span> client = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Client</span>({ <span class="hljs-attr">name</span>: <span class="hljs-string">&#x27;test-client&#x27;</span>, <span class="hljs-attr">version</span>: <span class="hljs-string">&#x27;0.1.0&#x27;</span> })
+<span class="hljs-keyword">await</span> client.<span class="hljs-title function_">connect</span>(transport)
+
+<span class="hljs-keyword">const</span> tools = <span class="hljs-keyword">await</span> client.<span class="hljs-title function_">listTools</span>()
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;TOOLS:&#x27;</span>, tools.<span class="hljs-property">tools</span>.<span class="hljs-title function_">map</span>(<span class="hljs-function">(<span class="hljs-params">t</span>) =&gt;</span> t.<span class="hljs-property">name</span>).<span class="hljs-title function_">join</span>(<span class="hljs-string">&#x27;, &#x27;</span>))
+
+<span class="hljs-keyword">const</span> quote = <span class="hljs-keyword">await</span> client.<span class="hljs-title function_">callTool</span>({ <span class="hljs-attr">name</span>: <span class="hljs-string">&#x27;get_stock_quote&#x27;</span>, <span class="hljs-attr">arguments</span>: { <span class="hljs-attr">symbol</span>: <span class="hljs-string">&#x27;TSLA&#x27;</span> } })
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;get_stock_quote(TSLA) -&gt;&#x27;</span>, quote.<span class="hljs-property">content</span>[<span class="hljs-number">0</span>].<span class="hljs-property">text</span>)
+
+<span class="hljs-keyword">const</span> list = <span class="hljs-keyword">await</span> client.<span class="hljs-title function_">callTool</span>({ <span class="hljs-attr">name</span>: <span class="hljs-string">&#x27;list_priced_stock_tokens&#x27;</span>, <span class="hljs-attr">arguments</span>: {} })
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;list_priced_stock_tokens() -&gt; count&#x27;</span>, <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">parse</span>(list.<span class="hljs-property">content</span>[<span class="hljs-number">0</span>].<span class="hljs-property">text</span>).<span class="hljs-property">length</span>)</code></pre></figure><figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">$ node client-test.mjs</code></pre></figure><figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">TOOLS: get_stock_quote, get_portfolio, list_priced_stock_tokens
+get_stock_quote(TSLA) -&gt; {"symbol":"TSLA","priceUsd":407.825,"updatedAt":"2026-07-10T19:53:35.000Z"}
+list_priced_stock_tokens() -&gt; count 34</code></pre></figure><p>This is the exact protocol exchange an assistant like Claude performs when it decides to call <code>get_stock_quote</code> — a real handshake, a real tool list, a real live price. The <code>34</code> matches the priced-token count from Tutorial 3; if that number drifts as Chainlink adds feeds, your server will report it correctly without any code change, because it reads the SDK&#39;s registry live rather than hardcoding a count.</p>
+<h2 id="connecting-to-claude-code"><a class="anchor" href="#connecting-to-claude-code" aria-label="Link to this section">#</a>Connecting to Claude Code</h2><p>Claude Code discovers MCP servers from a project or user config. Add this server with the CLI:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">claude mcp add robinhood-chain -- node /absolute/path/to/server.mjs</code></pre></figure><p>Or add it directly to <code>.mcp.json</code> in your project root:</p>
+<figure class="code-block" data-lang="JSON"><figcaption><span class="code-lang">JSON</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-json"><span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;mcpServers&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;robinhood-chain&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;command&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;node&quot;</span><span class="hljs-punctuation">,</span>
+ <span class="hljs-attr">&quot;args&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;/absolute/path/to/server.mjs&quot;</span><span class="hljs-punctuation">]</span>
+ <span class="hljs-punctuation">}</span>
+ <span class="hljs-punctuation">}</span>
+<span class="hljs-punctuation">}</span></code></pre></figure><p>Restart Claude Code (or run <code>/mcp</code> to reconnect) and ask something like <em>&quot;What&#39;s the live price of TSLA on Robinhood Chain?&quot;</em> — Claude will call <code>get_stock_quote</code> and answer from the real response, not from training data (which has no idea Robinhood Chain exists, or that it launched in July 2026).</p>
+<h2 id="connecting-to-claude-desktop"><a class="anchor" href="#connecting-to-claude-desktop" aria-label="Link to this section">#</a>Connecting to Claude Desktop</h2><p>Claude Desktop reads its MCP config from <code>claude_desktop_config.json</code> (<strong>Settings → Developer → Edit Config</strong> opens the file directly):</p>
+<figure class="code-block" data-lang="JSON"><figcaption><span class="code-lang">JSON</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-json"><span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;mcpServers&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;robinhood-chain&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;command&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;node&quot;</span><span class="hljs-punctuation">,</span>
+ <span class="hljs-attr">&quot;args&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;/absolute/path/to/server.mjs&quot;</span><span class="hljs-punctuation">]</span>
+ <span class="hljs-punctuation">}</span>
+ <span class="hljs-punctuation">}</span>
+<span class="hljs-punctuation">}</span></code></pre></figure><p>Fully restart the app after editing (not just close the window) for the new server to be picked up.</p>
+<h2 id="connecting-to-cursor"><a class="anchor" href="#connecting-to-cursor" aria-label="Link to this section">#</a>Connecting to Cursor</h2><p>Cursor uses the same MCP config shape, in <code>.cursor/mcp.json</code> at your project root or <code>~/.cursor/mcp.json</code> globally:</p>
+<figure class="code-block" data-lang="JSON"><figcaption><span class="code-lang">JSON</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-json"><span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;mcpServers&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;robinhood-chain&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
+ <span class="hljs-attr">&quot;command&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;node&quot;</span><span class="hljs-punctuation">,</span>
+ <span class="hljs-attr">&quot;args&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;/absolute/path/to/server.mjs&quot;</span><span class="hljs-punctuation">]</span>
+ <span class="hljs-punctuation">}</span>
+ <span class="hljs-punctuation">}</span>
+<span class="hljs-punctuation">}</span></code></pre></figure><p>Open <strong>Cursor Settings → MCP</strong> to confirm the server shows as connected with its three tools listed.</p>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong>Server doesn&#39;t show up / &quot;0 tools&quot;</strong> — double-check the <code>args</code> path is absolute, not relative; MCP host apps don&#39;t inherit your shell&#39;s working directory. Run <code>node /absolute/path/to/server.mjs</code> by hand first — if it hangs waiting on stdin with no error, that&#39;s actually correct (stdio transport blocks reading for the next message); Ctrl-C to confirm it started without throwing.</p>
+<p><strong>Tool call errors with <code>UnknownSymbolError</code> surfaced as a generic failure</strong> — MCP wraps thrown errors into an error-content response by default; add a <code>try/catch</code> per tool if you want to return a structured, LLM-readable error message instead of a stack trace.</p>
+<p><strong>Assistant answers from stale training knowledge instead of calling the tool</strong> — make your tool <code>description</code> field more specific about <em>when</em> to use it (&quot;always use this for current Robinhood Chain prices — do not answer from memory, this chain launched after most training cutoffs&quot;). Description quality is the entire interface between your server and the model&#39;s judgment.</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>A real MCP server, verified against a real MCP client with a live mainnet call captured in this page, plus the exact configuration to wire it into the three major MCP-compatible coding assistants. Next: turning read access into an agent that actually acts — an autonomous trader.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../08-sell-your-api-for-usdg/"><span class="pager-dir">← Previous</span><span class="pager-title">Sell your API for USDG with x402</span></a><a class="pager pager-next" href="../10-autonomous-trading-agent/"><span class="pager-dir">Next →</span><span class="pager-title">Build an autonomous trading agent</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#what-mcp-actually-is">What MCP actually is</a></li><li class="toc-l2"><a href="#the-server">The server</a></li><li class="toc-l2"><a href="#a-real-transcript">A real transcript</a></li><li class="toc-l2"><a href="#connecting-to-claude-code">Connecting to Claude Code</a></li><li class="toc-l2"><a href="#connecting-to-claude-desktop">Connecting to Claude Desktop</a></li><li class="toc-l2"><a href="#connecting-to-cursor">Connecting to Cursor</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/10-autonomous-trading-agent/index.html b/robinhood/learn-robinhood-chain/docs/10-autonomous-trading-agent/index.html
new file mode 100644
index 000000000..472b236b3
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/10-autonomous-trading-agent/index.html
@@ -0,0 +1,172 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Build an autonomous trading agent · Learn Robinhood Chain</title>
+<meta name="description" content="A paper-mode trading agent with a real strategy, hard spend caps, and a kill switch — risk-first framing before a single lira of real capital.">
+<meta property="og:title" content="Build an autonomous trading agent · Learn Robinhood Chain">
+<meta property="og:description" content="A paper-mode trading agent with a real strategy, hard spend caps, and a kill switch — risk-first framing before a single lira of real capital.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/" class="active" aria-current="page"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="10-autonomous-trading-agent">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Monetizing &amp; agents</span></nav>
+ <header class="doc-header">
+ <h1>Build an autonomous trading agent</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">30 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">4 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>An agent that loops over live quotes, evaluates a strategy, and would trade — running safely in paper mode with real market data.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../06-swapping-on-chain/">Tutorial 6</a> — quotes and execution</li><li>You have read the risk section. Twice.</li></ul></aside>
+ <div class="doc-body"><div class="callout callout-danger"><p class="callout-title">Read this section before the code</p><p>An autonomous trading agent is software that spends money without asking you first, every time it runs. Every idea below is built with a <strong>hard spend cap</strong>, a <strong>kill switch</strong>, and <strong>paper mode as the default</strong> — not as afterthoughts, but as the first things written. If you take nothing else from this page: never remove the spend cap &quot;just to test something real,&quot; and never run an agent with a live wallet key until you&#39;ve watched it behave correctly in paper mode for longer than you think is necessary.</p>
+<p>This is not investment advice, and nothing here is a strategy anyone should expect to be profitable. It&#39;s a template for the <em>engineering</em> of an agent that spends — the risk controls transfer to any strategy you actually design.</p>
+</div>
+
+<h2 id="design-the-risk-controls-first"><a class="anchor" href="#design-the-risk-controls-first" aria-label="Link to this section">#</a>Design the risk controls first</h2><p>Before a single line reads a price, decide three things:</p>
+<ol>
+<li><strong>Per-trade spend cap</strong> — the maximum a single trade can move, regardless of what the strategy wants.</li>
+<li><strong>Period spend cap</strong> — a rolling limit (daily is typical) that trips even if every individual trade was within its own cap.</li>
+<li><strong>Kill switch</strong> — a way to stop the agent immediately and safely, mid-loop, without corrupting state.</li>
+</ol>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">const</span> <span class="hljs-variable constant_">MAX_SPEND_USDG_PER_TRADE</span> = <span class="hljs-number">25</span> <span class="hljs-comment">// hard ceiling per trade</span>
+<span class="hljs-keyword">const</span> <span class="hljs-variable constant_">DAILY_SPEND_CAP_USDG</span> = <span class="hljs-number">100</span> <span class="hljs-comment">// hard ceiling per rolling day</span>
+<span class="hljs-keyword">let</span> spentToday = <span class="hljs-number">0</span>
+<span class="hljs-keyword">let</span> running = <span class="hljs-literal">true</span>
+
+process.<span class="hljs-title function_">on</span>(<span class="hljs-string">&#x27;SIGINT&#x27;</span>, <span class="hljs-function">() =&gt;</span> {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;kill switch: SIGINT received, stopping after this tick&#x27;</span>)
+ running = <span class="hljs-literal">false</span> <span class="hljs-comment">// finish the in-flight tick, then exit the loop — never abort mid-transaction</span>
+})</code></pre></figure><p>Notice the kill switch doesn&#39;t <code>process.exit(0)</code> immediately. If the agent is mid-way through building a transaction when <code>SIGINT</code> fires, you want it to either finish that operation cleanly or not have started it — never leave a half-sent transaction or a corrupted spend counter. Setting a flag and checking it at loop boundaries is the safe pattern.</p>
+<h2 id="a-minimal-strategy-dip-detection-paper-mode"><a class="anchor" href="#a-minimal-strategy-dip-detection-paper-mode" aria-label="Link to this section">#</a>A minimal strategy: dip detection, paper mode</h2><p>This agent watches a basket of Stock Tokens, and on a mainnet dip beyond a threshold, logs what it <em>would</em> buy — respecting both spend caps — without ever building or sending a transaction:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, getQuote } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+<span class="hljs-keyword">const</span> <span class="hljs-variable constant_">SYMBOLS</span> = [<span class="hljs-string">&#x27;AAPL&#x27;</span>, <span class="hljs-string">&#x27;TSLA&#x27;</span>, <span class="hljs-string">&#x27;NVDA&#x27;</span>, <span class="hljs-string">&#x27;SPY&#x27;</span>]
+<span class="hljs-keyword">const</span> <span class="hljs-variable constant_">DIP_THRESHOLD_PCT</span> = <span class="hljs-number">0.5</span> <span class="hljs-comment">// paper-buy if price drops &gt;0.5% vs the last observed price</span>
+
+<span class="hljs-keyword">const</span> lastPrice = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Map</span>&lt;<span class="hljs-built_in">string</span>, <span class="hljs-built_in">number</span>&gt;()
+
+<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">tick</span>(<span class="hljs-params"></span>) {
+ <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> <span class="hljs-built_in">symbol</span> <span class="hljs-keyword">of</span> <span class="hljs-variable constant_">SYMBOLS</span>) {
+ <span class="hljs-keyword">const</span> q = <span class="hljs-keyword">await</span> <span class="hljs-title function_">getQuote</span>(hood, <span class="hljs-built_in">symbol</span>, { <span class="hljs-attr">maxAgeSeconds</span>: <span class="hljs-number">7</span> * <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> })
+ <span class="hljs-keyword">const</span> prev = lastPrice.<span class="hljs-title function_">get</span>(<span class="hljs-built_in">symbol</span>)
+ lastPrice.<span class="hljs-title function_">set</span>(<span class="hljs-built_in">symbol</span>, q.<span class="hljs-property">priceUsd</span>)
+ <span class="hljs-keyword">if</span> (prev === <span class="hljs-literal">undefined</span>) {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`[<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>}</span>] baseline $<span class="hljs-subst">${q.priceUsd.toFixed(<span class="hljs-number">2</span>)}</span>`</span>)
+ <span class="hljs-keyword">continue</span>
+ }
+ <span class="hljs-keyword">const</span> changePct = ((q.<span class="hljs-property">priceUsd</span> - prev) / prev) * <span class="hljs-number">100</span>
+ <span class="hljs-keyword">if</span> (changePct &lt;= -<span class="hljs-variable constant_">DIP_THRESHOLD_PCT</span>) {
+ <span class="hljs-keyword">if</span> (spentToday + <span class="hljs-variable constant_">MAX_SPEND_USDG_PER_TRADE</span> &gt; <span class="hljs-variable constant_">DAILY_SPEND_CAP_USDG</span>) {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`[<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>}</span>] dip <span class="hljs-subst">${changePct.toFixed(<span class="hljs-number">3</span>)}</span>% -- SKIPPED, daily cap reached`</span>)
+ <span class="hljs-keyword">continue</span>
+ }
+ spentToday += <span class="hljs-variable constant_">MAX_SPEND_USDG_PER_TRADE</span>
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`[<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>}</span>] dip <span class="hljs-subst">${changePct.toFixed(<span class="hljs-number">3</span>)}</span>% -- PAPER BUY $<span class="hljs-subst">${MAX_SPEND_USDG_PER_TRADE}</span> (spent today: $<span class="hljs-subst">${spentToday}</span>/$<span class="hljs-subst">${DAILY_SPEND_CAP_USDG}</span>)`</span>)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`[<span class="hljs-subst">${<span class="hljs-built_in">symbol</span>}</span>] $<span class="hljs-subst">${q.priceUsd.toFixed(<span class="hljs-number">2</span>)}</span> (<span class="hljs-subst">${changePct &gt;= <span class="hljs-number">0</span> ? <span class="hljs-string">&#x27;+&#x27;</span> : <span class="hljs-string">&#x27;&#x27;</span>}</span><span class="hljs-subst">${changePct.toFixed(<span class="hljs-number">3</span>)}</span>%) -- hold`</span>)
+ }
+ }
+}
+
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;paper-trading agent started -- Ctrl-C to stop (kill switch)&#x27;</span>)
+<span class="hljs-keyword">while</span> (running) {
+ <span class="hljs-keyword">await</span> <span class="hljs-title function_">tick</span>()
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;---&#x27;</span>)
+ <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Promise</span>(<span class="hljs-function">(<span class="hljs-params">r</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(r, <span class="hljs-number">5000</span>))
+}
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;stopped cleanly.&#x27;</span>)</code></pre></figure><p>Run it against real mainnet quotes:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">npx tsx agent.ts</code></pre></figure><p>A real, unedited capture from a 15-second run:</p>
+<figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">paper-trading agent started -- Ctrl-C to stop (kill switch)
+[AAPL] baseline $315.50
+[TSLA] baseline $407.82
+[NVDA] baseline $210.19
+[SPY] baseline $753.62
+---
+[AAPL] $315.50 (+0.000%) -- hold
+[TSLA] $407.82 (+0.000%) -- hold
+[NVDA] $210.19 (+0.000%) -- hold
+[SPY] $753.62 (+0.000%) -- hold
+---
+[AAPL] $315.50 (+0.000%) -- hold
+[TSLA] $407.82 (+0.000%) -- hold
+[NVDA] $210.19 (+0.000%) -- hold
+[SPY] $753.62 (+0.000%) -- hold</code></pre></figure><p>Notice what this <strong>doesn&#39;t</strong> show: a fabricated trade. This capture ran over a weekend, when Chainlink stock feeds are closed (Tutorial 3) — the prices genuinely didn&#39;t move between ticks, so the agent correctly held every time. That&#39;s the right behavior, not a disappointing demo. <strong>Never fake a trade to make a tutorial look more exciting than the real market was at the time you wrote it</strong> — that habit is exactly how you end up trusting an agent&#39;s logs that lie to you.</p>
+<h2 id="going-from-paper-to-real-the-parts-that-change-and-don39t"><a class="anchor" href="#going-from-paper-to-real-the-parts-that-change-and-don39t" aria-label="Link to this section">#</a>Going from paper to real (the parts that change, and don&#39;t)</h2><p>When you&#39;re ready to let the agent actually spend, the strategy logic above is untouched. What changes is narrow and specific:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { privateKeyToAccount } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem/accounts&#x27;</span>
+<span class="hljs-keyword">import</span> { createHoodClient, executeSwap, parseUsdg, <span class="hljs-variable constant_">MAINNET_ADDRESSES</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>({
+ <span class="hljs-attr">account</span>: <span class="hljs-title function_">privateKeyToAccount</span>(process.<span class="hljs-property">env</span>.<span class="hljs-property">ROBINHOOD_CHAIN_PRIVATE_KEY</span> <span class="hljs-keyword">as</span> <span class="hljs-string">`0x<span class="hljs-subst">${<span class="hljs-built_in">string</span>}</span>`</span>),
+ <span class="hljs-attr">acknowledgeStockTokenEligibility</span>: <span class="hljs-literal">true</span>, <span class="hljs-comment">// only if you are actually eligible — see Tutorial 1</span>
+})
+
+<span class="hljs-comment">// replace the PAPER BUY console.log with:</span>
+<span class="hljs-keyword">const</span> { hash, receipt } = <span class="hljs-keyword">await</span> <span class="hljs-title function_">executeSwap</span>(hood, {
+ <span class="hljs-attr">tokenIn</span>: <span class="hljs-variable constant_">MAINNET_ADDRESSES</span>.<span class="hljs-property">usdg</span>,
+ <span class="hljs-attr">tokenOut</span>: token.<span class="hljs-property">address</span>,
+ <span class="hljs-attr">amountIn</span>: <span class="hljs-title function_">parseUsdg</span>(<span class="hljs-title class_">String</span>(<span class="hljs-variable constant_">MAX_SPEND_USDG_PER_TRADE</span>)),
+}, { <span class="hljs-attr">slippageBps</span>: <span class="hljs-number">100</span> }) <span class="hljs-comment">// wider slippage — an unattended agent can&#x27;t react to a failed fill</span>
+<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`REAL BUY <span class="hljs-subst">${<span class="hljs-built_in">symbol</span>}</span>: tx <span class="hljs-subst">${hash}</span>, status <span class="hljs-subst">${receipt.status}</span>`</span>)</code></pre></figure><p>The spend caps, the kill switch, and the strategy decision are <strong>identical code</strong> — only the final action (<code>console.log</code> vs. <code>executeSwap</code>) changed. That&#39;s by design: if your paper-mode agent and your live agent share every line except the actual send, you can trust that what you watched in paper mode is what will happen live. If they&#39;re structurally different code paths, you&#39;re testing something you&#39;re not shipping.</p>
+<div class="callout callout-warning"><p class="callout-title">Start with an amount you'd be fine losing entirely</p><p>Even with caps and a kill switch, a strategy can be wrong, a feed can behave unexpectedly, or a bug can exist in code you wrote an hour ago. <code>DAILY_SPEND_CAP_USDG = 100</code> is a ceiling, not a promise of safety. Fund the live wallet with exactly what you&#39;re prepared to lose, and nothing more, for at least the first several days of live operation.</p>
+</div>
+
+<h2 id="logging-and-observability"><a class="anchor" href="#logging-and-observability" aria-label="Link to this section">#</a>Logging and observability</h2><p>An agent with no audit trail is an agent you can&#39;t debug after the fact. At minimum, persist (to a file or a database, not just stdout) every: quote observed, decision made and why, transaction sent with its hash, and cap-triggered skip. When something looks wrong three days from now, you want to reconstruct exactly what the agent saw and decided, not just what it did.</p>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong>Agent never trades, even during a volatile market</strong> — check <code>DIP_THRESHOLD_PCT</code> isn&#39;t set unreasonably high for the volatility of your basket, and confirm <code>getQuote</code> isn&#39;t throwing <code>StaleFeedError</code> silently (wrap the tick loop&#39;s body in a try/catch per symbol so one bad feed doesn&#39;t kill the whole tick).</p>
+<p><strong>Kill switch doesn&#39;t stop it</strong> — confirm you&#39;re checking the <code>running</code> flag at the top of the <code>while</code> loop, not just setting it. A <code>SIGINT</code> handler that sets a flag nobody reads does nothing.</p>
+<p><strong>Daily cap never resets</strong> — the example above never resets <code>spentToday</code>; add a check against a stored date and reset the counter on a new day, ideally persisted so a restart doesn&#39;t reset the cap early and let the agent double-spend the &quot;daily&quot; limit.</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>A strategy loop with the risk controls built in from the first line, verified against a real (honestly reported, not fabricated) run — and the exact, minimal diff between its paper and live modes. Next: the other side of an autonomous agent&#39;s toolkit — creating things on-chain, not just trading them.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../09-ai-agent-chain-access/"><span class="pager-dir">← Previous</span><span class="pager-title">Give your AI agent chain access with MCP</span></a><a class="pager pager-next" href="../11-launch-a-coin/"><span class="pager-dir">Next →</span><span class="pager-title">Launch a coin programmatically</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#design-the-risk-controls-first">Design the risk controls first</a></li><li class="toc-l2"><a href="#a-minimal-strategy-dip-detection-paper-mode">A minimal strategy: dip detection, paper mode</a></li><li class="toc-l2"><a href="#going-from-paper-to-real-the-parts-that-change-and-don39t">Going from paper to real (the parts that change, and don&amp;#39;t)</a></li><li class="toc-l2"><a href="#logging-and-observability">Logging and observability</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/11-launch-a-coin/index.html b/robinhood/learn-robinhood-chain/docs/11-launch-a-coin/index.html
new file mode 100644
index 000000000..6148d1028
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/11-launch-a-coin/index.html
@@ -0,0 +1,113 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Launch a coin programmatically · Learn Robinhood Chain</title>
+<meta name="description" content="How Robinhood Chain's launchpads work, how to decode their events, and the responsible path to launching a token on testnet from code.">
+<meta property="og:title" content="Launch a coin programmatically · Learn Robinhood Chain">
+<meta property="og:description" content="How Robinhood Chain's launchpads work, how to decode their events, and the responsible path to launching a token on testnet from code.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/" class="active" aria-current="page"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="11-launch-a-coin">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Monetizing &amp; agents</span></nav>
+ <header class="doc-header">
+ <h1>Launch a coin programmatically</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">20 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">4 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A launch monitor that decodes real NOXA and Odyssey events, and a clear, responsibly-framed recipe for launching your own test token.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li><a href="../07-streaming-the-chain/">Tutorial 7</a> — launch events</li><li>A funded testnet wallet for the write step</li></ul></aside>
+ <div class="doc-body"><p>Tutorial 7 taught you to <em>watch</em> NOXA and The Odyssey. This tutorial takes it one step further — a live launch monitor with fuller event decoding — and then gives you an honest account of what programmatic <em>launching</em> actually requires today, including a real gap this course found and didn&#39;t paper over.</p>
+<h2 id="a-fuller-launch-monitor"><a class="anchor" href="#a-fuller-launch-monitor" aria-label="Link to this section">#</a>A fuller launch monitor</h2><p>Extend the watcher from Tutorial 7 to decode every field each platform&#39;s events carry, so you can react to specific launch shapes rather than just &quot;something launched&quot;:</p>
+<figure class="code-block" data-lang="TypeScript"><figcaption><span class="code-lang">TypeScript</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { createHoodClient, watchLaunches, watchCurveTrades, watchGraduations, formatUsdg } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;hoodchain&#x27;</span>
+<span class="hljs-keyword">import</span> { formatEther } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;viem&#x27;</span>
+
+<span class="hljs-keyword">const</span> hood = <span class="hljs-title function_">createHoodClient</span>()
+
+<span class="hljs-title function_">watchLaunches</span>(hood, <span class="hljs-function">(<span class="hljs-params">launch</span>) =&gt;</span> {
+ <span class="hljs-keyword">if</span> (launch.<span class="hljs-property">launchpad</span> === <span class="hljs-string">&#x27;noxa&#x27;</span>) {
+ <span class="hljs-comment">// NOXA: instant listing — trading starts immediately on the pool address</span>
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`NOXA launch: <span class="hljs-subst">${launch.token}</span> by <span class="hljs-subst">${launch.creator}</span>, pool <span class="hljs-subst">${launch.pool}</span>`</span>)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Odyssey: opens on a bonding curve — no pool until it graduates</span>
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Odyssey curve opened: <span class="hljs-subst">${launch.token}</span> by <span class="hljs-subst">${launch.creator}</span> (no pool yet)`</span>)
+ }
+})
+
+<span class="hljs-comment">// only meaningful for Odyssey — NOXA has no curve, it&#x27;s a normal Uniswap v3 pool from block one</span>
+<span class="hljs-title function_">watchCurveTrades</span>(hood, <span class="hljs-function">(<span class="hljs-params">trade</span>) =&gt;</span> {
+ <span class="hljs-keyword">const</span> dir = trade.<span class="hljs-property">isBuy</span> ? <span class="hljs-string">&#x27;BUY&#x27;</span> : <span class="hljs-string">&#x27;SELL&#x27;</span>
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`<span class="hljs-subst">${dir}</span> <span class="hljs-subst">${trade.token}</span>: <span class="hljs-subst">${formatEther(trade.tokenAmount)}</span> tokens for <span class="hljs-subst">${formatEther(trade.quoteAmount)}</span> ETH`</span>)
+})
+
+<span class="hljs-title function_">watchGraduations</span>(hood, <span class="hljs-function">(<span class="hljs-params">g</span>) =&gt;</span> {
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`GRADUATED: <span class="hljs-subst">${g.token}</span> -&gt; locked Uniswap v3 pool <span class="hljs-subst">${g.pool}</span>`</span>)
+})</code></pre></figure><p>This is exactly the decoding verified in Tutorial 7 against 21 real historical NOXA launches — extended here with curve-trade and graduation handling for Odyssey specifically. If you&#39;re building a trading bot or an alert system (Tutorial 16-style tooling), this is the complete event surface you&#39;d hook into.</p>
+<h2 id="what-quotlaunch-a-coin-programmaticallyquot-actually-requires-and-a-real-gap"><a class="anchor" href="#what-quotlaunch-a-coin-programmaticallyquot-actually-requires-and-a-real-gap" aria-label="Link to this section">#</a>What &quot;launch a coin programmatically&quot; actually requires — and a real gap</h2><p>Watching launches only requires decoding <strong>events</strong>, which are public and don&#39;t need a verified ABI — you can decode a known event signature off any contract, verified or not. <strong>Sending a transaction that creates a new launch is different</strong>: it requires the factory contract&#39;s <em>write function</em> signature — argument names, types, and order — which you can only get reliably from a verified source contract, or by painstakingly reverse-engineering calldata from a real transaction.</p>
+<p>This course checked both launchpads&#39; factory contracts against the Blockscout API before writing this page:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">curl -s https://robinhoodchain.blockscout.com/api/v2/smart-contracts/0xD9eC2db5f3D1b236843925949fe5bd8a3836FCcB</code></pre></figure><p>Neither the NOXA launch factory (<code>0xD9eC2db5f3D1b236843925949fe5bd8a3836FCcB</code>) nor The Odyssey&#39;s bonding-curve factory (<code>0xEb3FeeD2716cF0eEAda05B22e67424794e1f5a80</code>) returns verified source through Blockscout&#39;s API — confirming what the <a href="https://github.com/nirholas/robinhood-chain-sdk/blob/main/src/launchpads.ts" target="_blank" rel="noopener noreferrer">hoodchain SDK&#39;s own source comments</a> already note: <em>&quot;neither publishes verified source on Blockscout.&quot;</em> That&#39;s why the SDK ships <strong>event ABIs only</strong> (for the read/watch path you used above) and no write-function ABI for either factory — extracting one would mean either reverse-engineering calldata from real launch transactions or asking the platforms directly, and doing that with unverified confidence long enough to publish it as &quot;the&quot; launch function would risk shipping guessed calldata that either fails or, worse, succeeds with the wrong parameters.</p>
+<div class="callout callout-warning"><p class="callout-title">We will not publish a guessed function signature</p><p>It would be easy to fill this section with a plausible-looking <code>createToken(name, symbol, supply, ...)</code> call. It would also be irresponsible: an unverified guess at a factory&#39;s write interface, if wrong, can burn real gas on a failed transaction or — worse — succeed with parameters you didn&#39;t intend (wrong fee tier, wrong initial liquidity split, wrong lock terms). This course only ships code that was actually run and verified. For the launch-transaction write path specifically, that bar isn&#39;t met yet.</p>
+</div>
+
+<h2 id="the-responsible-path-today"><a class="anchor" href="#the-responsible-path-today" aria-label="Link to this section">#</a>The responsible path today</h2><p>Until a launch factory&#39;s write ABI is verified from a primary source, the correct way to launch a token on NOXA or The Odyssey is through <strong>the platform&#39;s own front-end</strong> (fun.noxa.fi/robinhood, theodyssey.fun) — it already encodes the correct calldata, has been tested against the live contract by its own team, and gives you a UI to review exactly what you&#39;re about to deploy before you sign. That&#39;s not a cop-out; it&#39;s the same advice you&#39;d give anyone about to send a transaction to a contract they don&#39;t have a verified interface for.</p>
+<p>If you want to pursue the programmatic path yourself: launch a token through the front-end <strong>once</strong>, on testnet, with a throwaway wallet, then pull the transaction&#39;s calldata from the explorer and decode it against the four-byte selector directory or by testing candidate ABIs against <code>eth_call</code> in simulation. That reverse-engineering work is exactly what standing up a verified, publishable write-ABI would require — and it&#39;s future work this course is flagging rather than rushing.</p>
+<h2 id="what-a-launch-monitor-is-good-for-right-now"><a class="anchor" href="#what-a-launch-monitor-is-good-for-right-now" aria-label="Link to this section">#</a>What a launch monitor <em>is</em> good for right now</h2><p>None of the above weakens the read side. A production-quality launch monitor — alerting, filtering by creator reputation, feeding a trading bot&#39;s universe of new tokens — is fully buildable today with the event decoding shown above and in Tutorial 7. That&#39;s most of what &quot;reacting to launches&quot; actually means in practice; only the &quot;originate a new launch from my own code&quot; half has the gap described here.</p>
+<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting" aria-label="Link to this section">#</a>Troubleshooting</h2><p><strong>I found a write ABI for one of these factories elsewhere</strong> — verify it against a real <code>eth_call</code> simulation before trusting it (Tutorial 6 covers <code>simulateContract</code>-style verification for swaps; the same discipline applies here). If it&#39;s a real, verified interface, it belongs in an update to the SDK&#39;s <code>launchpads.ts</code>, not a one-off script.</p>
+<p><strong><code>watchCurveTrades</code> never fires for a NOXA token</strong> — expected. NOXA has no bonding curve; its tokens trade as ordinary Uniswap v3 swaps from launch, which you&#39;d track with <code>watchTransfers</code> (Tutorial 7) on the token itself, not curve events.</p>
+<p><strong>I want historical curve trade volume for a specific token</strong> — use <code>client.public.getLogs</code> directly with <code>odysseyTradedEvent</code> and an <code>args: { token }</code> filter over a historical block range, following the pattern from <code>getRecentLaunches</code> in Tutorial 7.</p>
+<h2 id="what-you-built"><a class="anchor" href="#what-you-built" aria-label="Link to this section">#</a>What you built</h2><p>A launch monitor covering both platforms&#39; full event surface, and — just as valuably — a documented, honest boundary around what&#39;s safely automatable today versus what still requires a human at the platform&#39;s own front-end. Knowing where that line is is worth more than a script that pretends it isn&#39;t there. Next: the capstone — taking everything you&#39;ve built and actually shipping it.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../10-autonomous-trading-agent/"><span class="pager-dir">← Previous</span><span class="pager-title">Build an autonomous trading agent</span></a><a class="pager pager-next" href="../12-ship-it/"><span class="pager-dir">Next →</span><span class="pager-title">Ship it: deploy and go mainnet</span></a></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#a-fuller-launch-monitor">A fuller launch monitor</a></li><li class="toc-l2"><a href="#what-quotlaunch-a-coin-programmaticallyquot-actually-requires-and-a-real-gap">What &amp;quot;launch a coin programmatically&amp;quot; actually requires — and a real gap</a></li><li class="toc-l2"><a href="#the-responsible-path-today">The responsible path today</a></li><li class="toc-l2"><a href="#what-a-launch-monitor-is-good-for-right-now">What a launch monitor is good for right now</a></li><li class="toc-l2"><a href="#troubleshooting">Troubleshooting</a></li><li class="toc-l2"><a href="#what-you-built">What you built</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/12-ship-it/index.html b/robinhood/learn-robinhood-chain/docs/12-ship-it/index.html
new file mode 100644
index 000000000..c5bf3e859
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/12-ship-it/index.html
@@ -0,0 +1,141 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Ship it: deploy and go mainnet · Learn Robinhood Chain</title>
+<meta name="description" content="Deploy your static app to Pages, your API to Cloud Run, and walk the going-mainnet checklist: funding, keys, spend caps, and monitoring.">
+<meta property="og:title" content="Ship it: deploy and go mainnet · Learn Robinhood Chain">
+<meta property="og:description" content="Deploy your static app to Pages, your API to Cloud Run, and walk the going-mainnet checklist: funding, keys, spend caps, and monitoring.">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="../assets/styles.css">
+<link rel="stylesheet" href="../assets/hljs.css">
+</head>
+<body class="page-doc">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="../">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="../01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="../02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="../03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="../04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="../05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="../06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="../07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="../08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="../09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="../10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="../11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="../12-ship-it/" class="active" aria-current="page"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="doc" id="main" data-slug="12-ship-it">
+ <article class="doc-article">
+ <nav class="breadcrumb" aria-label="Breadcrumb"><a href="../">Home</a><span aria-hidden="true">/</span><span>Capstone</span></nav>
+ <header class="doc-header">
+ <h1>Ship it: deploy and go mainnet</h1>
+ <div class="doc-meta">
+ <span class="doc-meta-item">18 min</span>
+ <span class="doc-meta-sep">·</span>
+ <span class="doc-meta-item">6 min read</span>
+ <span class="doc-meta-sep">·</span>
+ <label class="done-toggle"><input type="checkbox" class="done-check"> Mark complete</label>
+ </div>
+ </header>
+ <aside class="whatbuild"><p class="whatbuild-title">What you'll build</p><p>A deployment plan and a mainnet-readiness checklist you can actually tick off before you flip the switch.</p></aside>
+ <aside class="prereq"><p class="prereq-title">Prerequisites</p><ul><li>Anything you built in Tutorials 4–11</li><li>A deploy target (GitHub Pages and/or Google Cloud Run)</li></ul></aside>
+ <div class="doc-body"><p>Everything in this course has been real, run code. This capstone is about the last mile: getting what you built in front of actual users, and the checklist to walk before you let it touch mainnet with real money.</p>
+<h2 id="deploying-a-static-app-github-pages"><a class="anchor" href="#deploying-a-static-app-github-pages" aria-label="Link to this section">#</a>Deploying a static app: GitHub Pages</h2><p>If what you built is client-side — a ticker, a portfolio dashboard, anything using only <code>hood.public</code> reads (Tutorials 2, 4, 5, 7) — it needs no backend at all. This very site is the reference example: it&#39;s a static build in <code>docs/</code>, deployed from a branch.</p>
+<p><strong>One-time setup:</strong></p>
+<ol>
+<li>Push your repo to GitHub.</li>
+<li><strong>Settings → Pages → Build and deployment → Source: &quot;Deploy from a branch.&quot;</strong></li>
+<li>Branch: <code>main</code>, folder: <code>/docs</code>. Save.</li>
+<li>Your site is live at <code>https://&lt;username&gt;.github.io/&lt;repo&gt;/</code> within a minute or two.</li>
+</ol>
+<p>That&#39;s the entire deployment. No build step runs on GitHub&#39;s infrastructure — you commit the already-built <code>docs/</code> folder, exactly as this repo does. Re-deploying is <code>npm run build &amp;&amp; git add docs &amp;&amp; git commit &amp;&amp; git push</code>.</p>
+<div class="callout callout-tip"><p class="callout-title">Why deploy-from-branch instead of a GitHub Actions build</p><p>It&#39;s simpler, it&#39;s faster (no CI queue), and it means what&#39;s live is <em>exactly</em> what you built and tested locally — no environment drift between your machine and a CI runner. The tradeoff is you must remember to run the build before committing; a pre-commit hook or a habit covers that.</p>
+</div>
+
+<h3 id="rpc-calls-from-a-static-site"><a class="anchor" href="#rpc-calls-from-a-static-site" aria-label="Link to this section">#</a>RPC calls from a static site</h3><p>A pure static deploy still makes real, live RPC calls — straight from the visitor&#39;s browser to <code>rpc.mainnet.chain.robinhood.com</code>, exactly like this site&#39;s <a href="../">live chain-stats strip</a> does. That&#39;s the whole trick behind &quot;the landing page can show live data on GitHub Pages&quot;: public reads need no server. The only thing you can&#39;t do from a static site is anything requiring a private key or server-side secret — which brings us to Cloud Run.</p>
+<h2 id="deploying-a-server-google-cloud-run"><a class="anchor" href="#deploying-a-server-google-cloud-run" aria-label="Link to this section">#</a>Deploying a server: Google Cloud Run</h2><p>The moment your app needs a wallet key (an agent, Tutorial 10), verifies payments server-side (the x402 API, Tutorial 8), or holds any other secret, it needs a real backend. Google Cloud Run is a strong default: pay-per-request, scales to zero, and a straightforward <code>Dockerfile</code> gets you there.</p>
+<figure class="code-block" data-lang="text"><figcaption><span class="code-lang">text</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-plaintext">FROM node:20-slim
+WORKDIR /app
+COPY package*.json ./
+RUN npm ci --omit=dev
+COPY . .
+ENV PORT=8080
+EXPOSE 8080
+CMD ["node", "server.mjs"]</code></pre></figure><p>Two things Cloud Run requires that are easy to miss the first time:</p>
+<ul>
+<li><strong>Listen on <code>process.env.PORT</code></strong>, not a hardcoded port. Cloud Run injects <code>PORT</code> (usually <code>8080</code>) and routes traffic there — a hardcoded <code>3000</code> will silently fail health checks.</li>
+<li><strong>Bind to <code>0.0.0.0</code>, not <code>localhost</code>.</strong> <code>app.listen(port)</code> defaults to all interfaces in Express and is fine; some frameworks default to loopback-only, which Cloud Run can&#39;t reach.</li>
+</ul>
+<p>Deploy:</p>
+<figure class="code-block" data-lang="bash"><figcaption><span class="code-lang">bash</span><button class="copy-btn" type="button" aria-label="Copy code to clipboard">Copy</button></figcaption><pre><code class="hljs language-bash">gcloud run deploy my-robinhood-app \
+ --<span class="hljs-built_in">source</span> . \
+ --region us-central1 \
+ --allow-unauthenticated \
+ --set-env-vars PAYOUT_ADDRESS=0xYourAddress</code></pre></figure><p><strong>Never bake a private key into the container image or set it with <code>--set-env-vars</code> in a command you&#39;ll paste into a README.</strong> Use <code>gcloud run services update --update-secrets</code> backed by Secret Manager, or your platform&#39;s equivalent secret store — the difference between an env var and a secret-manager binding is the difference between a key that leaks the moment someone reads your shell history and one that doesn&#39;t.</p>
+<h2 id="an-alternative-vercel"><a class="anchor" href="#an-alternative-vercel" aria-label="Link to this section">#</a>An alternative: Vercel</h2><p>If your app is a standard Next.js/Vite frontend with lightweight serverless API routes, Vercel remains a fine choice for the same static-plus-functions shape — deploy with <code>vercel --prod</code> after <code>vercel link</code>. Prefer Cloud Run specifically once you have a long-running process (an always-on trading agent, a WebSocket firehose consumer) — Vercel&#39;s serverless functions are request-scoped and will terminate a background loop between invocations.</p>
+<h2 id="the-going-mainnet-checklist"><a class="anchor" href="#the-going-mainnet-checklist" aria-label="Link to this section">#</a>The going-mainnet checklist</h2><p>Everything below was demonstrated somewhere in this course. This is the assembled version — walk it in order before flipping any switch that spends real money.</p>
+<h3 id="funding"><a class="anchor" href="#funding" aria-label="Link to this section">#</a>Funding</h3><ul>
+<li><input disabled="" type="checkbox"> The wallet holds <strong>only</strong> what you&#39;re prepared to lose during the first live days (Tutorial 10) — not your full intended capital.</li>
+<li><input disabled="" type="checkbox"> You&#39;ve verified the wallet&#39;s mainnet ETH balance covers gas for your expected transaction volume; Robinhood Chain&#39;s ~100ms blocks mean a busy agent can rack up transaction count fast.</li>
+</ul>
+<h3 id="keys"><a class="anchor" href="#keys" aria-label="Link to this section">#</a>Keys</h3><ul>
+<li><input disabled="" type="checkbox"> The private key lives in a secret manager or env var injected at runtime — never in source, never in a Docker image layer, never in a README example with a real value (Tutorial 6, 10, 12).</li>
+<li><input disabled="" type="checkbox"> <code>.env</code> and any key file are in <code>.gitignore</code>, and you&#39;ve confirmed with <code>git status</code> that nothing sensitive is staged before your first push.</li>
+</ul>
+<h3 id="spend-caps"><a class="anchor" href="#spend-caps" aria-label="Link to this section">#</a>Spend caps</h3><ul>
+<li><input disabled="" type="checkbox"> Per-transaction and per-period spend caps are enforced in code, not just &quot;the strategy wouldn&#39;t do that&quot; (Tutorial 10) — assume the strategy has a bug.</li>
+<li><input disabled="" type="checkbox"> A kill switch exists, is tested, and stops the process <strong>between</strong> operations rather than mid-transaction (Tutorial 10).</li>
+</ul>
+<h3 id="compliance"><a class="anchor" href="#compliance" aria-label="Link to this section">#</a>Compliance</h3><ul>
+<li><input disabled="" type="checkbox"> Any flow that can acquire a Stock Token has the eligibility gate active by default, and <code>acknowledgeStockTokenEligibility: true</code> is set only after genuine confirmation of operator eligibility — never flipped on reflexively to silence an error (Tutorial 1, 6).</li>
+<li><input disabled="" type="checkbox"> Untrusted on-chain data (token names, memos, launch metadata) is escaped before rendering and never interpreted as an instruction to an agent or LLM (Tutorial 1, 11).</li>
+</ul>
+<h3 id="correctness"><a class="anchor" href="#correctness" aria-label="Link to this section">#</a>Correctness</h3><ul>
+<li><input disabled="" type="checkbox"> Portfolio and pricing code follows the multiplier rule exactly — value is <code>balance × feed price</code>, never <code>balance × multiplier × feed price</code> (Tutorial 3, 5).</li>
+<li><input disabled="" type="checkbox"> Staleness windows account for the 24/5 market schedule; a tight window won&#39;t falsely flag every weekend read as broken (Tutorial 3, 4).</li>
+<li><input disabled="" type="checkbox"> Payment or transaction verification decodes actual event arguments (recipient, amount) rather than checking &quot;a log exists&quot; — Tutorial 8 documents a real bug of exactly this shape that was caught and fixed while writing this course.</li>
+</ul>
+<h3 id="infrastructure"><a class="anchor" href="#infrastructure" aria-label="Link to this section">#</a>Infrastructure</h3><ul>
+<li><input disabled="" type="checkbox"> You&#39;re on a dedicated RPC (Alchemy or equivalent) for anything beyond light, occasional reads — the public RPC rate-limits wide scans (Tutorial 2, 7) and a production agent hitting <code>429</code>s is a production agent silently missing data.</li>
+<li><input disabled="" type="checkbox"> Logs capture every decision an autonomous component makes, with enough detail to reconstruct &quot;why did it do that&quot; after the fact (Tutorial 10).</li>
+<li><input disabled="" type="checkbox"> Secrets are in a secret manager, not env vars set from a shell command that lands in history or CI logs.</li>
+</ul>
+<h3 id="monitoring"><a class="anchor" href="#monitoring" aria-label="Link to this section">#</a>Monitoring</h3><ul>
+<li><input disabled="" type="checkbox"> You have a way to know the agent/service is still running — a heartbeat, a health check endpoint, or an external uptime check — not just &quot;I&#39;ll notice if it stops.&quot;</li>
+<li><input disabled="" type="checkbox"> Failed transactions and thrown errors are surfaced somewhere you&#39;ll actually see them (a log aggregator, an alert), not just printed to a terminal that isn&#39;t open.</li>
+</ul>
+<h2 id="where-to-go-from-here"><a class="anchor" href="#where-to-go-from-here" aria-label="Link to this section">#</a>Where to go from here</h2><p>You&#39;ve built, in order: a correct mental model, a first read, the multiplier rule, a live ticker, a portfolio tracker, a working swap, two live streams, a paid API (with a real bug caught and fixed), a working MCP server, a risk-controlled paper-trading agent, and an honest account of the launch-write gap. That&#39;s the full stack of a serious Robinhood Chain application. The <a href="https://github.com/nirholas/robinhood-chain-sdk" target="_blank" rel="noopener noreferrer">hoodchain SDK</a> that powered all of it is open source — read its source when you need to go deeper than any tutorial here, and consider contributing back (the launch-ABI gap from Tutorial 11 is a real, well-scoped next PR for someone with more time to reverse-engineer it responsibly).</p>
+<p>Build something worth screenshotting.</p>
+</div>
+ <nav class="pager-nav" aria-label="Tutorial pagination"><a class="pager pager-prev" href="../11-launch-a-coin/"><span class="pager-dir">← Previous</span><span class="pager-title">Launch a coin programmatically</span></a><span></span></nav>
+ <footer class="doc-footer">
+ <p>Question or correction? <a href="https://github.com/nirholas/learn-robinhood-chain/issues" target="_blank" rel="noopener noreferrer">Open an issue</a>.</p>
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ </footer>
+ </article>
+ <nav class="toc" aria-label="On this page"><p class="toc-title">On this page</p><ul><li class="toc-l2"><a href="#deploying-a-static-app-github-pages">Deploying a static app: GitHub Pages</a></li><li class="toc-l3"><a href="#rpc-calls-from-a-static-site">RPC calls from a static site</a></li><li class="toc-l2"><a href="#deploying-a-server-google-cloud-run">Deploying a server: Google Cloud Run</a></li><li class="toc-l2"><a href="#an-alternative-vercel">An alternative: Vercel</a></li><li class="toc-l2"><a href="#the-going-mainnet-checklist">The going-mainnet checklist</a></li><li class="toc-l3"><a href="#funding">Funding</a></li><li class="toc-l3"><a href="#keys">Keys</a></li><li class="toc-l3"><a href="#spend-caps">Spend caps</a></li><li class="toc-l3"><a href="#compliance">Compliance</a></li><li class="toc-l3"><a href="#correctness">Correctness</a></li><li class="toc-l3"><a href="#infrastructure">Infrastructure</a></li><li class="toc-l3"><a href="#monitoring">Monitoring</a></li><li class="toc-l2"><a href="#where-to-go-from-here">Where to go from here</a></li></ul></nav>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="../assets/app.js"></script><script defer src="../assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/assets/app.js b/robinhood/learn-robinhood-chain/docs/assets/app.js
new file mode 100644
index 000000000..9d12d70c8
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/assets/app.js
@@ -0,0 +1,128 @@
+/* app.js — theme toggle, copy buttons, mobile nav, progress, TOC scrollspy.
+ No dependencies, no CDN. Progressive enhancement over the static HTML. */
+(function () {
+ 'use strict'
+
+ /* ---- theme --------------------------------------------------------- */
+ var root = document.documentElement
+ var toggle = document.querySelector('.theme-toggle')
+ if (toggle) {
+ toggle.addEventListener('click', function () {
+ var next = root.getAttribute('data-theme') === 'light' ? 'dark' : 'light'
+ root.setAttribute('data-theme', next)
+ try { localStorage.setItem('theme', next) } catch (e) {}
+ })
+ }
+
+ /* ---- copy buttons -------------------------------------------------- */
+ document.querySelectorAll('.copy-btn').forEach(function (btn) {
+ btn.addEventListener('click', function () {
+ var fig = btn.closest('.code-block')
+ var code = fig ? fig.querySelector('code') : null
+ if (!code) return
+ var text = code.innerText
+ var done = function () {
+ btn.textContent = 'Copied'
+ btn.classList.add('copied')
+ setTimeout(function () { btn.textContent = 'Copy'; btn.classList.remove('copied') }, 1600)
+ }
+ if (navigator.clipboard && navigator.clipboard.writeText) {
+ navigator.clipboard.writeText(text).then(done, function () { fallbackCopy(text, done) })
+ } else {
+ fallbackCopy(text, done)
+ }
+ })
+ })
+ function fallbackCopy(text, cb) {
+ var ta = document.createElement('textarea')
+ ta.value = text
+ ta.style.position = 'fixed'
+ ta.style.opacity = '0'
+ document.body.appendChild(ta)
+ ta.select()
+ try { document.execCommand('copy'); cb() } catch (e) {}
+ document.body.removeChild(ta)
+ }
+
+ /* ---- mobile nav ---------------------------------------------------- */
+ var menu = document.querySelector('.menu-toggle')
+ var scrim = document.querySelector('.sidebar-scrim')
+ function closeNav() { document.body.classList.remove('nav-open'); if (menu) menu.setAttribute('aria-expanded', 'false') }
+ if (menu) {
+ menu.addEventListener('click', function () {
+ var open = document.body.classList.toggle('nav-open')
+ menu.setAttribute('aria-expanded', String(open))
+ })
+ }
+ if (scrim) scrim.addEventListener('click', closeNav)
+ document.querySelectorAll('.sidebar-nav a').forEach(function (a) { a.addEventListener('click', closeNav) })
+
+ /* ---- progress (localStorage) -------------------------------------- */
+ var KEY = 'lrc:done'
+ function getDone() {
+ try { return JSON.parse(localStorage.getItem(KEY) || '[]') } catch (e) { return [] }
+ }
+ function setDone(list) {
+ try { localStorage.setItem(KEY, JSON.stringify(list)) } catch (e) {}
+ }
+ function markDone(slug, done) {
+ var list = getDone()
+ var i = list.indexOf(slug)
+ if (done && i === -1) list.push(slug)
+ if (!done && i !== -1) list.splice(i, 1)
+ setDone(list)
+ }
+
+ // doc page: wire the "mark complete" checkbox
+ var main = document.querySelector('.doc[data-slug]')
+ if (main) {
+ var slug = main.getAttribute('data-slug')
+ var check = document.querySelector('.done-check')
+ if (check) {
+ check.checked = getDone().indexOf(slug) !== -1
+ check.addEventListener('change', function () { markDone(slug, check.checked) })
+ }
+ }
+
+ // landing page: reflect progress on cards
+ var cards = document.querySelectorAll('.tut-card[data-slug]')
+ if (cards.length) {
+ var done = getDone()
+ var count = 0
+ cards.forEach(function (card) {
+ if (done.indexOf(card.getAttribute('data-slug')) !== -1) { card.classList.add('done'); count++ }
+ })
+ var counter = document.getElementById('progress-count')
+ if (counter) counter.textContent = String(count)
+ var reset = document.getElementById('reset-progress')
+ if (reset) {
+ if (count > 0) reset.hidden = false
+ reset.addEventListener('click', function () {
+ setDone([])
+ cards.forEach(function (c) { c.classList.remove('done') })
+ if (counter) counter.textContent = '0'
+ reset.hidden = true
+ })
+ }
+ }
+
+ /* ---- TOC scrollspy ------------------------------------------------- */
+ var tocLinks = Array.prototype.slice.call(document.querySelectorAll('.toc a'))
+ if (tocLinks.length && 'IntersectionObserver' in window) {
+ var map = {}
+ tocLinks.forEach(function (a) { map[a.getAttribute('href').slice(1)] = a })
+ var visible = new Set()
+ var obs = new IntersectionObserver(function (entries) {
+ entries.forEach(function (e) {
+ if (e.isIntersecting) visible.add(e.target.id); else visible.delete(e.target.id)
+ })
+ tocLinks.forEach(function (a) { a.classList.remove('active') })
+ var first = tocLinks.find(function (a) { return visible.has(a.getAttribute('href').slice(1)) })
+ if (first) first.classList.add('active')
+ }, { rootMargin: '-80px 0px -70% 0px' })
+ Object.keys(map).forEach(function (id) {
+ var el = document.getElementById(id)
+ if (el) obs.observe(el)
+ })
+ }
+})()
diff --git a/robinhood/learn-robinhood-chain/docs/assets/hljs.css b/robinhood/learn-robinhood-chain/docs/assets/hljs.css
new file mode 100644
index 000000000..86c3fa64a
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/assets/hljs.css
@@ -0,0 +1,14 @@
+/* highlight.js — theme-aware, self-hosted (no CDN) */
+.hljs{color:var(--code-fg);background:transparent}
+.hljs-comment,.hljs-quote{color:var(--hl-comment);font-style:italic}
+.hljs-keyword,.hljs-selector-tag,.hljs-literal,.hljs-section,.hljs-link{color:var(--hl-keyword)}
+.hljs-function .hljs-keyword{color:var(--hl-keyword)}
+.hljs-string,.hljs-attr,.hljs-template-tag,.hljs-addition,.hljs-regexp{color:var(--hl-string)}
+.hljs-number,.hljs-symbol,.hljs-bullet,.hljs-meta{color:var(--hl-number)}
+.hljs-title,.hljs-title.function_,.hljs-name{color:var(--hl-title)}
+.hljs-type,.hljs-class .hljs-title,.hljs-title.class_,.hljs-built_in{color:var(--hl-type)}
+.hljs-variable,.hljs-template-variable,.hljs-property{color:var(--hl-var)}
+.hljs-attribute{color:var(--hl-attr)}
+.hljs-deletion{color:var(--hl-deletion)}
+.hljs-emphasis{font-style:italic}
+.hljs-strong{font-weight:600}
diff --git a/robinhood/learn-robinhood-chain/docs/assets/pages.json b/robinhood/learn-robinhood-chain/docs/assets/pages.json
new file mode 100644
index 000000000..0f2605f17
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/assets/pages.json
@@ -0,0 +1 @@
+[{"slug":"01-what-is-robinhood-chain","title":"What Robinhood Chain actually is","index":"01"},{"slug":"02-connect-and-read","title":"Connect and read the chain in 5 minutes","index":"02"},{"slug":"03-stock-tokens-explained","title":"Stock Tokens explained for developers","index":"03"},{"slug":"04-live-price-ticker","title":"Your first app: a live price ticker","index":"04"},{"slug":"05-portfolio-tracker","title":"Portfolio tracker done right","index":"05"},{"slug":"06-swapping-on-chain","title":"Swapping on-chain: quotes, slippage, execution","index":"06"},{"slug":"07-streaming-the-chain","title":"Streaming the chain: launchpads + firehose","index":"07"},{"slug":"08-sell-your-api-for-usdg","title":"Sell your API for USDG with x402","index":"08"},{"slug":"09-ai-agent-chain-access","title":"Give your AI agent chain access with MCP","index":"09"},{"slug":"10-autonomous-trading-agent","title":"Build an autonomous trading agent","index":"10"},{"slug":"11-launch-a-coin","title":"Launch a coin programmatically","index":"11"},{"slug":"12-ship-it","title":"Ship it: deploy and go mainnet","index":"12"}]
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/assets/search-index.json b/robinhood/learn-robinhood-chain/docs/assets/search-index.json
new file mode 100644
index 000000000..a422cdaca
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/assets/search-index.json
@@ -0,0 +1 @@
+[{"slug":"01-what-is-robinhood-chain","title":"What Robinhood Chain actually is","section":"Foundations","index":"01","description":"Architecture, chain IDs, and what's real vs hype — the no-token fact, the US-person restriction, and permissionless deployment, all sourced.","headings":["The one-paragraph version","Architecture, precisely","The two networks","The three facts everyone gets wrong","1. There is no chain token. Gas is ETH.","2. Stock Tokens may not be sold to US persons.","3. Anyone can deploy. The chain is permissionless.","What&#39;s actually live","Where to get canonical addresses","You now know more than most"],"text":"Robinhood Chain launched its mainnet on July 1, 2026. In the weeks since, the amount of confident, wrong information written about it has been remarkable. This page is the antidote: the architecture, the chain IDs, and — more importantly — the three facts that every newcomer gets backwards. Everything here is sourced. Where a claim matters, it links to the official docs or to something you can verify on-chain yourself in the next tutorial. # The one-paragraph version Robinhood Chain is a permissionless Arbitrum Orbit Layer 2 that settles to Ethereum, posts its data as blobs, and pays gas in ETH . Blocks land in roughly 100 milliseconds. It supports ERC-4337 account abstraction. Its headline feature is ~95 Stock Tokens — tokenized US equities, each a plain ERC-20 with a Chainlink price feed — plus USDG , a dollar stablecoin. That's the whole chain in one breath. The rest of this page is the fine print, and the fine print is where the money and the mistakes are. # Architecture, precisely Property Value Type Arbitrum Orbit L2 (Nitro stack) Settlement Ethereum mainnet Data availability Blobs (EIP-4844) Gas token ETH (not a chain-native token) Block time ~100 ms Account abstraction ERC-4337 supported Multicall3 0xca11bde05977b3631167028862be2a173976ca11 (canonical) Because it's a standard Nitro Orbit chain, your existing Ethereum tooling just works — viem, ethers, wagmi, Foundry, Hardhat. There is no exotic SDK you're forced to adopt, no bespoke RPC dialect. That is the single most important practical fact for a developer, and it's why the rest of this course is mostly \"normal EVM development, applied well.\" # The two networks You will use both. Reads and demos happen on mainnet; anything that writes, you rehearse on testnet first. Mainnet Testnet Chain ID 4663 46630 RPC https://rpc.mainnet.chain.robinhood.com https://rpc.testnet.chain.robinhood.com Explorer robinhoodchain.blockscout.com explorer.testnet.chain.robinhood.com Sequencer feed wss://feed.mainnet.chain.robinhood.com — Faucet — faucet.testnet.chain.robinhood.com viem ships the chain definitions As of [email protected] , both networks are built in: import { robinhood, robinhoodTestnet } from 'viem/chains' . Never hand-roll the chain config — you'll get the multicall address or the block explorer wrong and spend an afternoon debugging it. Let viem do it. # The three facts everyone gets wrong # 1. There is no chain token. Gas is ETH. Search social media and you'll find people trading \"the Robinhood Chain token,\" quoting its price, and posting its contract address. It does not exist. Robinhood Chain pays gas in bridged ETH, exactly like Arbitrum One or Base. There is no native gas token and no official chain coin. Anyone showing you a \"$HOOD chain token\" contract is showing you a memecoin someone permissionlessly deployed on the chain — which is allowed and common (see Tutorial 7) — not a token of the chain. Internalize this now; it will save you from a scam later. # 2. Stock Tokens may not be sold to US persons. This is the fact with legal teeth. Stock Tokens are tokenized debt securities , issued by Robinhood Assets (Jersey) Ltd . They may not be offered, sold, or delivered to US persons , with additional restrictions for Canada, the UK, and Switzerland. The critical nuance for developers: The restriction is legal and front-end enforced — not enforced at the contract level. The ERC-20 contracts will happily transfer to anyone. Compliance is your responsibility as the operator of any interface or agent. Reading and displaying Stock Token data is unrestricted. Prices, supply, someone's holdings — all fair game. Most of this course is reads, and none of it is gated. Any flow that acquires a Stock Token needs an eligibility gate. A buy button, a swap that outputs a Stock Token, an agent that accumulates one — those require a clear disclosure and a geo/eligibility gate, defaulting to off . You'll see this enforced in code in Tutorial 6: the hoodchain SDK throws a StockTokenEligibility"},{"slug":"02-connect-and-read","title":"Connect and read the chain in 5 minutes","section":"Foundations","index":"02","description":"Add the network to a wallet, get testnet funds, and make your first read against mainnet with viem — a real block number and gas price in your terminal.","headings":["Add the network to a wallet (optional, 60 seconds)","Read the chain with raw JSON-RPC (zero dependencies)","Read the chain with viem","Use a faster RPC (when the public one isn&#39;t enough)","Skip the boilerplate: the hoodchain client","Troubleshooting","What you learned"],"text":"Talk is cheap. In the next five minutes you'll connect to Robinhood Chain and pull real data off it — the current block height, the chain ID, and the gas price — with about fifteen lines of code. No wallet, no funds, no signup. Reads are free and public. # Add the network to a wallet (optional, 60 seconds) You don't need a wallet for reads, but if you want to poke around a block explorer with a browser wallet, add the network manually. In MetaMask: Settings → Networks → Add network → Add manually , then: For anything that spends, use testnet (chain ID 46630 , RPC https://rpc.testnet.chain.robinhood.com ) and claim funds from the faucet first. The faucet needs a real browser The testnet faucet is behind Cloudflare Turnstile and Google Sign-In — it can't be scripted. It drips 0.01 ETH plus five of each test Stock Token (TSLA, AMZN, PLTR, NFLX, AMD) per 24 hours. Claim once, up front, and reuse that wallet for every write tutorial. There's also a Chainlink faucet for testnet LINK/ETH. # Read the chain with raw JSON-RPC (zero dependencies) Before any library, prove the RPC is real with nothing but curl . This asks the node for its chain ID: 0x1237 is 4663 in decimal — the mainnet chain ID. The chain is answering. That's the entire foundation of everything that follows. You just saw the landing page's secret The live stats strip on this site's home page is doing exactly this — plain fetch calls to that same RPC from your browser. Read-only chain access needs no backend, no key, and no SDK. That property is why so much of this course runs client-side. # Read the chain with viem curl is fine for a sanity check; for real work you want typed results and helpers. Install viem: Create read.ts (or .mjs ) and paste: Run it: That block number was live when this tutorial was written; yours will be higher, because Robinhood Chain produces a new block roughly every 100 milliseconds. Do the math: that's on the order of half a million blocks a day. Keep it in mind when you scan historical logs later — \"the last hour\" is tens of thousands of blocks. # Use a faster RPC (when the public one isn't enough) The public RPC is perfect for learning and light apps, but it rate-limits. The moment you're scanning large block ranges or serving users, move to a dedicated endpoint. Alchemy is the recommended provider: You'll feel the difference immediately in Tutorial 7 when scanning launchpad history — the public RPC will return 429 Too Many Requests on a wide scan; a dedicated key won't. # Skip the boilerplate: the hoodchain client Everything above is standard viem. As your app grows you'll want the batteries-included client from the hoodchain SDK — it wraps viem with multicall batching on by default, both networks pre-wired, and an optional wallet: hood.public is a normal viem PublicClient , so nothing you learned is wasted — the SDK just removes the setup. From the next tutorial on, we use createHoodClient because it also knows about Stock Tokens, feeds, and swaps, which raw viem does not. When you need to drop to the metal, hood.public and hood.wallet are right there. # Troubleshooting Cannot use import statement outside a module — add \"type\": \"module\" to your package.json ( npm pkg set type=module ), or use the .mjs extension. fetch failed / ECONNREFUSED — check the RPC URL for a typo; it's rpc.mainnet.chain.robinhood.com , no port, HTTPS. Confirm you have network access with the curl command above. npx tsx is slow the first time — tsx is being downloaded. Install it once ( npm i -D tsx ) to make subsequent runs instant. The block number looks huge / grows while you watch — that's correct. ~100 ms blocks. It's a feature, not a bug. # What you learned You connected to Robinhood Chain three ways — raw curl , plain viem, and the hoodchain client — and read live data with each. You know reads are free and keyless, why block numbers are enormous, and when to upgrade off the public RPC. Next, the one concept that makes Stock Tokens different from every other E"},{"slug":"03-stock-tokens-explained","title":"Stock Tokens explained for developers","section":"Foundations","index":"03","description":"ERC-20 + a Chainlink feed + ERC-8056 uiMultiplier(). The split/dividend trap, with a worked example showing the wrong and the right valuation.","headings":["Anatomy of a Stock Token","The multiplier, and why it exists","The trap: which number do you multiply by the price?","A worked example","Doing it correctly, with the SDK","Not every token has a feed","Troubleshooting","What you learned"],"text":"If you remember one page from this course, make it this one. Stock Tokens look like ordinary ERC-20s, and 95% of the time they behave like ordinary ERC-20s. It's the other 5% — corporate actions like splits and dividends — that quietly breaks naive integrations and reports the wrong dollar value to a user. Here's exactly how they work, and the one worked example that makes the trap impossible to fall into. # Anatomy of a Stock Token A canonical Stock Token on Robinhood Chain is three things bolted together: A plain ERC-20 , 18 decimals. balanceOf , transfer , approve — all the usual methods, nothing surprising. A Chainlink price feed — a separate contract, one per token, exposing latestRoundData() and answering with an 8-decimal USD price. An ERC-8056 uiMultiplier() — a single function returning a 1e18 -scaled ratio that encodes every corporate action the underlying stock has had. Every canonical Stock Token proxies to one shared Stock beacon contract, which is how the hoodchain SDK verifies that an address is a real Stock Token and not a lookalike: it checks the EIP-1967 beacon slot points at that one shared beacon. # The multiplier, and why it exists Stocks split. They pay dividends. A traditional token would handle a 2-for-1 split by rebasing — doubling everyone's balance overnight. Rebasing tokens are notoriously hostile to integrators: your cached balances silently go wrong, and every DeFi protocol that holds the token has to special-case it. Robinhood Chain took the other path. Balances never change from corporate actions. Instead, uiMultiplier() moves. It's the shares-per-token ratio, scaled by 1e18 : 1000000000000000000 (i.e. 1e18 ) → 1 token represents 1 share. This is the starting state for every token. After a reinvested dividend or a split adjustment, it rises above 1e18 . Your token balance is unchanged; each token now represents more than one share of economic exposure. So a Stock Token has two different quantities you can ask about, and they answer different questions: Quantity Formula Answers Token balance balanceOf(you) \"How many tokens do I hold?\" Share-equivalent balance × uiMultiplier ÷ 1e18 \"How many shares of the stock is that?\" # The trap: which number do you multiply by the price? Here's where integrations break. You have a token balance, a multiplier, and a Chainlink price. To get a USD value, which do you multiply? The instinct — and it's wrong — is: shares × price . That is, balance × multiplier × price . It feels right (\"value = number of shares times price per share\"), and it produces a number that looks plausible. After a corporate action, it is too high , because you've counted the multiplier twice. The reason: Robinhood's Chainlink feeds are already multiplier-adjusted . The feed for a Stock Token returns the total-return price of one token , not the price of one underlying share. The corporate action is baked into the feed answer. So: The rule, memorize it USD value = token balance × feed price. Nothing else. The feed price already includes the multiplier. Applying uiMultiplier to the value double-counts every split and dividend. Use uiMultiplier only to report share-equivalents to a human — never in a valuation. # A worked example Suppose a token has had a corporate action, so its multiplier is 1.5e18 (each token now represents 1.5 shares). You hold 10 tokens. The Chainlink feed answers 20000000000 — that's $200.00 at 8 decimals, and remember, that's the price of one token . Wrong (double-counts the multiplier): Right (feed price is per token, already adjusted): The wrong version overstates the position by exactly the multiplier — a 50% error here. On a real portfolio dashboard that's the difference between a user trusting your app and closing it forever. And the share count itself is still useful — you'd show \"10 tokens ≈ 15 shares\" as context — you just don't put it in the dollar math. The feed answer isn't stale on weekends — it's closed Stock feeds update 24/5, following market hours. Read"},{"slug":"04-live-price-ticker","title":"Your first app: a live price ticker","section":"Building","index":"04","description":"Build a terminal price ticker that streams multiplier-adjusted Chainlink quotes for any Stock Token, with staleness handling done right.","headings":["The naive version (and why we won&#39;t ship it)","The real ticker","Add the multiplier, for context","A browser version (no backend needed)","Troubleshooting","What you built"],"text":"Time to build something that runs. A live price ticker is the \"hello world\" of market data: it reads prices, formats them, and refreshes. By the end you'll have a terminal that streams multiplier-adjusted Chainlink quotes for any Stock Token — and you'll have handled the two things beginners skip, staleness and unpriced tokens. # The naive version (and why we won't ship it) You could read a Chainlink feed directly and print the answer: This works, but it hardcodes an address, ignores whether the round is complete, and will happily print a price from a feed that hasn't updated in a month. We can do better in the same number of lines. # The real ticker getQuote from the hoodchain SDK does the address lookup, the multiplier-correct interpretation, the staleness guard, and the answer validation. Create ticker.ts : Run it: Those are real prices, pulled live while writing this. The feed ages are ~40 hours because this run happened over a weekend — the market was closed, the feeds paused, and our 7-day window correctly accepted them instead of throwing. That's the staleness handling from Tutorial 3, doing its job in production. Every design decision here is deliberate 15-second interval, not 1s. Chainlink stock feeds update on the order of minutes to hours, gated by a heartbeat and a deviation threshold. Polling every second just wastes RPC calls to see the same number. Promise.all , not a loop. All symbols are fetched concurrently; the ticker's latency is one RPC round-trip, not N of them. Typed catches. FeedNotFoundError and StaleFeedError are distinct outcomes with distinct UI — \"no feed\" is permanent, \"stale\" is temporary. Never collapse them into a generic \"error.\" # Add the multiplier, for context Users like to see share-equivalents. Remember the Tutorial 3 rule: the multiplier is for display , never for the dollar math. Add it as a separate column: For the mega-cap tickers above, the multiplier is 1.0000 — no corporate action since the token launched. When one does have a split or dividend, this column is where you'd surface it, while your USD math stays untouched. # A browser version (no backend needed) Everything here works client-side too — that's how this site's home-page ticker runs. In a browser you'd skip the SDK's Node bits and hit the RPC with fetch , decoding latestRoundData() yourself (the answer is the second 32-byte word of the response). The ticker.js on this very site is a complete, dependency-free reference for that — read it if you want the raw JSON-RPC version. # Troubleshooting Every symbol prints stale — your maxAgeSeconds is too tight for the current time (weekend/holiday). Widen it. During market hours you can go as tight as the feed's heartbeat. UnknownSymbolError — the ticker you passed isn't in the registry. Symbols are case-insensitive tickers as listed on-chain. Run listStockTokens() to see all 95, or listPricedStockTokens() for the priceable ones. Screen flicker on redraw — the \\x1b[2J\\x1b[H clear-and-home is crude but portable. For a polished TUI, reach for a library like blessed or ink ; for a learning ticker, the escape codes are fine. 429 Too Many Requests — you're on the public RPC and polling too hard, or running several scripts at once. Raise the interval or switch to an Alchemy endpoint (Tutorial 2). # What you built A real, live, multiplier-correct price ticker with proper staleness and unpriced-token handling — the market-data foundation every other app in this course builds on. Next, we take reads a step further: valuing an entire portfolio in a single call, and getting it right where naive trackers get it wrong."},{"slug":"05-portfolio-tracker","title":"Portfolio tracker done right","section":"Building","index":"05","description":"Value any address's Stock Token holdings in one multicall — and understand exactly why a naive tracker reports the wrong number after a split.","headings":["Why &quot;just loop and call balanceOf&quot; doesn&#39;t scale","The right approach: one multicall","What getPortfolio is actually doing","Correctness, proven, not asserted","Handling the unpriced case in a UI","Troubleshooting","What you built"],"text":"Every wallet tracker on every chain does the same thing: enumerate token balances, price them, sum them. On Robinhood Chain, that naive recipe is wrong twice — once from the multiplier trap (Tutorial 3), and once from the sheer number of round trips a naive implementation makes. This tutorial builds the tracker correctly: one multicall sweep, multiplier-correct valuation, and an honest treatment of holdings that can't be priced. # Why \"just loop and call balanceOf\" doesn't scale There are 95 Stock Tokens in the registry. A naive tracker does: That's 95 sequential RPC round trips before you've even started pricing anything. On the public RPC, each round trip is real latency — this loop takes seconds and burns your rate limit for nothing, since most addresses hold a handful of these tokens at most. # The right approach: one multicall viem's public client (used by hoodchain ) batches calls into Multicall3 automatically when batch: { multicall: true } is set — which createHoodClient() does for you. So the fix is almost free: fire all 95 balanceOf reads as a single batch, filter to the ones that are actually held, then multicall those for balance + multiplier together, and multicall the feeds for pricing. That's what getPortfolio does under the hood: Run it against any address (this example uses the Multicall3 deployer, a busy contract address, purely to demonstrate the zero-holdings path): That's the honest empty state — the tracker checked all 95 tokens in one batch and confirmed zero holdings, rather than silently returning nothing. Point it at a wallet that actually holds Stock Tokens (your testnet wallet from Tutorial 2, once funded, or any address you find via the explorer) and you'll see rows like: # What getPortfolio is actually doing Reading the source is worth five minutes, because the pattern generalizes to any multi-asset dashboard you'll ever build: One multicall for balanceOf across all 95 registry tokens, allowFailure: false — if this fails, something is fundamentally wrong (bad RPC), so let it throw. Filter to non-zero balances. Most wallets hold a handful of tokens; there's no reason to fetch multiplier and feed data for tokens you don't own. A second multicall , this time for balanceOf + uiMultiplier() together, only over the held tokens. A third multicall for feed prices , allowFailure: true — a single bad feed (stale, or a reverting call) shouldn't take down the whole portfolio. Positions with a failed feed fall back to valueUsd: null . Valuation , per the Tutorial 3 rule: valueUsd = balanceTokens × quote.priceUsd . Multiplier is used only for shareEquivalent , never for valueUsd . Total RPC round trips for a full 95-token sweep: three , regardless of how many tokens the wallet actually holds. That's the difference between a tracker that feels instant and one that spins for ten seconds. # Correctness, proven, not asserted It's easy to claim multiplier-correct math. The SDK's live test suite instead cross-checks its share-equivalent computation against the token contract's own balanceOfUI() — a view function the Stock Token contracts expose that does the same multiplication on-chain. If the SDK's shareEquivalent field and the contract's balanceOfUI() ever disagree, the test fails. That's the standard to hold your own money-math code to: don't just compute a number, find an independent on-chain source of truth and assert equality against it. # Handling the unpriced case in a UI portfolio.unpricedSymbols exists because 95 tokens exist but only a subset have a live Chainlink feed (34 at the time of writing). A dashboard that silently omits unpriced holdings is lying by omission — a user who holds one would wonder where it went. Show it, clearly labeled as unpriced, and let totalUsd reflect only what could actually be valued: # Troubleshooting Portfolio total looks wrong after I know a token split — you're computing value somewhere outside getPortfolio , and you're multiplying by the multiplier. Revisit Tutorial 3; t"},{"slug":"06-swapping-on-chain","title":"Swapping on-chain: quotes, slippage, execution","section":"Building","index":"06","description":"Quote a Uniswap v3 swap across every fee tier, set slippage correctly, and execute on testnet — with a Stock Token eligibility sidebar.","headings":["The routing problem","Getting a real quote (mainnet, read-only, no wallet needed)","Building and sending the transaction","Two router flavors, handled for you","The eligibility gate","Slippage and deadlines, tuned correctly","Testnet verification status","Troubleshooting","What you built"],"text":"Swapping is where reads become writes, and where a single wrong assumption costs real money. This tutorial covers all three layers — quoting a route, protecting yourself with slippage, and sending the transaction — plus the eligibility gate that exists specifically because some of the tokens you can swap into are regulated securities. # The routing problem Robinhood Chain's DEX layer is Uniswap v3. A v3 pool exists per token pair per fee tier (0.01%, 0.05%, 0.3%, 1%), and plenty of those pools exist with zero liquidity — deployed, but never seeded. A naive swap implementation that assumes \"the 0.3% pool\" will revert constantly. The right approach probes every fee tier for a direct route, plus two-hop routes through common intermediates (WETH, USDG), and picks whichever produces the best output. That's what quoteSwap does. # Getting a real quote (mainnet, read-only, no wallet needed) This runs right now, with no funds and no risk — quoting is a simulated call, not a transaction: That's a live capture: 100 USDG quoted at 0.0555 WETH , filled through the 0.01% fee tier. Note the router picked a two-hop path even though fees.join() shows one number — quoteSwap probes single-hop routes across all four tiers and two-hop routes through WETH/USDG, and the winner here happened to be the tightest single-tier pool. Run it again in your own terminal and you'll get a live number of your own; Uniswap v3 pricing moves with every block. USDG has 6 decimals, not 18 This is the single most common bug in a Robinhood Chain integration. USDG deliberately mirrors USDC's convention, unlike most L2-native stables which use 18. Always use the SDK's parseUsdg / formatUsdg helpers instead of hardcoding a decimals count — they encode the correct value so you can't get it wrong. # Building and sending the transaction A quote alone doesn't move funds. buildSwapTx turns a quote into calldata with a slippage-protected minimum output and a deadline; executeSwap does the whole pipeline — quote, build, approve if needed, send, confirm — in one call: Under the hood, executeSwap : Calls quoteSwap to find the best route. Calls buildSwapTx to encode calldata with amountOutMinimum set from your slippage tolerance (default 0.5%, slippageBps: 50 ) and a deadline (default 10 minutes). Calls ensureApproval — checks the router's current allowance and sends an approve only if it's short , so a second swap of the same token doesn't re-approve for no reason. Sends the transaction and waits for the receipt. # Two router flavors, handled for you Mainnet routes through SwapRouter02 (no deadline field in the call struct — it's enforced by wrapping the call in multicall(deadline, [data]) ). The testnet community deployment uses the classic SwapRouter , whose struct carries deadline directly. buildSwapTx detects which network you're on and encodes the right shape automatically — this is exactly the kind of chain-specific footgun a good SDK exists to remove. # The eligibility gate Every canonical Stock Token is a regulated security under the restriction from Tutorial 1: it may not be offered, sold, or delivered to US persons. buildSwapTx enforces this at the SDK boundary — any swap whose output is a canonical Stock Token throws before it builds calldata , unless you've explicitly affirmed eligibility: To proceed, the operator — not the end user, the person deploying the software — affirms eligibility explicitly: This default-closed design is worth copying even outside this SDK: gate the risky path, not the safe one. Reads and sells of Stock Tokens are never restricted — only acquisition is, matching the actual legal restriction. Not a substitute for real compliance This flag is a development safety rail, not a KYC system. If you're building a real product that lets users acquire Stock Tokens, you need actual jurisdiction detection and legal review — this flag just stops you from accidentally shipping an unrestricted buy button. # Slippage and deadlines, tuned correctly The default"},{"slug":"07-streaming-the-chain","title":"Streaming the chain: launchpads + firehose","section":"Building","index":"07","description":"Watch NOXA and The Odyssey for new memecoin launches, then tap the raw sequencer firehose to see transactions ~100ms before they're queryable.","headings":["Two memecoin launchpads, two designs","Watching for new launches","Proving the decoder works: a historical scan","The raw sequencer firehose","How the decoding works","A simpler alternative: watching confirmed transfers","Troubleshooting","What you built"],"text":"Robinhood Chain moves fast — ~100ms blocks, hundreds of transactions per second at peak. This tutorial covers the two ways to watch it live: confirmed event streams (launchpad watchers, the pattern you'll use for almost everything) and the raw sequencer firehose (transactions decoded before they're even in a block). Both examples below are real captures against mainnet. # Two memecoin launchpads, two designs Robinhood Chain is permissionless (Tutorial 1), and two launchpads have grown on top of it, with genuinely different mechanics: NOXA — an instant launcher. One transaction deploys the ERC-20, creates a Uniswap v3 pool at the 1% tier, seeds single-sided liquidity, and permanently locks the LP NFT. There's no bonding curve and no graduation — the token trades as a normal Uniswap v3 pool from block one. The Odyssey — a pump.fun-style bonding curve , priced in native ETH with virtual reserves. Trades happen against the curve ( Traded events) until it fills, at which point PoolCompleted + PoolMigrated fire and liquidity moves to a locked Uniswap v3 pool — the \"graduation\" moment. The hoodchain SDK ships decoded event ABIs and watcher functions for both, extracted from each platform's frontend bundle and confirmed against live logs during SDK development (neither publishes verified source on Blockscout, so this took direct log inspection rather than an ABI download). # Watching for new launches Running getRecentLaunches with the default 30,000-block lookback (roughly the last hour) against live mainnet returned zero launches at the time of writing — both launchpads were genuinely quiet in that window. That's a real, useful data point about the current state of the ecosystem, not a bug: widening the scan confirms the watcher logic itself is correct. # Proving the decoder works: a historical scan To confirm getRecentLaunches actually decodes NOXA's TokenLaunched event correctly (rather than just returning zero because nothing happened), scan the 9,000 blocks starting at NOXA's own recorded deploy block: Real result: 21 launches , decoded correctly, first token address included. The watcher works; the launchpads have simply had quiet stretches. This is a useful verification technique generally — when a live \"recent activity\" query returns zero, don't assume it's broken; confirm the decoder against a window you know had activity before you trust the \"quiet\" result. The public RPC rate-limits wide scans Scanning a million-block window ( lookbackBlocks: 1_000_000n ) against the public RPC returned a real 429 Too Many Requests from eth_getLogs during testing — even with getRecentLaunches 's built-in chunking ( chunkSize , default 10,000 blocks per request). For anything beyond a rough \"last hour or two\" scan, use a dedicated RPC key (Tutorial 2) or narrow your chunk size further. # The raw sequencer firehose Confirmed-event watching (above) is what you want for almost everything — it's simple and it's what block explorers show. But Robinhood Chain also publishes its Arbitrum Nitro sequencer feed directly: every transaction the sequencer accepts, decoded, ~100–300ms before it's queryable over RPC . That latency matters for MEV-sensitive or ultra-low-latency use cases; for everyone else it's a fascinating window into how much traffic the chain actually carries. A real 12-second capture against wss://feed.mainnet.chain.robinhood.com : 6,451 real transactions in 12 seconds — over 500 tx/s sustained. That number alone tells you Robinhood Chain is carrying meaningfully more traffic than a quiet L2; at ~100ms blocks, that's roughly 50+ transactions landing in every block. If your mental model of activity on this chain came from watching a slow block explorer feed, the firehose is a useful correction. # How the decoding works The sequencer publishes frames matching the Nitro broadcast feed shape: a header (kind, sender, L1 block number, timestamp) plus a base64 l2Msg payload. The first byte of the decoded payload is the message kind — 0x04 ( S"},{"slug":"08-sell-your-api-for-usdg","title":"Sell your API for USDG with x402","section":"Monetizing & agents","index":"08","description":"Put a Stock Token data endpoint behind an HTTP 402 paywall settled in USDG, and take your first real on-chain payment — from zero to a paid request.","headings":["How x402 actually works","A gap worth naming up front","The server","The client","What was verified, and what&#39;s a documented gap","Hardening for production","Troubleshooting","What you built"],"text":"You've built a live price ticker (Tutorial 4) and a portfolio tracker (Tutorial 5). Both produce data other people would pay for. This tutorial turns one into a paid API using x402 — the HTTP-native payment protocol that resurrects status code 402 Payment Required — settled in USDG on Robinhood Chain. # How x402 actually works The protocol is deliberately simple, and worth understanding at the wire level before you write any code: A client requests a paid endpoint with no payment attached. The server responds 402 Payment Required with a JSON body describing what it costs, in which token, on which chain, paid to which address. The client constructs a payment (an EIP-3009 transferWithAuthorization , or a plain on-chain transfer), signs it, and retries the request with an X-PAYMENT header carrying the payment payload. The server verifies the payment is valid and sufficient, serves the response, and optionally settles the transfer on-chain. No API keys, no subscription billing, no dashboard. The payment is the auth. # A gap worth naming up front x402's reference implementation (the x402 / x402-express npm packages, and the hosted x402.org facilitator) ships built-in support for specific EVM networks — Base and Base Sepolia primarily — verifying EIP-3009 signatures against known USDC deployments there. Robinhood Chain is not one of the pre-configured networks , and USDG does not implement EIP-3009 or EIP-2612 (confirmed in Tutorial 6 — it has no permit -family functions at all, verified against its Blockscout-verified implementation). That rules out gasless signature-based payment for USDG entirely. So this tutorial teaches the pattern that does work today: a hand-rolled 402 flow that verifies a real, mined USDG transfer on-chain , using the hoodchain SDK you already know. It's more code than dropping in x402-express 's one-liner, but it's honest about what's actually deployed, and it generalizes to any chain or token a hosted facilitator hasn't caught up to yet. # The server # The client # What was verified, and what's a documented gap The server code above — this exact route, verification logic included — was run locally against live mainnet reads, and three cases were checked by hand with curl : No X-PAYMENT header → real 402 with the challenge body. ✅ A fabricated X-PAYMENT (a made-up transaction hash) → getTransactionReceipt correctly returned null , rejected with 402 . ✅ A real, successfully-mined mainnet transaction hash — but one that never paid PAY_TO anything → this was wrongly accepted ( 200 OK ) by an earlier version of this route. That third case is not a hypothetical: it's what happened when this tutorial's code only checked \"a Transfer log exists on the USDG contract address\" instead of decoding who it paid and how much . Any already-mined USDG transfer by any party — unrelated to this API entirely — satisfied that check. The code above (with parseEventLogs and the explicit to / value comparison) is the fix, re-verified against the same three cases with the correct outcome in all three. This is why the tutorial ships the fixed version, not the first one written — treat it as a demonstration of exactly the kind of bug a \"just check a log exists\" shortcut produces, and why decoding the actual event arguments is not optional. A real, funded USDG payment that this route accepts end-to-end was not captured in this environment, for the same reason as Tutorial 6's testnet swap: it requires a funded wallet from the browser-gated testnet faucet, which wasn't available here. If you fund a wallet and run both halves above, the flow completes exactly as written — and, per the fix above, will correctly reject any transaction that isn't a real payment to your PAY_TO address. `scheme: 'onchain-transfer'` is not a registered x402 scheme The official x402 spec defines schemes like exact (EIP-3009) with specific verification semantics that facilitators implement. This tutorial's hand-rolled verification is compatible with the x402 wir"},{"slug":"09-ai-agent-chain-access","title":"Give your AI agent chain access with MCP","section":"Monetizing & agents","index":"09","description":"Build a Model Context Protocol server that exposes Robinhood Chain reads as tools, then wire it into Claude Code, Claude Desktop, or Cursor — with a real transcript.","headings":["What MCP actually is","The server","A real transcript","Connecting to Claude Code","Connecting to Claude Desktop","Connecting to Cursor","Troubleshooting","What you built"],"text":"An AI coding assistant is only as useful as the tools it can call. This tutorial builds a Model Context Protocol (MCP) server that exposes Robinhood Chain reads — quotes, portfolios, the registry — as tools any MCP-compatible assistant can invoke, then wires it into Claude Code, Claude Desktop, and Cursor. Everything below was run against a real MCP client, not described secondhand. # What MCP actually is MCP is a JSON-RPC-based protocol that lets an AI assistant discover and call tools exposed by a separate process — your server. The assistant doesn't need special Robinhood Chain knowledge baked in; it needs your server to expose well-described tools, and it reasons about when to call them. This is the same shape as the paid MCP tools you may have already used from three.ws ( forge_free , crypto_news , and friends) — except here, you're the one writing the server. # The server Three tools: a live quote, a portfolio valuation, and a registry listing — the exact operations from Tutorials 4 and 5, now callable by an LLM instead of a terminal script. Notice what this server does not do: no wallet, no write tools, no private key. Read-only MCP tools need none of that — exactly the same \"reads are free and keyless\" property from Tutorial 2. A write-capable version (place a swap, transfer USDG) is a natural extension, but it should prompt for confirmation before every transaction — treat an LLM's tool call exactly like a user action, not an autonomous decision, for anything that spends. # A real transcript Rather than describe what connecting an assistant would show, here's an actual MCP client — built with the same @modelcontextprotocol/sdk package — connecting over stdio, listing the server's tools, and calling two of them against live mainnet: This is the exact protocol exchange an assistant like Claude performs when it decides to call get_stock_quote — a real handshake, a real tool list, a real live price. The 34 matches the priced-token count from Tutorial 3; if that number drifts as Chainlink adds feeds, your server will report it correctly without any code change, because it reads the SDK's registry live rather than hardcoding a count. # Connecting to Claude Code Claude Code discovers MCP servers from a project or user config. Add this server with the CLI: Or add it directly to .mcp.json in your project root: Restart Claude Code (or run /mcp to reconnect) and ask something like \"What's the live price of TSLA on Robinhood Chain?\" — Claude will call get_stock_quote and answer from the real response, not from training data (which has no idea Robinhood Chain exists, or that it launched in July 2026). # Connecting to Claude Desktop Claude Desktop reads its MCP config from claude_desktop_config.json ( Settings → Developer → Edit Config opens the file directly): Fully restart the app after editing (not just close the window) for the new server to be picked up. # Connecting to Cursor Cursor uses the same MCP config shape, in .cursor/mcp.json at your project root or ~/.cursor/mcp.json globally: Open Cursor Settings → MCP to confirm the server shows as connected with its three tools listed. # Troubleshooting Server doesn't show up / \"0 tools\" — double-check the args path is absolute, not relative; MCP host apps don't inherit your shell's working directory. Run node /absolute/path/to/server.mjs by hand first — if it hangs waiting on stdin with no error, that's actually correct (stdio transport blocks reading for the next message); Ctrl-C to confirm it started without throwing. Tool call errors with UnknownSymbolError surfaced as a generic failure — MCP wraps thrown errors into an error-content response by default; add a try/catch per tool if you want to return a structured, LLM-readable error message instead of a stack trace. Assistant answers from stale training knowledge instead of calling the tool — make your tool description field more specific about when to use it (\"always use this for current Robinhood Chain prices — do not answer"},{"slug":"10-autonomous-trading-agent","title":"Build an autonomous trading agent","section":"Monetizing & agents","index":"10","description":"A paper-mode trading agent with a real strategy, hard spend caps, and a kill switch — risk-first framing before a single lira of real capital.","headings":["Design the risk controls first","A minimal strategy: dip detection, paper mode","Going from paper to real (the parts that change, and don&#39;t)","Logging and observability","Troubleshooting","What you built"],"text":"Read this section before the code An autonomous trading agent is software that spends money without asking you first, every time it runs. Every idea below is built with a hard spend cap , a kill switch , and paper mode as the default — not as afterthoughts, but as the first things written. If you take nothing else from this page: never remove the spend cap \"just to test something real,\" and never run an agent with a live wallet key until you've watched it behave correctly in paper mode for longer than you think is necessary. This is not investment advice, and nothing here is a strategy anyone should expect to be profitable. It's a template for the engineering of an agent that spends — the risk controls transfer to any strategy you actually design. # Design the risk controls first Before a single line reads a price, decide three things: Per-trade spend cap — the maximum a single trade can move, regardless of what the strategy wants. Period spend cap — a rolling limit (daily is typical) that trips even if every individual trade was within its own cap. Kill switch — a way to stop the agent immediately and safely, mid-loop, without corrupting state. Notice the kill switch doesn't process.exit(0) immediately. If the agent is mid-way through building a transaction when SIGINT fires, you want it to either finish that operation cleanly or not have started it — never leave a half-sent transaction or a corrupted spend counter. Setting a flag and checking it at loop boundaries is the safe pattern. # A minimal strategy: dip detection, paper mode This agent watches a basket of Stock Tokens, and on a mainnet dip beyond a threshold, logs what it would buy — respecting both spend caps — without ever building or sending a transaction: Run it against real mainnet quotes: A real, unedited capture from a 15-second run: Notice what this doesn't show: a fabricated trade. This capture ran over a weekend, when Chainlink stock feeds are closed (Tutorial 3) — the prices genuinely didn't move between ticks, so the agent correctly held every time. That's the right behavior, not a disappointing demo. Never fake a trade to make a tutorial look more exciting than the real market was at the time you wrote it — that habit is exactly how you end up trusting an agent's logs that lie to you. # Going from paper to real (the parts that change, and don't) When you're ready to let the agent actually spend, the strategy logic above is untouched. What changes is narrow and specific: The spend caps, the kill switch, and the strategy decision are identical code — only the final action ( console.log vs. executeSwap ) changed. That's by design: if your paper-mode agent and your live agent share every line except the actual send, you can trust that what you watched in paper mode is what will happen live. If they're structurally different code paths, you're testing something you're not shipping. Start with an amount you'd be fine losing entirely Even with caps and a kill switch, a strategy can be wrong, a feed can behave unexpectedly, or a bug can exist in code you wrote an hour ago. DAILY_SPEND_CAP_USDG = 100 is a ceiling, not a promise of safety. Fund the live wallet with exactly what you're prepared to lose, and nothing more, for at least the first several days of live operation. # Logging and observability An agent with no audit trail is an agent you can't debug after the fact. At minimum, persist (to a file or a database, not just stdout) every: quote observed, decision made and why, transaction sent with its hash, and cap-triggered skip. When something looks wrong three days from now, you want to reconstruct exactly what the agent saw and decided, not just what it did. # Troubleshooting Agent never trades, even during a volatile market — check DIP_THRESHOLD_PCT isn't set unreasonably high for the volatility of your basket, and confirm getQuote isn't throwing StaleFeedError silently (wrap the tick loop's body in a try/catch per symbol so one bad feed doesn't kill the w"},{"slug":"11-launch-a-coin","title":"Launch a coin programmatically","section":"Monetizing & agents","index":"11","description":"How Robinhood Chain's launchpads work, how to decode their events, and the responsible path to launching a token on testnet from code.","headings":["A fuller launch monitor","What &quot;launch a coin programmatically&quot; actually requires — and a real gap","The responsible path today","What a launch monitor is good for right now","Troubleshooting","What you built"],"text":"Tutorial 7 taught you to watch NOXA and The Odyssey. This tutorial takes it one step further — a live launch monitor with fuller event decoding — and then gives you an honest account of what programmatic launching actually requires today, including a real gap this course found and didn't paper over. # A fuller launch monitor Extend the watcher from Tutorial 7 to decode every field each platform's events carry, so you can react to specific launch shapes rather than just \"something launched\": This is exactly the decoding verified in Tutorial 7 against 21 real historical NOXA launches — extended here with curve-trade and graduation handling for Odyssey specifically. If you're building a trading bot or an alert system (Tutorial 16-style tooling), this is the complete event surface you'd hook into. # What \"launch a coin programmatically\" actually requires — and a real gap Watching launches only requires decoding events , which are public and don't need a verified ABI — you can decode a known event signature off any contract, verified or not. Sending a transaction that creates a new launch is different : it requires the factory contract's write function signature — argument names, types, and order — which you can only get reliably from a verified source contract, or by painstakingly reverse-engineering calldata from a real transaction. This course checked both launchpads' factory contracts against the Blockscout API before writing this page: Neither the NOXA launch factory ( 0xD9eC2db5f3D1b236843925949fe5bd8a3836FCcB ) nor The Odyssey's bonding-curve factory ( 0xEb3FeeD2716cF0eEAda05B22e67424794e1f5a80 ) returns verified source through Blockscout's API — confirming what the hoodchain SDK's own source comments already note: \"neither publishes verified source on Blockscout.\" That's why the SDK ships event ABIs only (for the read/watch path you used above) and no write-function ABI for either factory — extracting one would mean either reverse-engineering calldata from real launch transactions or asking the platforms directly, and doing that with unverified confidence long enough to publish it as \"the\" launch function would risk shipping guessed calldata that either fails or, worse, succeeds with the wrong parameters. We will not publish a guessed function signature It would be easy to fill this section with a plausible-looking createToken(name, symbol, supply, ...) call. It would also be irresponsible: an unverified guess at a factory's write interface, if wrong, can burn real gas on a failed transaction or — worse — succeed with parameters you didn't intend (wrong fee tier, wrong initial liquidity split, wrong lock terms). This course only ships code that was actually run and verified. For the launch-transaction write path specifically, that bar isn't met yet. # The responsible path today Until a launch factory's write ABI is verified from a primary source, the correct way to launch a token on NOXA or The Odyssey is through the platform's own front-end (fun.noxa.fi/robinhood, theodyssey.fun) — it already encodes the correct calldata, has been tested against the live contract by its own team, and gives you a UI to review exactly what you're about to deploy before you sign. That's not a cop-out; it's the same advice you'd give anyone about to send a transaction to a contract they don't have a verified interface for. If you want to pursue the programmatic path yourself: launch a token through the front-end once , on testnet, with a throwaway wallet, then pull the transaction's calldata from the explorer and decode it against the four-byte selector directory or by testing candidate ABIs against eth_call in simulation. That reverse-engineering work is exactly what standing up a verified, publishable write-ABI would require — and it's future work this course is flagging rather than rushing. # What a launch monitor is good for right now None of the above weakens the read side. A production-quality launch monitor — alerting, filtering by crea"},{"slug":"12-ship-it","title":"Ship it: deploy and go mainnet","section":"Capstone","index":"12","description":"Deploy your static app to Pages, your API to Cloud Run, and walk the going-mainnet checklist: funding, keys, spend caps, and monitoring.","headings":["Deploying a static app: GitHub Pages","RPC calls from a static site","Deploying a server: Google Cloud Run","An alternative: Vercel","The going-mainnet checklist","Funding","Keys","Spend caps","Compliance","Correctness","Infrastructure","Monitoring","Where to go from here"],"text":"Everything in this course has been real, run code. This capstone is about the last mile: getting what you built in front of actual users, and the checklist to walk before you let it touch mainnet with real money. # Deploying a static app: GitHub Pages If what you built is client-side — a ticker, a portfolio dashboard, anything using only hood.public reads (Tutorials 2, 4, 5, 7) — it needs no backend at all. This very site is the reference example: it's a static build in docs/ , deployed from a branch. One-time setup: Push your repo to GitHub. Settings → Pages → Build and deployment → Source: \"Deploy from a branch.\" Branch: main , folder: /docs . Save. Your site is live at https://<username>.github.io/<repo>/ within a minute or two. That's the entire deployment. No build step runs on GitHub's infrastructure — you commit the already-built docs/ folder, exactly as this repo does. Re-deploying is npm run build && git add docs && git commit && git push . Why deploy-from-branch instead of a GitHub Actions build It's simpler, it's faster (no CI queue), and it means what's live is exactly what you built and tested locally — no environment drift between your machine and a CI runner. The tradeoff is you must remember to run the build before committing; a pre-commit hook or a habit covers that. # RPC calls from a static site A pure static deploy still makes real, live RPC calls — straight from the visitor's browser to rpc.mainnet.chain.robinhood.com , exactly like this site's live chain-stats strip does. That's the whole trick behind \"the landing page can show live data on GitHub Pages\": public reads need no server. The only thing you can't do from a static site is anything requiring a private key or server-side secret — which brings us to Cloud Run. # Deploying a server: Google Cloud Run The moment your app needs a wallet key (an agent, Tutorial 10), verifies payments server-side (the x402 API, Tutorial 8), or holds any other secret, it needs a real backend. Google Cloud Run is a strong default: pay-per-request, scales to zero, and a straightforward Dockerfile gets you there. Two things Cloud Run requires that are easy to miss the first time: Listen on process.env.PORT , not a hardcoded port. Cloud Run injects PORT (usually 8080 ) and routes traffic there — a hardcoded 3000 will silently fail health checks. Bind to 0.0.0.0 , not localhost . app.listen(port) defaults to all interfaces in Express and is fine; some frameworks default to loopback-only, which Cloud Run can't reach. Deploy: Never bake a private key into the container image or set it with --set-env-vars in a command you'll paste into a README. Use gcloud run services update --update-secrets backed by Secret Manager, or your platform's equivalent secret store — the difference between an env var and a secret-manager binding is the difference between a key that leaks the moment someone reads your shell history and one that doesn't. # An alternative: Vercel If your app is a standard Next.js/Vite frontend with lightweight serverless API routes, Vercel remains a fine choice for the same static-plus-functions shape — deploy with vercel --prod after vercel link . Prefer Cloud Run specifically once you have a long-running process (an always-on trading agent, a WebSocket firehose consumer) — Vercel's serverless functions are request-scoped and will terminate a background loop between invocations. # The going-mainnet checklist Everything below was demonstrated somewhere in this course. This is the assembled version — walk it in order before flipping any switch that spends real money. # Funding The wallet holds only what you're prepared to lose during the first live days (Tutorial 10) — not your full intended capital. You've verified the wallet's mainnet ETH balance covers gas for your expected transaction volume; Robinhood Chain's ~100ms blocks mean a busy agent can rack up transaction count fast. # Keys The private key lives in a secret manager or env var injected at runtime — never in "}]
\ No newline at end of file
diff --git a/robinhood/learn-robinhood-chain/docs/assets/search.js b/robinhood/learn-robinhood-chain/docs/assets/search.js
new file mode 100644
index 000000000..dc3098a07
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/assets/search.js
@@ -0,0 +1,145 @@
+/* search.js — offline client-side search over a build-time index.
+ Hand-rolled: token-prefix scoring across title, headings, and body.
+ No lunr, no CDN. Opens with the "/" key or the Search button. */
+(function () {
+ 'use strict'
+
+ var modal = document.getElementById('search-modal')
+ var input = document.getElementById('search-input')
+ var results = document.getElementById('search-results')
+ var openBtn = document.querySelector('.search-open')
+ if (!modal || !input || !results) return
+
+ // index path is relative to the current page depth
+ var isHome = document.body.classList.contains('page-home')
+ var base = isHome ? 'assets/' : '../assets/'
+ var linkBase = isHome ? '' : '../'
+
+ var index = null
+ var loading = false
+ var active = -1
+ var current = []
+
+ function load() {
+ if (index || loading) return
+ loading = true
+ fetch(base + 'search-index.json')
+ .then(function (r) { return r.json() })
+ .then(function (data) { index = data })
+ .catch(function () { index = [] })
+ .finally(function () { loading = false; if (modal.hidden === false) run(input.value) })
+ }
+
+ function open() {
+ modal.hidden = false
+ document.body.style.overflow = 'hidden'
+ load()
+ setTimeout(function () { input.focus(); input.select() }, 10)
+ }
+ function close() {
+ modal.hidden = true
+ document.body.style.overflow = ''
+ active = -1
+ }
+
+ if (openBtn) openBtn.addEventListener('click', open)
+ document.addEventListener('keydown', function (e) {
+ if (e.key === '/' && !isTyping(e.target) && modal.hidden) { e.preventDefault(); open() }
+ else if ((e.key === 'k' || e.key === 'K') && (e.metaKey || e.ctrlKey)) { e.preventDefault(); modal.hidden ? open() : close() }
+ else if (e.key === 'Escape' && !modal.hidden) { close() }
+ })
+ function isTyping(el) {
+ if (!el) return false
+ var t = el.tagName
+ return t === 'INPUT' || t === 'TEXTAREA' || el.isContentEditable
+ }
+
+ modal.addEventListener('click', function (e) { if (e.target === modal) close() })
+
+ input.addEventListener('input', function () { run(input.value) })
+ input.addEventListener('keydown', function (e) {
+ var items = results.querySelectorAll('a')
+ if (e.key === 'ArrowDown') { e.preventDefault(); move(1, items) }
+ else if (e.key === 'ArrowUp') { e.preventDefault(); move(-1, items) }
+ else if (e.key === 'Enter') { if (items[active]) { e.preventDefault(); window.location.href = items[active].getAttribute('href') } else if (items[0]) { window.location.href = items[0].getAttribute('href') } }
+ })
+ function move(dir, items) {
+ if (!items.length) return
+ if (active >= 0 && items[active]) items[active].classList.remove('active')
+ active = (active + dir + items.length) % items.length
+ items[active].classList.add('active')
+ items[active].scrollIntoView({ block: 'nearest' })
+ }
+
+ function tokenize(s) { return s.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean) }
+
+ function run(query) {
+ active = -1
+ var q = query.trim().toLowerCase()
+ if (!q) { results.innerHTML = ''; return }
+ if (!index) { results.innerHTML = '<li class="search-empty">Loading index…</li>'; return }
+
+ var terms = tokenize(q)
+ var scored = []
+ for (var i = 0; i < index.length; i++) {
+ var doc = index[i]
+ var hayTitle = doc.title.toLowerCase()
+ var hayHead = doc.headings.join(' ').toLowerCase()
+ var hayBody = (doc.description + ' ' + doc.text).toLowerCase()
+ var score = 0
+ var matchedAll = true
+ for (var t = 0; t < terms.length; t++) {
+ var term = terms[t]
+ var s = 0
+ if (hayTitle.indexOf(term) !== -1) s += 12
+ if (hayHead.indexOf(term) !== -1) s += 6
+ if (hayBody.indexOf(term) !== -1) s += 2
+ if (hayTitle.split(/\s+/).some(function (w) { return w.indexOf(term) === 0 })) s += 4
+ if (s === 0) matchedAll = false
+ score += s
+ }
+ if (matchedAll && score > 0) scored.push({ doc: doc, score: score })
+ }
+ scored.sort(function (a, b) { return b.score - a.score })
+ current = scored.slice(0, 8)
+ render(terms)
+ }
+
+ function render(terms) {
+ if (!current.length) { results.innerHTML = '<li class="search-empty">No matches. Try another term.</li>'; return }
+ results.innerHTML = current
+ .map(function (r) {
+ var d = r.doc
+ var snippet = makeSnippet(d.description + ' — ' + d.text, terms)
+ return (
+ '<li><a href="' + linkBase + d.slug + '/">' +
+ '<span class="sr-section">' + esc(d.index + ' · ' + d.section) + '</span>' +
+ '<span class="sr-title">' + hl(d.title, terms) + '</span>' +
+ '<span class="sr-snippet">' + snippet + '</span>' +
+ '</a></li>'
+ )
+ })
+ .join('')
+ }
+
+ function makeSnippet(text, terms) {
+ var lower = text.toLowerCase()
+ var pos = -1
+ for (var i = 0; i < terms.length; i++) { var p = lower.indexOf(terms[i]); if (p !== -1 && (pos === -1 || p < pos)) pos = p }
+ if (pos === -1) pos = 0
+ var start = Math.max(0, pos - 30)
+ var slice = text.slice(start, start + 120)
+ return (start > 0 ? '…' : '') + hl(slice, terms) + '…'
+ }
+
+ function hl(text, terms) {
+ var out = esc(text)
+ terms.forEach(function (term) {
+ if (!term) return
+ var re = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')', 'ig')
+ out = out.replace(re, '<mark>$1</mark>')
+ })
+ return out
+ }
+ function esc(s) { return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;') }
+})()
diff --git a/robinhood/learn-robinhood-chain/docs/assets/styles.css b/robinhood/learn-robinhood-chain/docs/assets/styles.css
new file mode 100644
index 000000000..ad0dd83aa
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/assets/styles.css
@@ -0,0 +1,416 @@
+/* ==========================================================================
+ Learn Robinhood Chain — design system
+ Dark-first, theme-aware, one accent gradient. No CDN, system font stack.
+ ========================================================================== */
+
+:root,
+:root[data-theme='dark'] {
+ color-scheme: dark;
+ --bg: #0b0d10;
+ --bg-elev: #111418;
+ --bg-elev-2: #171b21;
+ --bg-code: #0e1116;
+ --border: #232a33;
+ --border-strong: #2f3946;
+ --fg: #e7ecf2;
+ --fg-muted: #9aa7b6;
+ --fg-faint: #66727f;
+ --accent: #00c805;
+ --accent-2: #34e27a;
+ --accent-ink: #04120a;
+ --accent-soft: rgba(0, 200, 5, 0.12);
+ --accent-line: rgba(0, 200, 5, 0.35);
+ --danger: #ff5c5c;
+ --warn: #ffb020;
+ --info: #4aa8ff;
+ --grad: linear-gradient(100deg, #00c805 0%, #34e27a 55%, #7bf5a8 100%);
+ --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 30px rgba(0, 0, 0, 0.35);
+
+ /* code highlighting */
+ --code-fg: #d6dee8;
+ --hl-comment: #6b7789;
+ --hl-keyword: #ff7ab2;
+ --hl-string: #79e07a;
+ --hl-number: #f2c66d;
+ --hl-title: #6cb6ff;
+ --hl-type: #7ee0c8;
+ --hl-var: #d6dee8;
+ --hl-attr: #b48ef0;
+ --hl-deletion: #ff8b8b;
+
+ --radius: 12px;
+ --radius-sm: 8px;
+ --maxw: 1320px;
+ --sidebar-w: 288px;
+ --toc-w: 220px;
+ --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
+ --mono: ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
+}
+
+:root[data-theme='light'] {
+ color-scheme: light;
+ --bg: #ffffff;
+ --bg-elev: #f7f9fb;
+ --bg-elev-2: #eef2f6;
+ --bg-code: #f6f8fa;
+ --border: #e3e8ee;
+ --border-strong: #d2dae3;
+ --fg: #0f1720;
+ --fg-muted: #52606d;
+ --fg-faint: #7b8794;
+ --accent: #008a04;
+ --accent-2: #00a838;
+ --accent-ink: #ffffff;
+ --accent-soft: rgba(0, 138, 4, 0.1);
+ --accent-line: rgba(0, 138, 4, 0.3);
+ --grad: linear-gradient(100deg, #008a04 0%, #00a838 60%, #22b455 100%);
+ --shadow: 0 1px 2px rgba(16, 23, 32, 0.06), 0 10px 30px rgba(16, 23, 32, 0.08);
+
+ --code-fg: #24292f;
+ --hl-comment: #6e7781;
+ --hl-keyword: #cf222e;
+ --hl-string: #0a7d33;
+ --hl-number: #953800;
+ --hl-title: #0550ae;
+ --hl-type: #1b7c83;
+ --hl-var: #24292f;
+ --hl-attr: #6639ba;
+ --hl-deletion: #82071e;
+}
+
+* { box-sizing: border-box; }
+html { scroll-behavior: smooth; scroll-padding-top: 84px; }
+@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }
+
+body {
+ margin: 0;
+ font-family: var(--font);
+ background: var(--bg);
+ color: var(--fg);
+ font-size: 16px;
+ line-height: 1.65;
+ -webkit-font-smoothing: antialiased;
+ text-rendering: optimizeLegibility;
+}
+
+a { color: var(--accent-2); text-decoration: none; }
+a:hover { text-decoration: underline; }
+:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
+
+.skip-link {
+ position: absolute; left: -999px; top: 8px; z-index: 200;
+ background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600;
+}
+.skip-link:focus { left: 12px; }
+
+kbd {
+ font-family: var(--mono); font-size: 11px; line-height: 1;
+ padding: 3px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
+ border-radius: 6px; background: var(--bg-elev-2); color: var(--fg-muted);
+}
+
+/* ---------- topbar -------------------------------------------------------- */
+.topbar {
+ position: sticky; top: 0; z-index: 50;
+ background: color-mix(in srgb, var(--bg) 82%, transparent);
+ backdrop-filter: saturate(160%) blur(12px);
+ border-bottom: 1px solid var(--border);
+}
+.topbar-inner {
+ max-width: var(--maxw); margin: 0 auto; height: 60px;
+ display: flex; align-items: center; justify-content: space-between; gap: 16px;
+ padding: 0 20px;
+}
+.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-size: 15px; }
+.brand:hover { text-decoration: none; }
+.brand-mark {
+ width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
+ background: var(--grad); color: #04120a; font-weight: 800; font-size: 16px; flex: none;
+}
+.brand-text strong { font-weight: 700; }
+.brand-text { color: var(--fg-muted); font-weight: 500; }
+.brand-text strong { color: var(--fg); }
+
+.topbar-actions { display: flex; align-items: center; gap: 8px; }
+.ghost-link { color: var(--fg-muted); font-size: 14px; padding: 6px 8px; border-radius: 8px; }
+.ghost-link:hover { color: var(--fg); text-decoration: none; background: var(--bg-elev-2); }
+
+.search-open {
+ display: inline-flex; align-items: center; gap: 10px;
+ background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--fg-muted);
+ padding: 7px 10px; border-radius: 9px; font-size: 13px; cursor: pointer; min-width: 160px;
+ justify-content: space-between; font-family: inherit;
+}
+.search-open:hover { border-color: var(--border-strong); color: var(--fg); }
+.search-open kbd { padding: 2px 6px; }
+
+.theme-toggle, .menu-toggle {
+ width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border);
+ background: var(--bg-elev-2); cursor: pointer; display: grid; place-items: center; color: var(--fg-muted);
+}
+.theme-toggle:hover, .menu-toggle:hover { color: var(--fg); border-color: var(--border-strong); }
+.theme-toggle::before { content: '☾'; font-size: 16px; }
+:root[data-theme='light'] .theme-toggle::before { content: '☀'; }
+.menu-toggle { display: none; }
+.menu-toggle::before { content: '≡'; font-size: 20px; }
+
+/* ---------- layout -------------------------------------------------------- */
+.layout { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: flex-start; }
+
+.sidebar {
+ position: sticky; top: 60px; align-self: flex-start;
+ width: var(--sidebar-w); flex: none; height: calc(100vh - 60px);
+ overflow-y: auto; padding: 24px 12px 60px 20px; border-right: 1px solid var(--border);
+}
+.nav-section { margin-bottom: 22px; }
+.nav-section-title {
+ font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--fg-faint);
+ font-weight: 700; margin: 0 0 8px 10px;
+}
+.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
+.sidebar-nav li a {
+ display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
+ color: var(--fg-muted); font-size: 14px; line-height: 1.35;
+}
+.sidebar-nav li a:hover { background: var(--bg-elev-2); color: var(--fg); text-decoration: none; }
+.sidebar-nav li a.active { background: var(--accent-soft); color: var(--fg); font-weight: 600; }
+.sidebar-nav li a.active .nav-idx { color: var(--accent-2); border-color: var(--accent-line); }
+.nav-idx {
+ flex: none; width: 24px; height: 20px; display: grid; place-items: center;
+ font-family: var(--mono); font-size: 11px; color: var(--fg-faint);
+ border: 1px solid var(--border); border-radius: 6px;
+}
+.sidebar-nav li a.done .nav-idx::after { content: ''; }
+
+.sidebar-scrim { display: none; }
+
+/* ---------- landing ------------------------------------------------------- */
+.landing { flex: 1; min-width: 0; padding: 0 20px; }
+.hero { padding: 72px 0 40px; border-bottom: 1px solid var(--border); }
+.hero-inner { max-width: 820px; }
+.eyebrow {
+ font-family: var(--mono); font-size: 12.5px; color: var(--fg-muted); margin: 0 0 18px;
+ letter-spacing: 0.01em;
+}
+.hero h1 { font-size: clamp(38px, 6vw, 62px); line-height: 1.03; letter-spacing: -0.03em; margin: 0 0 20px; font-weight: 800; }
+.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
+.lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--fg-muted); margin: 0 0 28px; max-width: 680px; }
+.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
+.btn {
+ display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 10px;
+ font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid transparent; transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
+}
+.btn:hover { text-decoration: none; }
+.btn:active { transform: translateY(1px); }
+.btn-primary { background: var(--accent); color: var(--accent-ink); }
+.btn-primary:hover { background: var(--accent-2); }
+.btn-ghost { background: var(--bg-elev); border-color: var(--border-strong); color: var(--fg); }
+.btn-ghost:hover { background: var(--bg-elev-2); border-color: var(--fg-faint); }
+
+.chain-strip {
+ display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
+ background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
+}
+.stat { background: var(--bg-elev); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
+.stat-label { font-size: 12px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
+.stat-value { font-family: var(--mono); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
+.stat-value.tick { animation: flash 0.6s ease; }
+@keyframes flash { 0% { color: var(--accent-2); } 100% { color: var(--fg); } }
+.chain-strip-note { font-size: 12.5px; color: var(--fg-faint); margin: 10px 2px 0; }
+.chain-strip-note.err { color: var(--warn); }
+
+.curriculum { padding: 48px 0 24px; }
+.curriculum-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
+.section-h { font-size: 26px; letter-spacing: -0.02em; margin: 0; font-weight: 700; }
+.reset-progress { background: none; border: 1px solid var(--border); color: var(--fg-muted); font-size: 12.5px; padding: 5px 10px; border-radius: 7px; cursor: pointer; font-family: inherit; }
+.reset-progress:hover { color: var(--fg); border-color: var(--border-strong); }
+.progress-line { color: var(--fg-muted); font-size: 14px; margin: 8px 0 32px; }
+#progress-count { color: var(--accent-2); font-weight: 700; }
+
+.curriculum-group { margin-bottom: 40px; }
+.curriculum-group-title {
+ font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-faint);
+ font-weight: 700; margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
+}
+.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
+.tut-card {
+ position: relative; display: flex; gap: 14px; padding: 18px; border: 1px solid var(--border);
+ border-radius: var(--radius); background: var(--bg-elev); color: var(--fg); overflow: hidden;
+ transition: border-color 0.15s ease, transform 0.08s ease, background 0.15s ease;
+}
+.tut-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--grad); opacity: 0; transition: opacity 0.15s ease; }
+.tut-card:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-2px); background: var(--bg-elev-2); }
+.tut-card:hover::before { opacity: 1; }
+.tut-card-idx { font-family: var(--mono); font-size: 13px; color: var(--fg-faint); flex: none; padding-top: 1px; }
+.tut-card-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
+.tut-card-title { font-weight: 650; font-size: 15.5px; letter-spacing: -0.01em; }
+.tut-card-desc { color: var(--fg-muted); font-size: 13.5px; line-height: 1.5; }
+.tut-card-time { color: var(--fg-faint); font-size: 12px; font-family: var(--mono); margin-top: 2px; }
+.tut-card-check {
+ position: absolute; top: 14px; right: 14px; width: 18px; height: 18px; border-radius: 50%;
+ border: 1.5px solid var(--border-strong); flex: none; transition: all 0.15s ease;
+}
+.tut-card.done { border-color: var(--accent-line); }
+.tut-card.done .tut-card-check { background: var(--accent); border-color: var(--accent); }
+.tut-card.done .tut-card-check::after { content: '✓'; color: var(--accent-ink); font-size: 12px; font-weight: 800; display: grid; place-items: center; height: 100%; }
+.tut-card.done .tut-card-idx { color: var(--accent-2); }
+
+.site-footer { border-top: 1px solid var(--border); padding: 32px 0 60px; color: var(--fg-muted); font-size: 14px; }
+.site-footer p { margin: 0 0 8px; }
+.disclaimer { color: var(--fg-faint); font-size: 12.5px; max-width: 720px; line-height: 1.6; }
+
+/* ---------- doc page ------------------------------------------------------ */
+.doc { flex: 1; min-width: 0; display: flex; gap: 32px; padding: 32px 20px 80px; }
+.doc-article { flex: 1; min-width: 0; max-width: 760px; }
+.breadcrumb { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--fg-faint); margin-bottom: 18px; }
+.breadcrumb a { color: var(--fg-muted); }
+.doc-header h1 { font-size: clamp(30px, 4.5vw, 40px); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 14px; font-weight: 800; }
+.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--fg-muted); font-size: 13.5px; margin-bottom: 28px; }
+.doc-meta-item { font-family: var(--mono); }
+.doc-meta-sep { color: var(--fg-faint); }
+.done-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-family: var(--font); }
+.done-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
+
+.whatbuild, .prereq {
+ border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px;
+ background: var(--bg-elev);
+}
+.whatbuild { border-left: 3px solid var(--accent); }
+.whatbuild-title, .prereq-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; color: var(--fg-muted); }
+.whatbuild p:last-child { margin: 0; }
+.prereq ul { margin: 0; padding-left: 20px; }
+.prereq li { margin: 4px 0; color: var(--fg-muted); font-size: 14.5px; }
+.prereq li code { color: var(--fg); }
+
+/* body typography */
+.doc-body { font-size: 16px; }
+.doc-body > *:first-child { margin-top: 0; }
+.doc-body h2 { font-size: 25px; letter-spacing: -0.02em; margin: 48px 0 16px; padding-top: 8px; font-weight: 700; }
+.doc-body h3 { font-size: 19px; letter-spacing: -0.01em; margin: 32px 0 12px; font-weight: 650; }
+.doc-body h2 .anchor, .doc-body h3 .anchor {
+ opacity: 0; margin-left: -22px; padding-right: 8px; color: var(--fg-faint); font-weight: 400; text-decoration: none;
+}
+.doc-body h2:hover .anchor, .doc-body h3:hover .anchor { opacity: 1; }
+.doc-body p { margin: 0 0 16px; }
+.doc-body ul, .doc-body ol { margin: 0 0 16px; padding-left: 24px; }
+.doc-body li { margin: 6px 0; }
+.doc-body li::marker { color: var(--fg-faint); }
+.doc-body strong { color: var(--fg); font-weight: 650; }
+.doc-body hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
+
+.doc-body :not(pre) > code {
+ font-family: var(--mono); font-size: 0.86em; padding: 2px 6px; border-radius: 6px;
+ background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--fg);
+ word-break: break-word;
+}
+
+.doc-body blockquote {
+ margin: 0 0 16px; padding: 2px 18px; border-left: 3px solid var(--border-strong);
+ color: var(--fg-muted);
+}
+
+.doc-body table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14.5px; display: block; overflow-x: auto; }
+.doc-body thead { background: var(--bg-elev); }
+.doc-body th, .doc-body td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; vertical-align: top; }
+.doc-body th { font-weight: 650; color: var(--fg); }
+.doc-body td code { white-space: nowrap; }
+
+.doc-body img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }
+
+/* code blocks */
+.code-block { margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-code); }
+.code-block figcaption {
+ display: flex; align-items: center; justify-content: space-between;
+ padding: 7px 12px 7px 14px; border-bottom: 1px solid var(--border); background: var(--bg-elev);
+}
+.code-lang { font-family: var(--mono); font-size: 11.5px; color: var(--fg-faint); text-transform: none; letter-spacing: 0.02em; }
+.copy-btn {
+ font-family: var(--font); font-size: 12px; color: var(--fg-muted); background: var(--bg-elev-2);
+ border: 1px solid var(--border); padding: 4px 10px; border-radius: 7px; cursor: pointer;
+}
+.copy-btn:hover { color: var(--fg); border-color: var(--border-strong); }
+.copy-btn.copied { color: var(--accent-2); border-color: var(--accent-line); }
+.code-block pre { margin: 0; padding: 16px; overflow-x: auto; }
+.code-block code { font-family: var(--mono); font-size: 13.5px; line-height: 1.6; }
+
+/* callouts */
+.callout { border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius); padding: 14px 18px; margin: 0 0 20px; background: var(--bg-elev); }
+.callout p:last-child { margin-bottom: 0; }
+.callout-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 6px; }
+.callout-note { border-left-color: var(--info); }
+.callout-note .callout-title { color: var(--info); }
+.callout-info { border-left-color: var(--info); }
+.callout-info .callout-title { color: var(--info); }
+.callout-tip { border-left-color: var(--accent); }
+.callout-tip .callout-title { color: var(--accent-2); }
+.callout-warning { border-left-color: var(--warn); }
+.callout-warning .callout-title { color: var(--warn); }
+.callout-danger { border-left-color: var(--danger); }
+.callout-danger .callout-title { color: var(--danger); }
+
+/* pager */
+.pager-nav { display: flex; gap: 14px; margin: 48px 0 0; }
+.pager { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); min-width: 0; }
+.pager:hover { text-decoration: none; border-color: var(--border-strong); background: var(--bg-elev-2); }
+.pager-next { text-align: right; align-items: flex-end; }
+.pager-dir { font-size: 12.5px; color: var(--fg-faint); }
+.pager-title { font-weight: 600; color: var(--fg); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
+
+.doc-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--fg-muted); font-size: 13.5px; }
+.doc-footer p { margin: 0 0 6px; }
+
+/* TOC */
+.toc { position: sticky; top: 84px; align-self: flex-start; width: var(--toc-w); flex: none; max-height: calc(100vh - 110px); overflow-y: auto; font-size: 13.5px; }
+.toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-faint); font-weight: 700; margin: 0 0 10px; }
+.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
+.toc li a { display: block; padding: 4px 0 4px 14px; color: var(--fg-muted); margin-left: -1px; border-left: 2px solid transparent; }
+.toc li a:hover { color: var(--fg); text-decoration: none; }
+.toc li a.active { color: var(--accent-2); border-left-color: var(--accent); }
+.toc-l3 a { padding-left: 26px; font-size: 13px; }
+
+/* ---------- search modal -------------------------------------------------- */
+.search-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
+.search-modal[hidden] { display: none; }
+.search-panel { width: 100%; max-width: 640px; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
+#search-input { width: 100%; padding: 18px 20px; font-size: 17px; border: none; border-bottom: 1px solid var(--border); background: transparent; color: var(--fg); font-family: inherit; }
+#search-input:focus { outline: none; }
+.search-results { list-style: none; margin: 0; padding: 8px; max-height: 52vh; overflow-y: auto; }
+.search-results:empty { display: none; }
+.search-results li a { display: block; padding: 11px 14px; border-radius: var(--radius-sm); color: var(--fg); }
+.search-results li a:hover, .search-results li a.active { background: var(--accent-soft); text-decoration: none; }
+.sr-section { font-size: 11.5px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
+.sr-title { font-weight: 600; font-size: 15px; margin: 2px 0; }
+.sr-snippet { font-size: 13px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.sr-snippet mark, .sr-title mark { background: var(--accent-soft); color: var(--accent-2); border-radius: 3px; padding: 0 2px; }
+.search-empty { padding: 24px; text-align: center; color: var(--fg-muted); font-size: 14px; }
+.search-hint { display: flex; gap: 6px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--fg-faint); font-size: 12px; margin: 0; }
+
+/* ---------- responsive ---------------------------------------------------- */
+@media (max-width: 1100px) {
+ .toc { display: none; }
+}
+@media (max-width: 860px) {
+ .menu-toggle { display: grid; }
+ .search-open-label { display: none; }
+ .search-open { min-width: 0; }
+ .ghost-link { display: none; }
+ .sidebar {
+ position: fixed; top: 60px; left: 0; z-index: 40; width: 300px; max-width: 84vw;
+ background: var(--bg-elev); transform: translateX(-102%); transition: transform 0.22s ease;
+ border-right: 1px solid var(--border-strong); box-shadow: var(--shadow);
+ }
+ body.nav-open .sidebar { transform: translateX(0); }
+ body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 60px 0 0 0; z-index: 39; background: rgba(0,0,0,0.5); }
+ .layout { display: block; }
+ .doc { padding: 24px 16px 64px; }
+ .landing { padding: 0 16px; }
+ .hero { padding: 48px 0 32px; }
+ .chain-strip { grid-template-columns: repeat(2, 1fr); }
+ .pager-nav { flex-direction: column; }
+}
+@media (max-width: 420px) {
+ body { font-size: 15.5px; }
+ .chain-strip { grid-template-columns: 1fr; }
+ .card-grid { grid-template-columns: 1fr; }
+ .hero h1 { font-size: 34px; }
+}
diff --git a/robinhood/learn-robinhood-chain/docs/assets/ticker.js b/robinhood/learn-robinhood-chain/docs/assets/ticker.js
new file mode 100644
index 000000000..96f855937
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/assets/ticker.js
@@ -0,0 +1,115 @@
+/* ticker.js — live Robinhood Chain stats on the landing page.
+ Raw JSON-RPC over fetch against the public mainnet RPC. No viem, no CDN:
+ this is exactly the "read-only calls work client-side" claim, demonstrated. */
+(function () {
+ 'use strict'
+
+ var RPC = 'https://rpc.mainnet.chain.robinhood.com'
+ var AAPL_FEED = '0x6B22A786bAa607d76728168703a39Ea9C99f2cD0' // Chainlink AAPL/USD (8 decimals)
+ var USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' // 6 decimals
+ var SEL_LATEST_ROUND = '0xfeaf968c' // latestRoundData()
+ var SEL_TOTAL_SUPPLY = '0x18160ddd' // totalSupply()
+
+ var el = {
+ block: document.getElementById('stat-block'),
+ gas: document.getElementById('stat-gas'),
+ aapl: document.getElementById('stat-aapl'),
+ usdg: document.getElementById('stat-usdg'),
+ note: document.getElementById('chain-strip-note'),
+ }
+ if (!el.block) return
+
+ var id = 0
+ function rpc(method, params) {
+ return fetch(RPC, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ jsonrpc: '2.0', id: ++id, method: method, params: params || [] }),
+ })
+ .then(function (r) { return r.json() })
+ .then(function (j) {
+ if (j.error) throw new Error(j.error.message || 'rpc error')
+ return j.result
+ })
+ }
+
+ function hexToBig(h) { return BigInt(h && h !== '0x' ? h : '0x0') }
+
+ // format a raw integer with `decimals` places to a compact human string
+ function fmtUnits(raw, decimals, maxFrac) {
+ var neg = raw < 0n
+ if (neg) raw = -raw
+ var base = 10n ** BigInt(decimals)
+ var whole = raw / base
+ var frac = raw % base
+ var fracStr = frac.toString().padStart(decimals, '0').slice(0, maxFrac == null ? decimals : maxFrac)
+ fracStr = fracStr.replace(/0+$/, '')
+ var wholeStr = whole.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
+ return (neg ? '-' : '') + wholeStr + (fracStr ? '.' + fracStr : '')
+ }
+
+ function compact(raw, decimals) {
+ var n = Number(raw) / Math.pow(10, decimals)
+ if (n >= 1e9) return (n / 1e9).toFixed(2) + 'B'
+ if (n >= 1e6) return (n / 1e6).toFixed(1) + 'M'
+ if (n >= 1e3) return (n / 1e3).toFixed(1) + 'K'
+ return n.toFixed(0)
+ }
+
+ function set(node, value) {
+ if (!node) return
+ if (node.textContent !== value) {
+ node.textContent = value
+ node.classList.remove('tick')
+ void node.offsetWidth
+ node.classList.add('tick')
+ }
+ }
+
+ function updateBlockAndGas() {
+ Promise.all([rpc('eth_blockNumber'), rpc('eth_gasPrice')])
+ .then(function (res) {
+ set(el.block, '#' + fmtUnits(hexToBig(res[0]), 0))
+ var gwei = Number(hexToBig(res[1])) / 1e9
+ set(el.gas, (gwei < 0.01 ? gwei.toFixed(4) : gwei.toFixed(3)) + ' gwei')
+ ok()
+ })
+ .catch(fail)
+ }
+
+ function updateSlow() {
+ // AAPL price: latestRoundData() → answer is the 2nd 32-byte word
+ rpc('eth_call', [{ to: AAPL_FEED, data: SEL_LATEST_ROUND }, 'latest'])
+ .then(function (data) {
+ if (!data || data.length < 2 + 64 * 2) return
+ var answerHex = '0x' + data.slice(2 + 64, 2 + 128)
+ set(el.aapl, '$' + fmtUnits(hexToBig(answerHex), 8, 2))
+ })
+ .catch(function () {})
+ rpc('eth_call', [{ to: USDG, data: SEL_TOTAL_SUPPLY }, 'latest'])
+ .then(function (data) {
+ set(el.usdg, '$' + compact(hexToBig(data), 6))
+ })
+ .catch(function () {})
+ }
+
+ var failed = false
+ function fail() {
+ if (failed) return
+ failed = true
+ if (el.note) { el.note.textContent = 'Live RPC unreachable right now — values may be stale.'; el.note.classList.add('err') }
+ }
+ function ok() {
+ if (failed && el.note) { failed = false; el.note.textContent = 'Live from the public RPC in your browser.'; el.note.classList.remove('err') }
+ }
+
+ updateBlockAndGas()
+ updateSlow()
+ var fast = setInterval(updateBlockAndGas, 4000)
+ var slow = setInterval(updateSlow, 30000)
+ window.addEventListener('pagehide', function () { clearInterval(fast); clearInterval(slow) })
+ document.addEventListener('visibilitychange', function () {
+ if (document.hidden) { clearInterval(fast); clearInterval(slow) }
+ else { fast = setInterval(updateBlockAndGas, 4000); slow = setInterval(updateSlow, 30000); updateBlockAndGas() }
+ })
+})()
diff --git a/robinhood/learn-robinhood-chain/docs/index.html b/robinhood/learn-robinhood-chain/docs/index.html
new file mode 100644
index 000000000..9455e6570
--- /dev/null
+++ b/robinhood/learn-robinhood-chain/docs/index.html
@@ -0,0 +1,202 @@
+<!doctype html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Learn Robinhood Chain — From zero to shipping an autonomous agent on Robinhood Chain.</title>
+<meta name="description" content="From zero to shipping an autonomous agent on Robinhood Chain. Twelve on-chain-verified tutorials for building on Robinhood Chain (chain ID 4663).">
+<meta property="og:title" content="Learn Robinhood Chain — From zero to shipping an autonomous agent on Robinhood Chain.">
+<meta property="og:description" content="From zero to shipping an autonomous agent on Robinhood Chain. Twelve on-chain-verified tutorials for building on Robinhood Chain (chain ID 4663).">
+<meta property="og:type" content="article">
+<meta name="theme-color" content="#0b0d10">
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2300c805'/%3E%3Cpath d='M9 22V10h4.4c2.6 0 4.2 1.4 4.2 3.7 0 1.7-.9 2.9-2.4 3.4l2.9 4.9h-2.8l-2.5-4.4h-1.4V22H9zm2.4-6.3h1.8c1.2 0 1.9-.6 1.9-1.7s-.7-1.7-1.9-1.7h-1.8v3.4z' fill='%23000'/%3E%3C/svg%3E">
+<link rel="stylesheet" href="assets/styles.css">
+
+</head>
+<body class="page-home">
+<a class="skip-link" href="#main">Skip to content</a>
+<script>(function(){try{var t=localStorage.getItem('theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+<header class="topbar">
+ <div class="topbar-inner">
+ <a class="brand" href="./">
+ <span class="brand-mark" aria-hidden="true">R</span>
+ <span class="brand-text">Learn <strong>Robinhood Chain</strong></span>
+ </a>
+ <div class="topbar-actions">
+ <button class="search-open" type="button" aria-label="Search tutorials" aria-keyshortcuts="/">
+ <span class="search-open-label">Search</span><kbd>/</kbd>
+ </button>
+ <a class="ghost-link" href="https://github.com/nirholas/learn-robinhood-chain" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <button class="theme-toggle" type="button" aria-label="Toggle color theme" title="Toggle theme"></button>
+ <button class="menu-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false"></button>
+ </div>
+ </div>
+</header>
+<div class="layout">
+ <aside class="sidebar" id="sidebar" aria-label="Tutorials">
+ <nav class="sidebar-nav"><div class="nav-section"><p class="nav-section-title">Foundations</p><ul><li><a href="01-what-is-robinhood-chain/"><span class="nav-idx">01</span>What it actually is</a></li><li><a href="02-connect-and-read/"><span class="nav-idx">02</span>Connect &amp; read</a></li><li><a href="03-stock-tokens-explained/"><span class="nav-idx">03</span>Stock Tokens</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Building</p><ul><li><a href="04-live-price-ticker/"><span class="nav-idx">04</span>Live price ticker</a></li><li><a href="05-portfolio-tracker/"><span class="nav-idx">05</span>Portfolio tracker</a></li><li><a href="06-swapping-on-chain/"><span class="nav-idx">06</span>Swapping on-chain</a></li><li><a href="07-streaming-the-chain/"><span class="nav-idx">07</span>Streaming the chain</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Monetizing &amp; agents</p><ul><li><a href="08-sell-your-api-for-usdg/"><span class="nav-idx">08</span>Sell your API</a></li><li><a href="09-ai-agent-chain-access/"><span class="nav-idx">09</span>AI agent access (MCP)</a></li><li><a href="10-autonomous-trading-agent/"><span class="nav-idx">10</span>Autonomous agent</a></li><li><a href="11-launch-a-coin/"><span class="nav-idx">11</span>Launch a coin</a></li></ul></div><div class="nav-section"><p class="nav-section-title">Capstone</p><ul><li><a href="12-ship-it/"><span class="nav-idx">12</span>Ship it</a></li></ul></div></nav>
+ </aside>
+ <div class="sidebar-scrim" hidden></div>
+ <main class="landing" id="main">
+ <section class="hero">
+ <div class="hero-inner">
+ <p class="eyebrow">Chain ID 4663 · Arbitrum Orbit L2 · ETH gas · ~100ms blocks</p>
+ <h1>Build on <span class="grad">Robinhood Chain</span>.</h1>
+ <p class="lede">From zero to shipping an autonomous agent on Robinhood Chain. Twelve tutorials, each performed on-chain, from your first RPC read to a live autonomous agent — built on the open-source <a href="https://github.com/nirholas/robinhood-chain-sdk">hoodchain</a> SDK.</p>
+ <div class="hero-cta">
+ <a class="btn btn-primary" href="01-what-is-robinhood-chain/">Start learning</a>
+ <a class="btn btn-ghost" href="04-live-price-ticker/">Jump to code</a>
+ </div>
+ <div class="chain-strip" id="chain-strip" aria-label="Live chain stats">
+ <div class="stat"><span class="stat-label">Block height</span><span class="stat-value" id="stat-block">…</span></div>
+ <div class="stat"><span class="stat-label">Gas price</span><span class="stat-value" id="stat-gas">…</span></div>
+ <div class="stat"><span class="stat-label">AAPL token</span><span class="stat-value" id="stat-aapl">…</span></div>
+ <div class="stat"><span class="stat-label">USDG supply</span><span class="stat-value" id="stat-usdg">…</span></div>
+ </div>
+ <p class="chain-strip-note" id="chain-strip-note">Live from the public RPC in your browser.</p>
+ </div>
+ </section>
+ <div class="curriculum">
+ <div class="curriculum-head">
+ <h2 class="section-h">The curriculum</h2>
+ <button class="reset-progress" type="button" id="reset-progress" hidden>Reset progress</button>
+ </div>
+ <p class="progress-line"><span id="progress-count">0</span> of 12 completed · progress is saved in your browser</p>
+
+ <section class="curriculum-group">
+ <h2 class="curriculum-group-title">Foundations</h2>
+ <div class="card-grid">
+ <a class="tut-card" href="01-what-is-robinhood-chain/" data-slug="01-what-is-robinhood-chain">
+ <span class="tut-card-idx">01</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">What Robinhood Chain actually is</span>
+ <span class="tut-card-desc">Architecture, chain IDs, and what's real vs hype — the no-token fact, the US-person restriction, and permissionless deployment, all sourced.</span>
+ <span class="tut-card-time">10 min</span>
+ </span>
+ </a><a class="tut-card" href="02-connect-and-read/" data-slug="02-connect-and-read">
+ <span class="tut-card-idx">02</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Connect and read the chain in 5 minutes</span>
+ <span class="tut-card-desc">Add the network to a wallet, get testnet funds, and make your first read against mainnet with viem — a real block number and gas price in your terminal.</span>
+ <span class="tut-card-time">5 min</span>
+ </span>
+ </a><a class="tut-card" href="03-stock-tokens-explained/" data-slug="03-stock-tokens-explained">
+ <span class="tut-card-idx">03</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Stock Tokens explained for developers</span>
+ <span class="tut-card-desc">ERC-20 + a Chainlink feed + ERC-8056 uiMultiplier(). The split/dividend trap, with a worked example showing the wrong and the right valuation.</span>
+ <span class="tut-card-time">12 min</span>
+ </span>
+ </a>
+ </div>
+ </section>
+ <section class="curriculum-group">
+ <h2 class="curriculum-group-title">Building</h2>
+ <div class="card-grid">
+ <a class="tut-card" href="04-live-price-ticker/" data-slug="04-live-price-ticker">
+ <span class="tut-card-idx">04</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Your first app: a live price ticker</span>
+ <span class="tut-card-desc">Build a terminal price ticker that streams multiplier-adjusted Chainlink quotes for any Stock Token, with staleness handling done right.</span>
+ <span class="tut-card-time">15 min</span>
+ </span>
+ </a><a class="tut-card" href="05-portfolio-tracker/" data-slug="05-portfolio-tracker">
+ <span class="tut-card-idx">05</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Portfolio tracker done right</span>
+ <span class="tut-card-desc">Value any address's Stock Token holdings in one multicall — and understand exactly why a naive tracker reports the wrong number after a split.</span>
+ <span class="tut-card-time">15 min</span>
+ </span>
+ </a><a class="tut-card" href="06-swapping-on-chain/" data-slug="06-swapping-on-chain">
+ <span class="tut-card-idx">06</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Swapping on-chain: quotes, slippage, execution</span>
+ <span class="tut-card-desc">Quote a Uniswap v3 swap across every fee tier, set slippage correctly, and execute on testnet — with a Stock Token eligibility sidebar.</span>
+ <span class="tut-card-time">20 min</span>
+ </span>
+ </a><a class="tut-card" href="07-streaming-the-chain/" data-slug="07-streaming-the-chain">
+ <span class="tut-card-idx">07</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Streaming the chain: launchpads + firehose</span>
+ <span class="tut-card-desc">Watch NOXA and The Odyssey for new memecoin launches, then tap the raw sequencer firehose to see transactions ~100ms before they're queryable.</span>
+ <span class="tut-card-time">18 min</span>
+ </span>
+ </a>
+ </div>
+ </section>
+ <section class="curriculum-group">
+ <h2 class="curriculum-group-title">Monetizing &amp; agents</h2>
+ <div class="card-grid">
+ <a class="tut-card" href="08-sell-your-api-for-usdg/" data-slug="08-sell-your-api-for-usdg">
+ <span class="tut-card-idx">08</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Sell your API for USDG with x402</span>
+ <span class="tut-card-desc">Put a Stock Token data endpoint behind an HTTP 402 paywall settled in USDG, and take your first real on-chain payment — from zero to a paid request.</span>
+ <span class="tut-card-time">25 min</span>
+ </span>
+ </a><a class="tut-card" href="09-ai-agent-chain-access/" data-slug="09-ai-agent-chain-access">
+ <span class="tut-card-idx">09</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Give your AI agent chain access with MCP</span>
+ <span class="tut-card-desc">Build a Model Context Protocol server that exposes Robinhood Chain reads as tools, then wire it into Claude Code, Claude Desktop, or Cursor — with a real transcript.</span>
+ <span class="tut-card-time">22 min</span>
+ </span>
+ </a><a class="tut-card" href="10-autonomous-trading-agent/" data-slug="10-autonomous-trading-agent">
+ <span class="tut-card-idx">10</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Build an autonomous trading agent</span>
+ <span class="tut-card-desc">A paper-mode trading agent with a real strategy, hard spend caps, and a kill switch — risk-first framing before a single lira of real capital.</span>
+ <span class="tut-card-time">30 min</span>
+ </span>
+ </a><a class="tut-card" href="11-launch-a-coin/" data-slug="11-launch-a-coin">
+ <span class="tut-card-idx">11</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Launch a coin programmatically</span>
+ <span class="tut-card-desc">How Robinhood Chain's launchpads work, how to decode their events, and the responsible path to launching a token on testnet from code.</span>
+ <span class="tut-card-time">20 min</span>
+ </span>
+ </a>
+ </div>
+ </section>
+ <section class="curriculum-group">
+ <h2 class="curriculum-group-title">Capstone</h2>
+ <div class="card-grid">
+ <a class="tut-card" href="12-ship-it/" data-slug="12-ship-it">
+ <span class="tut-card-idx">12</span>
+ <span class="tut-card-check" aria-hidden="true"></span>
+ <span class="tut-card-body">
+ <span class="tut-card-title">Ship it: deploy and go mainnet</span>
+ <span class="tut-card-desc">Deploy your static app to Pages, your API to Cloud Run, and walk the going-mainnet checklist: funding, keys, spend caps, and monitoring.</span>
+ <span class="tut-card-time">18 min</span>
+ </span>
+ </a>
+ </div>
+ </section>
+ </div>
+ <footer class="site-footer">
+ <p>Built by <a href="https://x.com/nichxbt" target="_blank" rel="noopener noreferrer">nirholas</a> · <a href="https://three.ws" target="_blank" rel="noopener noreferrer">three.ws</a></p>
+ <p class="disclaimer">Educational material. Stock Tokens are tokenized debt securities (issuer: Robinhood Assets (Jersey) Ltd) and may not be offered, sold, or delivered to US persons. Nothing here is financial advice.</p>
+ </footer>
+</main>
+</div>
+<div class="search-modal" id="search-modal" hidden role="dialog" aria-modal="true" aria-label="Search">
+ <div class="search-panel">
+ <input type="search" id="search-input" placeholder="Search tutorials…" autocomplete="off" spellcheck="false" aria-label="Search query">
+ <ul class="search-results" id="search-results" aria-live="polite"></ul>
+ <p class="search-hint"><kbd>↑</kbd><kbd>↓</kbd> to navigate · <kbd>↵</kbd> to open · <kbd>esc</kbd> to close</p>
+ </div>
+</div>
+<script defer src="assets/app.js"></script><script defer src="assets/ticker.js"></script><script defer src="assets/search.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/package-lock.json b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/package-lock.json
new file mode 100644
index 000000000..132d35103
--- /dev/null
+++ b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/package-lock.json
@@ -0,0 +1,2006 @@
+{
+ "name": "rh-example-08-portfolio-dashboard",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "rh-example-08-portfolio-dashboard",
+ "version": "0.1.0",
+ "dependencies": {
+ "hoodchain": "^0.1.0",
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
+ "viem": "^2.55.0"
+ },
+ "devDependencies": {
+ "@vitejs/plugin-react": "^4.3.0",
+ "vite": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@adraffy/ens-normalize": {
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz",
+ "integrity": "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ==",
+ "license": "MIT"
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
+ "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.29.7",
+ "js-tokens": "^4.0.0",
+ "picocolors": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/compat-data": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz",
+ "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/core": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
+ "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/generator": "^7.29.7",
+ "@babel/helper-compilation-targets": "^7.29.7",
+ "@babel/helper-module-transforms": "^7.29.7",
+ "@babel/helpers": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/template": "^7.29.7",
+ "@babel/traverse": "^7.29.7",
+ "@babel/types": "^7.29.7",
+ "@jridgewell/remapping": "^2.3.5",
+ "convert-source-map": "^2.0.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.2",
+ "json5": "^2.2.3",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/babel"
+ }
+ },
+ "node_modules/@babel/generator": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz",
+ "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.29.7",
+ "@babel/types": "^7.29.7",
+ "@jridgewell/gen-mapping": "^0.3.12",
+ "@jridgewell/trace-mapping": "^0.3.28",
+ "jsesc": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz",
+ "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.29.7",
+ "@babel/helper-validator-option": "^7.29.7",
+ "browserslist": "^4.24.0",
+ "lru-cache": "^5.1.1",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-globals": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz",
+ "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-imports": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz",
+ "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-transforms": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz",
+ "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-imports": "^7.29.7",
+ "@babel/helper-validator-identifier": "^7.29.7",
+ "@babel/traverse": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-plugin-utils": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz",
+ "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-string-parser": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
+ "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
+ "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-option": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz",
+ "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helpers": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz",
+ "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/parser": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz",
+ "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.29.7"
+ },
+ "bin": {
+ "parser": "bin/babel-parser.js"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-react-jsx-self": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz",
+ "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-react-jsx-source": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz",
+ "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/template": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",
+ "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/traverse": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz",
+ "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/generator": "^7.29.7",
+ "@babel/helper-globals": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/template": "^7.29.7",
+ "@babel/types": "^7.29.7",
+ "debug": "^4.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/types": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz",
+ "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-string-parser": "^7.29.7",
+ "@babel/helper-validator-identifier": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
+ "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
+ "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
+ "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
+ "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
+ "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
+ "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
+ "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
+ "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
+ "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
+ "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
+ "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
+ "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
+ "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
+ "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
+ "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
+ "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
+ "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
+ "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
+ "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
+ "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
+ "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/remapping": {
+ "version": "2.3.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@noble/ciphers": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
+ "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/curves": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz",
+ "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "1.8.0"
+ },
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/hashes": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz",
+ "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@rolldown/pluginutils": {
+ "version": "1.0.0-beta.27",
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
+ "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz",
+ "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz",
+ "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz",
+ "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz",
+ "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz",
+ "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz",
+ "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz",
+ "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz",
+ "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz",
+ "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz",
+ "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz",
+ "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz",
+ "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz",
+ "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz",
+ "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz",
+ "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz",
+ "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz",
+ "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz",
+ "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz",
+ "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-openbsd-x64": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz",
+ "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-openharmony-arm64": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz",
+ "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz",
+ "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz",
+ "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz",
+ "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz",
+ "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@scure/base": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz",
+ "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@scure/bip32": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz",
+ "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/curves": "~1.9.0",
+ "@noble/hashes": "~1.8.0",
+ "@scure/base": "~1.2.5"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@scure/bip39": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz",
+ "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "~1.8.0",
+ "@scure/base": "~1.2.5"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@types/babel__core": {
+ "version": "7.20.5",
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.20.7",
+ "@babel/types": "^7.20.7",
+ "@types/babel__generator": "*",
+ "@types/babel__template": "*",
+ "@types/babel__traverse": "*"
+ }
+ },
+ "node_modules/@types/babel__generator": {
+ "version": "7.27.0",
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",
+ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__template": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__traverse": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",
+ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.28.2"
+ }
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@vitejs/plugin-react": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
+ "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.28.0",
+ "@babel/plugin-transform-react-jsx-self": "^7.27.1",
+ "@babel/plugin-transform-react-jsx-source": "^7.27.1",
+ "@rolldown/pluginutils": "1.0.0-beta.27",
+ "@types/babel__core": "^7.20.5",
+ "react-refresh": "^0.17.0"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
+ }
+ },
+ "node_modules/abitype": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.2.3.tgz",
+ "integrity": "sha512-Ofer5QUnuUdTFsBRwARMoWKOH1ND5ehwYhJ3OJ/BQO+StkwQjHw0XyVh4vDttzHB7QOFhPHa/o413PJ82gU/Tg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/wevm"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.4",
+ "zod": "^3.22.0 || ^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ },
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.10.43",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.43.tgz",
+ "integrity": "sha512-AjYpR78kDWAY3Efj+cDTFH9t9SCoL7OoTp1BOb0mQV7S+6CiLwnWM3FyxhJtdPufDFKzmCSFoUncKjWgJEZTCQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.cjs"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/browserslist": {
+ "version": "4.28.6",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.6.tgz",
+ "integrity": "sha512-FQBYNK15VMslhLHpA7+n+n1GOlF1kId2xcCg7/j95f24AOF6VDYMNH4mFxF7KuaTdv627faazpOAjFzMrfJOUw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "baseline-browser-mapping": "^2.10.42",
+ "caniuse-lite": "^1.0.30001803",
+ "electron-to-chromium": "^1.5.389",
+ "node-releases": "^2.0.51",
+ "update-browserslist-db": "^1.2.3"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001805",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001805.tgz",
+ "integrity": "sha512-52noaS3DubycKSXaU30TwPGIp+POyQSUVa5jBEq3vkRkY0kjyb3LQgvhU6WGyCcyXqVLWO0Cw0Q6BSdD0kUfVA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.5.389",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.389.tgz",
+ "integrity": "sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/esbuild": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
+ "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.12",
+ "@esbuild/android-arm": "0.25.12",
+ "@esbuild/android-arm64": "0.25.12",
+ "@esbuild/android-x64": "0.25.12",
+ "@esbuild/darwin-arm64": "0.25.12",
+ "@esbuild/darwin-x64": "0.25.12",
+ "@esbuild/freebsd-arm64": "0.25.12",
+ "@esbuild/freebsd-x64": "0.25.12",
+ "@esbuild/linux-arm": "0.25.12",
+ "@esbuild/linux-arm64": "0.25.12",
+ "@esbuild/linux-ia32": "0.25.12",
+ "@esbuild/linux-loong64": "0.25.12",
+ "@esbuild/linux-mips64el": "0.25.12",
+ "@esbuild/linux-ppc64": "0.25.12",
+ "@esbuild/linux-riscv64": "0.25.12",
+ "@esbuild/linux-s390x": "0.25.12",
+ "@esbuild/linux-x64": "0.25.12",
+ "@esbuild/netbsd-arm64": "0.25.12",
+ "@esbuild/netbsd-x64": "0.25.12",
+ "@esbuild/openbsd-arm64": "0.25.12",
+ "@esbuild/openbsd-x64": "0.25.12",
+ "@esbuild/openharmony-arm64": "0.25.12",
+ "@esbuild/sunos-x64": "0.25.12",
+ "@esbuild/win32-arm64": "0.25.12",
+ "@esbuild/win32-ia32": "0.25.12",
+ "@esbuild/win32-x64": "0.25.12"
+ }
+ },
+ "node_modules/escalade": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
+ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
+ "license": "MIT"
+ },
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/gensync": {
+ "version": "1.0.0-beta.2",
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/hoodchain": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/hoodchain/-/hoodchain-0.1.0.tgz",
+ "integrity": "sha512-jnY0rvLGhGiTIpaP7b2YU0KuZUfnhEc2xqqEGbjeqtYdLO+frQPry/AC9agUNRwwvL/XQJWVGkBg5vY0QtffEQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20"
+ },
+ "peerDependencies": {
+ "viem": "^2.55.0",
+ "ws": "^8.18.0"
+ },
+ "peerDependenciesMeta": {
+ "ws": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/isows": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz",
+ "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/wevm"
+ }
+ ],
+ "license": "MIT",
+ "peerDependencies": {
+ "ws": "*"
+ }
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/jsesc": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jsesc": "bin/jsesc"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/json5": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "json5": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.16",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz",
+ "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/node-releases": {
+ "version": "2.0.51",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz",
+ "integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/ox": {
+ "version": "0.14.30",
+ "resolved": "https://registry.npmjs.org/ox/-/ox-0.14.30.tgz",
+ "integrity": "sha512-LI11uu+8iiM1B3CLckgd++YF1a0A2k5wDoM9ZeQMiL21BOzQs6L//BLS6hb1HSEKCyycdDIQLsVQx9MjpcC0hA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/wevm"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@adraffy/ens-normalize": "^1.11.0",
+ "@noble/ciphers": "^1.3.0",
+ "@noble/curves": "1.9.1",
+ "@noble/hashes": "^1.8.0",
+ "@scure/bip32": "^1.7.0",
+ "@scure/bip39": "^1.6.0",
+ "abitype": "^1.2.3",
+ "eventemitter3": "5.0.1"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.4.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
+ "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.17",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.17.tgz",
+ "integrity": "sha512-J7EF+8X+CzRPaJPOv9Ck2wNWJvGnnl3PcNPAdGg6GTLjyVpyQ0yATMSXRFRV01BviT/9Gwuc3rjEyJbDJG9a4w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.12",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/react": {
+ "version": "19.2.7",
+ "resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz",
+ "integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "19.2.7",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz",
+ "integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==",
+ "license": "MIT",
+ "dependencies": {
+ "scheduler": "^0.27.0"
+ },
+ "peerDependencies": {
+ "react": "^19.2.7"
+ }
+ },
+ "node_modules/react-refresh": {
+ "version": "0.17.0",
+ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
+ "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/rollup": {
+ "version": "4.62.2",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz",
+ "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "1.0.9"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.62.2",
+ "@rollup/rollup-android-arm64": "4.62.2",
+ "@rollup/rollup-darwin-arm64": "4.62.2",
+ "@rollup/rollup-darwin-x64": "4.62.2",
+ "@rollup/rollup-freebsd-arm64": "4.62.2",
+ "@rollup/rollup-freebsd-x64": "4.62.2",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.62.2",
+ "@rollup/rollup-linux-arm-musleabihf": "4.62.2",
+ "@rollup/rollup-linux-arm64-gnu": "4.62.2",
+ "@rollup/rollup-linux-arm64-musl": "4.62.2",
+ "@rollup/rollup-linux-loong64-gnu": "4.62.2",
+ "@rollup/rollup-linux-loong64-musl": "4.62.2",
+ "@rollup/rollup-linux-ppc64-gnu": "4.62.2",
+ "@rollup/rollup-linux-ppc64-musl": "4.62.2",
+ "@rollup/rollup-linux-riscv64-gnu": "4.62.2",
+ "@rollup/rollup-linux-riscv64-musl": "4.62.2",
+ "@rollup/rollup-linux-s390x-gnu": "4.62.2",
+ "@rollup/rollup-linux-x64-gnu": "4.62.2",
+ "@rollup/rollup-linux-x64-musl": "4.62.2",
+ "@rollup/rollup-openbsd-x64": "4.62.2",
+ "@rollup/rollup-openharmony-arm64": "4.62.2",
+ "@rollup/rollup-win32-arm64-msvc": "4.62.2",
+ "@rollup/rollup-win32-ia32-msvc": "4.62.2",
+ "@rollup/rollup-win32-x64-gnu": "4.62.2",
+ "@rollup/rollup-win32-x64-msvc": "4.62.2",
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.27.0",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
+ "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.17",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/update-browserslist-db": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "escalade": "^3.2.0",
+ "picocolors": "^1.1.1"
+ },
+ "bin": {
+ "update-browserslist-db": "cli.js"
+ },
+ "peerDependencies": {
+ "browserslist": ">= 4.21.0"
+ }
+ },
+ "node_modules/viem": {
+ "version": "2.55.1",
+ "resolved": "https://registry.npmjs.org/viem/-/viem-2.55.1.tgz",
+ "integrity": "sha512-sajvEmONS3dEDFh0jKXGugTU8ImyGoIV3sEHSWNRhgkH484v/+6DjZAplRhcdeqNV/VBxOs/l3raOG4NaXvX9A==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/wevm"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@noble/curves": "1.9.1",
+ "@noble/hashes": "1.8.0",
+ "@scure/bip32": "1.7.0",
+ "@scure/bip39": "1.6.0",
+ "abitype": "1.2.3",
+ "isows": "1.0.7",
+ "ox": "0.14.30",
+ "ws": "8.21.0"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.4"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vite": {
+ "version": "6.4.3",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz",
+ "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "^0.25.0",
+ "fdir": "^6.4.4",
+ "picomatch": "^4.0.2",
+ "postcss": "^8.5.3",
+ "rollup": "^4.34.9",
+ "tinyglobby": "^0.2.13"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
+ "jiti": ">=1.21.0",
+ "less": "*",
+ "lightningcss": "^1.21.0",
+ "sass": "*",
+ "sass-embedded": "*",
+ "stylus": "*",
+ "sugarss": "*",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "lightningcss": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ws": {
+ "version": "8.21.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
+ "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "dev": true,
+ "license": "ISC"
+ }
+ }
+}
diff --git a/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/App.jsx b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/App.jsx
new file mode 100644
index 000000000..9f672e01a
--- /dev/null
+++ b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/App.jsx
@@ -0,0 +1,91 @@
+import { useState } from 'react'
+import { useHoodPortfolio } from './useHoodPortfolio.js'
+
+const DEFAULT_HOLDER = '0xA953CA88ff430e9487c60cA34d757414f4efdA07'
+const ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/
+
+export default function App() {
+ const [input, setInput] = useState(DEFAULT_HOLDER)
+ const [owner, setOwner] = useState(DEFAULT_HOLDER)
+ const { status, portfolio, error } = useHoodPortfolio(owner)
+
+ const submit = (e) => {
+ e.preventDefault()
+ if (ADDRESS_RE.test(input)) setOwner(input)
+ }
+
+ return (
+ <div className="wrap">
+ <header>
+ <h1>Portfolio Dashboard</h1>
+ <p className="sub">Multiplier-correct Stock Token holdings, polled every 20s — hoodchain reads only.</p>
+ </header>
+
+ <form onSubmit={submit} className="lookup">
+ <input
+ value={input}
+ onChange={(e) => setInput(e.target.value)}
+ placeholder="0x… holder address"
+ aria-label="Wallet address"
+ spellCheck={false}
+ />
+ <button type="submit" disabled={!ADDRESS_RE.test(input)}>
+ Look up
+ </button>
+ </form>
+ {!ADDRESS_RE.test(input) && input.length > 0 && <p className="hint">Not a valid address.</p>}
+
+ {status === 'loading' && (
+ <div className="grid">
+ {Array.from({ length: 3 }).map((_, i) => (
+ <div className="card skeleton" key={i}>
+ <div className="line w60" />
+ <div className="line w40" />
+ </div>
+ ))}
+ </div>
+ )}
+
+ {status === 'error' && (
+ <div className="panel error">
+ <strong>Couldn't load this portfolio.</strong>
+ <div className="mono">{error?.message}</div>
+ </div>
+ )}
+
+ {status === 'success' && portfolio.positions.length === 0 && (
+ <div className="panel empty">
+ <strong>No Stock Tokens held.</strong>
+ <div>This address doesn't hold any of the 95 registry tokens. Try the default holder, or your own address after a swap.</div>
+ </div>
+ )}
+
+ {status === 'success' && portfolio.positions.length > 0 && (
+ <>
+ <div className="total">
+ <span className="label">Total priced value</span>
+ <span className="value">${portfolio.totalUsd.toFixed(2)}</span>
+ </div>
+ <div className="grid">
+ {portfolio.positions.map((p) => (
+ <div className="card" key={p.symbol}>
+ <div className="sym">{p.symbol}</div>
+ <div className="value">{p.valueUsd === null ? 'unpriced' : `$${p.valueUsd.toFixed(2)}`}</div>
+ <div className="meta">
+ {p.balanceTokens.toFixed(6)} tokens · {p.shareEquivalent.toFixed(6)} share-equiv
+ </div>
+ </div>
+ ))}
+ </div>
+ {portfolio.unpricedSymbols.length > 0 && (
+ <p className="hint">Unpriced (no feed): {portfolio.unpricedSymbols.join(', ')}</p>
+ )}
+ </>
+ )}
+
+ <footer>
+ Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a>
+ </footer>
+ </div>
+ )
+}
diff --git a/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/main.jsx b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/main.jsx
new file mode 100644
index 000000000..edb0b3812
--- /dev/null
+++ b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/main.jsx
@@ -0,0 +1,10 @@
+import { StrictMode } from 'react'
+import { createRoot } from 'react-dom/client'
+import App from './App.jsx'
+import './style.css'
+
+createRoot(document.getElementById('root')).render(
+ <StrictMode>
+ <App />
+ </StrictMode>,
+)
diff --git a/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/style.css b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/style.css
new file mode 100644
index 000000000..b97e64d12
--- /dev/null
+++ b/robinhood/robinhood-chain-examples/examples/08-portfolio-dashboard/src/style.css
@@ -0,0 +1,59 @@
+:root {
+ --bg: #0a0b0f;
+ --panel: #14161d;
+ --panel-2: #191c25;
+ --line: #262a36;
+ --text: #e8eaf0;
+ --muted: #8b90a0;
+ --accent-a: #6d5efc;
+ --accent-b: #21d4a8;
+ --down: #ff5a7a;
+ --radius: 14px;
+}
+* { box-sizing: border-box; }
+html, body, #root { margin: 0; min-height: 100%; }
+body {
+ background: radial-gradient(1200px 600px at 70% -10%, #1a1330 0%, var(--bg) 55%) fixed;
+ color: var(--text);
+ font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
+}
+.wrap { max-width: 900px; margin: 0 auto; padding: 40px 20px 64px; }
+h1 {
+ font-size: 22px; margin: 0; letter-spacing: -0.02em;
+ background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
+ -webkit-background-clip: text; background-clip: text; color: transparent;
+}
+.sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
+.lookup { display: flex; gap: 8px; margin-top: 24px; }
+.lookup input {
+ flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
+ padding: 10px 14px; color: var(--text); font: inherit; font-variant-numeric: tabular-nums;
+}
+.lookup input:focus { outline: 2px solid var(--accent-a); outline-offset: 1px; border-color: transparent; }
+.lookup button {
+ background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); color: #0a0b0f; font-weight: 650;
+ border: none; border-radius: 10px; padding: 10px 18px; cursor: pointer; transition: opacity 0.15s;
+}
+.lookup button:hover:not(:disabled) { opacity: 0.9; }
+.lookup button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
+.lookup button:disabled { opacity: 0.4; cursor: not-allowed; }
+.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
+.total { display: flex; align-items: baseline; gap: 10px; margin-top: 28px; }
+.total .label { color: var(--muted); font-size: 13px; }
+.total .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; }
+.grid { margin-top: 16px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
+.card { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
+.card .sym { font-weight: 650; font-size: 14px; }
+.card .value { font-size: 20px; margin-top: 8px; font-variant-numeric: tabular-nums; }
+.card .meta { color: var(--muted); font-size: 11px; margin-top: 6px; }
+.card.skeleton .line { height: 14px; border-radius: 6px; margin-top: 10px; background: linear-gradient(90deg, #1d2029, #23272f, #1d2029); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
+.card.skeleton .w60 { width: 60%; }
+.card.skeleton .w40 { width: 40%; }
+@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
+.panel { margin-top: 20px; border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); }
+.panel.error { border-color: #4a2230; background: #1c1016; color: var(--down); }
+.panel.empty { background: var(--panel); color: var(--muted); }
+.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; margin-top: 6px; }
+footer { margin-top: 40px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 18px; }
+a { color: #9b8dff; text-decoration: none; }
+a:hover { text-decoration: underline; }
diff --git a/src/game/world-env.js b/src/game/world-env.js
index 49708b1d2..d49743e9d 100644
--- a/src/game/world-env.js
+++ b/src/game/world-env.js
@@ -135,6 +135,22 @@ const CURATED_BIOMES = [
hill: 0x141b24, trunk: 0x2a3645, leafA: 0x223044, leafB: 0x2c3c52,
flora: 'conifer', density: 12,
},
+ {
+ // Robinhood Chain worlds. A trading-floor-at-night mood — deep emerald
+ // dark fading to near-black, gold ticker-tape accents on the ring and
+ // glass "crystal" flora standing in for a financial district skyline. No
+ // wordmark, logo, or literal brand hex; the palette nods at "stocks +
+ // tape" rather than reproducing anyone's UI. Pinned via ?biome=hoodchain
+ // (or opts.biome) so every Robinhood Chain coin shares this family while
+ // the usual per-coin hue jitter keeps them from looking identical.
+ id: 'hoodchain', label: 'Ticker Row',
+ sky: ['#03130c', '#0a2e1e', '#123c28'], fog: '#0a2419', fogNear: 75, fogFar: 310,
+ hemi: [0x3fd68a, 0x081a10, 0.62], ambient: 0.26,
+ sun: { color: 0xffc35a, intensity: 1.6, elevation: 44, azimuth: 205 },
+ ground: 0x0e1d15, plaza: 0x162a1f, grid: 0x2a4636, ring: 0xf2b705,
+ hill: 0x11241a, trunk: 0x203a2c, leafA: 0x1fae6e, leafB: 0x2ecf85,
+ flora: 'crystal', density: 26,
+ },
];
// Map any seed to a biome. Exposed so the UI can name the world the player is in.
diff --git a/src/robinhood-pages.css b/src/robinhood-pages.css
new file mode 100644
index 000000000..5176af6e7
--- /dev/null
+++ b/src/robinhood-pages.css
@@ -0,0 +1,352 @@
+/*
+ * Robinhood Chain surfaces (/markets/robinhood, stock + coin detail pages,
+ * purchase flow). Built on the shared coin-pages.css token system — no new
+ * palette, just Robinhood-specific components: tabs, the stock/coin board,
+ * premium/discount chips, and the buy panel.
+ */
+
+.rh-tabs {
+ display: flex;
+ gap: 0.5rem;
+ border-bottom: 1px solid var(--cv-border);
+ margin-bottom: 1.25rem;
+ overflow-x: auto;
+}
+
+.rh-tab {
+ appearance: none;
+ background: none;
+ border: none;
+ border-bottom: 2px solid transparent;
+ color: var(--cv-text-2);
+ font: inherit;
+ font-weight: 600;
+ font-size: 0.9375rem;
+ padding: 0.75rem 0.25rem;
+ margin-right: 1.25rem;
+ cursor: pointer;
+ white-space: nowrap;
+ transition:
+ color 0.15s ease,
+ border-color 0.15s ease;
+}
+
+.rh-tab:hover {
+ color: var(--cv-text);
+}
+
+.rh-tab:focus-visible {
+ outline: 2px solid var(--cv-accent);
+ outline-offset: 2px;
+ border-radius: var(--cv-radius-sm);
+}
+
+.rh-tab[aria-selected='true'] {
+ color: var(--cv-text);
+ border-bottom-color: var(--cv-accent);
+}
+
+.rh-panel[hidden] {
+ display: none;
+}
+
+.rh-toolbar {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 0.75rem;
+ margin-bottom: 1rem;
+}
+
+.rh-search {
+ flex: 1 1 220px;
+ max-width: 320px;
+ background: var(--cv-surface-2);
+ border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius-md);
+ color: var(--cv-text);
+ font: inherit;
+ font-size: 0.875rem;
+ padding: 0.5rem 0.75rem;
+}
+
+.rh-search:focus-visible {
+ outline: 2px solid var(--cv-accent);
+ outline-offset: 1px;
+}
+
+.rh-sortbar {
+ display: flex;
+ gap: 0.375rem;
+ flex-wrap: wrap;
+}
+
+.rh-sort-btn {
+ appearance: none;
+ background: var(--cv-surface-2);
+ border: 1px solid var(--cv-border);
+ border-radius: 999px;
+ color: var(--cv-text-2);
+ font: inherit;
+ font-size: 0.8125rem;
+ font-weight: 600;
+ padding: 0.375rem 0.75rem;
+ cursor: pointer;
+ transition:
+ background 0.15s ease,
+ color 0.15s ease,
+ border-color 0.15s ease;
+}
+
+.rh-sort-btn:hover {
+ border-color: var(--cv-border-hover);
+ color: var(--cv-text);
+}
+
+.rh-sort-btn[aria-pressed='true'] {
+ background: var(--cv-accent);
+ border-color: var(--cv-accent);
+ color: #fff;
+}
+
+.rh-sort-btn:focus-visible {
+ outline: 2px solid var(--cv-accent);
+ outline-offset: 2px;
+}
+
+.rh-premium {
+ font-family: var(--cv-font-mono);
+ font-size: 0.8125rem;
+ font-weight: 600;
+ padding: 0.125rem 0.5rem;
+ border-radius: var(--cv-radius-sm);
+}
+
+.rh-premium.pos {
+ color: var(--cv-green);
+ background: var(--cv-green-soft);
+}
+
+.rh-premium.neg {
+ color: var(--cv-red);
+ background: var(--cv-red-soft);
+}
+
+.rh-premium.flat {
+ color: var(--cv-text-3);
+ background: var(--cv-surface-3);
+}
+
+.rh-symbol-cell {
+ display: flex;
+ align-items: center;
+ gap: 0.625rem;
+}
+
+.rh-symbol-cell img {
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ object-fit: cover;
+ background: var(--cv-surface-3);
+ flex-shrink: 0;
+}
+
+.rh-symbol-cell .sym {
+ font-weight: 700;
+ color: var(--cv-text);
+}
+
+.rh-symbol-cell .name {
+ color: var(--cv-text-3);
+ font-size: 0.8125rem;
+}
+
+.rh-launchpad-badge {
+ display: inline-flex;
+ align-items: center;
+ font-size: 0.75rem;
+ font-weight: 600;
+ padding: 0.1875rem 0.5rem;
+ border-radius: 999px;
+ background: var(--cv-surface-3);
+ color: var(--cv-text-2);
+ border: 1px solid var(--cv-border);
+}
+
+.rh-disclosure {
+ font-size: 0.8125rem;
+ color: var(--cv-text-3);
+ background: var(--cv-surface-2);
+ border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius-md);
+ padding: 0.75rem 1rem;
+ margin: 1rem 0;
+ line-height: 1.5;
+}
+
+.rh-stat-strip {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 0.75rem;
+ margin-bottom: 1.5rem;
+}
+@media (min-width: 640px) {
+ .rh-stat-strip {
+ grid-template-columns: repeat(4, 1fr);
+ }
+}
+
+/* ── Purchase / buy panel ─────────────────────────────────────────────── */
+
+.rh-buy-panel {
+ background: var(--cv-surface-2);
+ border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius-lg);
+ padding: 1.25rem;
+ box-shadow: var(--cv-shadow-card);
+}
+
+.rh-buy-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.75rem;
+ margin-bottom: 0.75rem;
+}
+
+.rh-buy-input {
+ width: 100%;
+ background: var(--cv-surface);
+ border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius-md);
+ color: var(--cv-text);
+ font: inherit;
+ font-family: var(--cv-font-mono);
+ font-size: 1.125rem;
+ padding: 0.625rem 0.75rem;
+}
+
+.rh-buy-input:focus-visible {
+ outline: 2px solid var(--cv-accent);
+ outline-offset: 1px;
+}
+
+.rh-buy-btn {
+ appearance: none;
+ width: 100%;
+ background: var(--cv-accent);
+ border: none;
+ border-radius: var(--cv-radius-md);
+ color: #fff;
+ font: inherit;
+ font-weight: 700;
+ font-size: 0.9375rem;
+ padding: 0.75rem 1rem;
+ cursor: pointer;
+ transition:
+ background 0.15s ease,
+ transform 0.1s ease;
+}
+
+.rh-buy-btn:hover {
+ background: var(--cv-accent-hover);
+}
+
+.rh-buy-btn:active {
+ transform: scale(0.99);
+}
+
+.rh-buy-btn:focus-visible {
+ outline: 2px solid var(--cv-accent);
+ outline-offset: 2px;
+}
+
+.rh-buy-btn[disabled] {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
+.rh-buy-secondary {
+ appearance: none;
+ width: 100%;
+ background: transparent;
+ border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius-md);
+ color: var(--cv-text-2);
+ font: inherit;
+ font-weight: 600;
+ font-size: 0.875rem;
+ padding: 0.625rem 1rem;
+ cursor: pointer;
+ margin-top: 0.5rem;
+ transition:
+ border-color 0.15s ease,
+ color 0.15s ease;
+}
+
+.rh-buy-secondary:hover {
+ border-color: var(--cv-border-hover);
+ color: var(--cv-text);
+}
+
+.rh-buy-secondary:focus-visible {
+ outline: 2px solid var(--cv-accent);
+ outline-offset: 2px;
+}
+
+.rh-buy-meta {
+ display: flex;
+ justify-content: space-between;
+ font-size: 0.8125rem;
+ color: var(--cv-text-3);
+ margin-top: 0.5rem;
+}
+
+.rh-buy-status {
+ font-size: 0.8125rem;
+ margin-top: 0.75rem;
+ padding: 0.625rem 0.75rem;
+ border-radius: var(--cv-radius-md);
+ background: var(--cv-surface-3);
+ color: var(--cv-text-2);
+ line-height: 1.5;
+ word-break: break-all;
+}
+
+.rh-buy-status.error {
+ background: var(--cv-red-soft);
+ color: var(--cv-red);
+}
+
+.rh-buy-status.success {
+ background: var(--cv-green-soft);
+ color: var(--cv-green);
+}
+
+.rh-eligibility-gate {
+ text-align: center;
+ padding: 1.5rem 1rem;
+}
+
+.rh-eligibility-gate p {
+ color: var(--cv-text-2);
+ font-size: 0.875rem;
+ line-height: 1.6;
+ margin: 0.5rem 0 1rem;
+}
+
+.rh-bridge-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.375rem;
+ color: var(--cv-accent);
+ font-weight: 600;
+ font-size: 0.875rem;
+ text-decoration: none;
+}
+
+.rh-bridge-link:hover,
+.rh-bridge-link:focus-visible {
+ text-decoration: underline;
+}
diff --git a/workers/robinhood-feed/package.json b/workers/robinhood-feed/package.json
index 6b04e3ee5..4a28dd22a 100644
--- a/workers/robinhood-feed/package.json
+++ b/workers/robinhood-feed/package.json
@@ -9,7 +9,7 @@
"main": "index.js",
"scripts": {
"start": "node index.js",
- "test": "node --test tests/"
+ "test": "node --test tests/**/*.test.js"
},
"dependencies": {
"hoodchain": "file:../../robinhood/robinhood-chain-sdk",
diff --git a/workers/robinhood-feed/src/normalize.js b/workers/robinhood-feed/src/normalize.js
index 4709a466e..208d953dd 100644
--- a/workers/robinhood-feed/src/normalize.js
+++ b/workers/robinhood-feed/src/normalize.js
@@ -21,6 +21,11 @@ const num = (v) => (Number.isFinite(v) ? v : null);
/**
* A token launch (NOXA instant list or Odyssey curve open).
* pump `mint` → `mint` (the coin address; this is the world seed).
+ *
+ * `launch.initialBuyAmount` is best-effort: the hoodchain SDK's high-level
+ * `watchLaunches`/`getRecentLaunches` return the decoded `Launch` shape,
+ * which does not carry it (it's a NOXA-only raw log field). When absent this
+ * resolves to `null`, never a fabricated value.
*/
export function normalizeLaunch({ launch, name = null, symbol = null, ethUsd = 0, atMs }) {
const initialNative = launch.initialBuyAmount != null
diff --git a/workers/robinhood-feed/tests/normalize.test.js b/workers/robinhood-feed/tests/normalize.test.js
new file mode 100644
index 000000000..cfcc7af91
--- /dev/null
+++ b/workers/robinhood-feed/tests/normalize.test.js
@@ -0,0 +1,162 @@
+// Unit tests for the pure normalizer against REAL on-chain logs captured live
+// from Robinhood Chain mainnet (chain 4663) during development — see
+// tests/fixtures/*.json and the capture commands in README.md. No mocks.
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { dirname, join } from 'node:path';
+
+import {
+ normalizeLaunch, normalizeCurveTrade, normalizeUniswapSwap, normalizeGraduation,
+} from '../src/normalize.js';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const tradedFixture = JSON.parse(readFileSync(join(__dirname, 'fixtures/traded-logs.json'), 'utf8'));
+const launchFixture = JSON.parse(readFileSync(join(__dirname, 'fixtures/launch-swap-logs.json'), 'utf8'));
+
+const bi = (v) => BigInt(v);
+
+test('normalizeCurveTrade: real Odyssey Traded log → pump-compatible trade', () => {
+ const raw = tradedFixture.traded[0];
+ assert.equal(raw.eventName, 'Traded');
+ const trade = {
+ launchpad: 'odyssey',
+ token: raw.args.token,
+ trader: raw.args.trader,
+ isBuy: raw.args.isBuy,
+ tokenAmount: bi(raw.args.tokenAmount),
+ quoteAmount: bi(raw.args.quoteAmount),
+ fee: bi(raw.args.fee),
+ blockNumber: bi(raw.blockNumber),
+ transactionHash: raw.transactionHash,
+ };
+ const out = normalizeCurveTrade({ trade, name: 'Test Coin', symbol: 'TEST', ethUsd: 3000, atMs: 1_800_000_000_000 });
+
+ assert.equal(out.chain, 'robinhood-chain');
+ assert.equal(out.chain_id, 4663);
+ assert.equal(out.mint, raw.args.token);
+ assert.equal(out.address, raw.args.token);
+ assert.equal(out.is_buy, raw.args.isBuy);
+ assert.equal(out.tx_type, raw.args.isBuy ? 'buy' : 'sell');
+ assert.equal(out.trader, raw.args.trader);
+ assert.equal(out.user, raw.args.trader); // chart-screen reads `user`
+ assert.equal(out.tx, raw.transactionHash); // chart-screen dedupe key
+ // quoteAmount 90044474151232482 wei = 0.090044474151232482 ETH
+ assert.ok(Math.abs(out.sol_amount - 0.090044474151232482) < 1e-9);
+ assert.ok(Math.abs(out.usd_amount - 0.090044474151232482 * 3000) < 1e-6);
+ assert.equal(out.usd_amount, out.sol_value_usd);
+ assert.equal(out.quote_symbol, 'ETH');
+ assert.ok(Number.isFinite(out.price_usd));
+ assert.equal(out.block_number, Number(raw.blockNumber));
+});
+
+test('normalizeCurveTrade: zero ETH price leaves USD fields null, never NaN', () => {
+ const raw = tradedFixture.traded[0];
+ const trade = {
+ launchpad: 'odyssey', token: raw.args.token, trader: raw.args.trader,
+ isBuy: raw.args.isBuy, tokenAmount: bi(raw.args.tokenAmount), quoteAmount: bi(raw.args.quoteAmount),
+ fee: bi(raw.args.fee), blockNumber: bi(raw.blockNumber), transactionHash: raw.transactionHash,
+ };
+ const out = normalizeCurveTrade({ trade, ethUsd: 0 });
+ assert.equal(out.usd_amount, null);
+ assert.equal(out.price_usd, null);
+ assert.ok(Number.isFinite(out.sol_amount)); // native amount is always known
+});
+
+test('normalizeLaunch: real NOXA TokenLaunched log → pump-compatible launch', () => {
+ const raw = launchFixture.noxa[0];
+ assert.equal(raw.args.pool, launchFixture.pool);
+ const launch = {
+ launchpad: 'noxa',
+ token: raw.args.token,
+ creator: raw.args.deployer,
+ pool: raw.args.pool,
+ blockNumber: bi(raw.blockNumber),
+ transactionHash: raw.transactionHash,
+ initialBuyAmount: bi(raw.args.initialBuyAmount),
+ };
+ const out = normalizeLaunch({ launch, name: 'Some Token', symbol: 'SOME', ethUsd: 3000, atMs: 1_800_000_000_000 });
+
+ assert.equal(out.launchpad, 'noxa');
+ assert.equal(out.mint, raw.args.token);
+ assert.equal(out.creator, raw.args.deployer);
+ assert.equal(out.pool, raw.args.pool);
+ assert.equal(out.signature, raw.transactionHash);
+ // initialBuyAmount 100000000000000000 wei = 0.1 ETH
+ assert.ok(Math.abs(out.initial_buy_native - 0.1) < 1e-9);
+ assert.ok(Math.abs(out.initial_buy_usd - 300) < 1e-6);
+ assert.equal(out.explorer_url, `https://robinhoodchain.blockscout.com/address/${raw.args.token}`);
+});
+
+test('normalizeGraduation: Odyssey token created (used as a graduation-shape sanity check)', () => {
+ const raw = launchFixture.created[0];
+ const grad = {
+ token: raw.args.token,
+ pool: '0xF11561e6448924ECC6e68B0fA59408089FB775C1',
+ blockNumber: bi(raw.blockNumber),
+ transactionHash: raw.transactionHash,
+ };
+ const out = normalizeGraduation({ grad, name: 'Grad Coin', symbol: 'GRAD', atMs: 1_800_000_000_000 });
+ assert.equal(out.mint, raw.args.token);
+ assert.equal(out.pool, grad.pool);
+ assert.equal(out.tx_signature, raw.transactionHash);
+});
+
+test('normalizeUniswapSwap: real Uniswap v3 Swap log on the NOXA pool → BUY when coin is token1 and leaves the pool', () => {
+ const raw = launchFixture.swaps[0];
+ // From capture: pool token0=WETH (0x0Bd7...), token1=coin. amount0 positive
+ // (WETH in), amount1 negative (coin out) ⇒ trader bought the coin with ETH.
+ const swap = {
+ amount0: bi(raw.args.amount0),
+ amount1: bi(raw.args.amount1),
+ recipient: raw.args.recipient,
+ sender: raw.args.sender,
+ transactionHash: raw.transactionHash,
+ blockNumber: bi(raw.blockNumber),
+ };
+ assert.ok(swap.amount0 > 0n && swap.amount1 < 0n);
+ const out = normalizeUniswapSwap({
+ swap, token: launchFixture.noxa[0].args.token, pool: launchFixture.pool,
+ coinIsToken0: false, quoteSymbol: 'ETH', quoteDecimals: 18,
+ name: 'Some Token', symbol: 'SOME', ethUsd: 3000, atMs: 1_800_000_000_000,
+ });
+ assert.equal(out.is_buy, true);
+ assert.equal(out.tx_type, 'buy');
+ assert.equal(out.trader, raw.args.recipient);
+ assert.ok(out.sol_amount > 0); // native ETH magnitude, always positive
+ assert.ok(out.usd_amount > 0);
+ assert.equal(out.pool, launchFixture.pool);
+});
+
+test('normalizeUniswapSwap: coin flowing IN (positive delta on coin side) is a SELL', () => {
+ const raw = launchFixture.swaps[0];
+ const swap = {
+ amount0: bi(raw.args.amount1) * -1n, // coin now positive (flowing in)
+ amount1: bi(raw.args.amount0) * -1n,
+ recipient: raw.args.recipient, sender: raw.args.sender,
+ transactionHash: raw.transactionHash, blockNumber: bi(raw.blockNumber),
+ };
+ const out = normalizeUniswapSwap({
+ swap, token: launchFixture.noxa[0].args.token, pool: launchFixture.pool,
+ coinIsToken0: true, quoteSymbol: 'ETH', quoteDecimals: 18, ethUsd: 3000,
+ });
+ assert.equal(out.is_buy, false);
+ assert.equal(out.tx_type, 'sell');
+});
+
+test('normalizeUniswapSwap: USDG quote uses 1:1 USD, no ETH price dependency', () => {
+ const raw = launchFixture.swaps[0];
+ const swap = {
+ amount0: bi(raw.args.amount0), amount1: bi(raw.args.amount1),
+ recipient: raw.args.recipient, sender: raw.args.sender,
+ transactionHash: raw.transactionHash, blockNumber: bi(raw.blockNumber),
+ };
+ const out = normalizeUniswapSwap({
+ swap, token: launchFixture.noxa[0].args.token, pool: launchFixture.pool,
+ coinIsToken0: false, quoteSymbol: 'USDG', quoteDecimals: 6, ethUsd: 0,
+ });
+ assert.equal(out.quote_symbol, 'USDG');
+ assert.ok(out.usd_amount > 0); // resolved without any ETH price
+});