diff --git a/app/(marketing)/exchange/page.tsx b/app/(marketing)/exchange/page.tsx new file mode 100644 index 0000000..3395c10 --- /dev/null +++ b/app/(marketing)/exchange/page.tsx @@ -0,0 +1,134 @@ +import Link from "next/link"; +import { EXCHANGE, loadExchangeLive, type ExchangeItem } from "@/lib/exchange/catalog"; + +export const revalidate = 300; + +export const metadata = { + title: "Exchange — rent hardware, software, AI and traffic", + description: + "Rent a desktop, a Linux shell, GPU time, hosting or an AI marketer by the day, buy or sell real ad traffic, or rent out your own spare computer. One place, plain English, paid in crypto.", + alternates: { canonical: "/exchange" }, + openGraph: { + title: "The CrawlProof Exchange", + description: + "Rent hardware, software, AI help and traffic, or sell your own spare compute. Powered by the c0mpute network and CrawlProof Ads.", + url: "/exchange", + }, +}; + +/** + * The normie front door to the c0mpute marketplace. c0mpute.com sells to + * people who already speak nodes and sealed bids; this page says the same + * catalog in plain English and links each line to the page that actually + * bills for it. The catalog lives in lib/exchange/catalog.ts, shared with + * /api/exchange. + */ +export default async function ExchangePage() { + const live = await loadExchangeLive(revalidate); + + const stats: { label: string; value: string }[] = []; + if (live.nodesOnline !== null) stats.push({ label: "machines online now", value: String(live.nodesOnline) }); + if (live.gpuNodes !== null && live.gpuNodes > 0) stats.push({ label: "with a GPU", value: String(live.gpuNodes) }); + if (live.expertsCount !== null) stats.push({ label: "AI experts for hire", value: String(live.expertsCount) }); + if (live.expertsTrialDays !== null) stats.push({ label: "days free on experts", value: String(live.expertsTrialDays) }); + + return ( +
+
+

+ The Exchange +

+

Rent it, run it, or rent yours out.

+

+ Desktops, servers, GPU time, hosting, AI help and real ad traffic, by the day or by the job. + Or put your own idle computer to work and get paid for it. No contracts, no sales calls, + paid in crypto. +

+ + {stats.length > 0 && ( +
+ {stats.map((s) => ( +
+
{s.label}
+
{s.value}
+
+ ))} +
+ )} +
+ + {EXCHANGE.map((section) => ( +
+

{section.title}

+

{section.intro}

+ +
+ ))} + +
+

How paying works

+

+ Everything on the c0mpute side is bought with one CoinPay sign-in and paid from your c0mpute + balance. Traffic is bought and sold with CrawlProof credits. Each card links to the page that + sells it, which has the current price and availability. + {live.expertsBundleUsd !== null && + ` AI experts are $${live.expertsBundleUsd} for all of them per month after the free trial.`} +

+

+ Prefer a terminal? Install the CLI with{" "} + curl -fsSL https://c0mpute.com/install.sh | sh, then use the command on each card. +

+
+ + Get started on c0mpute + + + Buy or sell traffic + +
+
+
+ ); +} + +function Offer({ item }: { item: ExchangeItem }) { + const external = item.href.startsWith("http"); + const cta = external ? "Open on c0mpute" : "Open"; + return ( +
+
+

{item.name}

+ {item.price && {item.price}} +
+

{item.blurb}

+ {item.cli && ( +

+ {item.cli} +

+ )} +
+ {external ? ( + + {cta} → + + ) : ( + + {cta} → + + )} +
+
+ ); +} diff --git a/app/api/exchange/route.ts b/app/api/exchange/route.ts new file mode 100644 index 0000000..df052e5 --- /dev/null +++ b/app/api/exchange/route.ts @@ -0,0 +1,18 @@ +// GET /api/exchange — the Exchange catalog as JSON, the same data /exchange +// renders, with live c0mpute counts. Public, cacheable, no key. +import { EXCHANGE, loadExchangeLive } from "@/lib/exchange/catalog"; + +export const revalidate = 300; + +export async function GET() { + const live = await loadExchangeLive(revalidate); + return Response.json( + { object: "exchange", page: "https://crawlproof.com/exchange", live, sections: EXCHANGE }, + { + headers: { + "cache-control": "public, max-age=300, s-maxage=300", + "access-control-allow-origin": "*", + }, + }, + ); +} diff --git a/app/sitemap.ts b/app/sitemap.ts index 69d8740..07554c0 100644 --- a/app/sitemap.ts +++ b/app/sitemap.ts @@ -20,6 +20,7 @@ export default async function sitemap(): Promise { { url: `${base}/slop`, changeFrequency: "monthly", priority: 0.9 }, // Hub for the five free scanners — the three that need an account had no // inbound link anywhere before this page existed. + { url: `${base}/exchange`, changeFrequency: "weekly", priority: 0.9 }, { url: `${base}/tools`, changeFrequency: "monthly", priority: 0.9 }, { url: `${base}/get-guide`, changeFrequency: "monthly", priority: 0.9 }, { url: `${base}/about`, changeFrequency: "monthly", priority: 0.7 }, diff --git a/components/site-header.tsx b/components/site-header.tsx index efa8308..edf4053 100644 --- a/components/site-header.tsx +++ b/components/site-header.tsx @@ -36,6 +36,7 @@ export async function SiteHeader() { Social Pricing Ads + Exchange Guide Recent diff --git a/lib/exchange/catalog.ts b/lib/exchange/catalog.ts new file mode 100644 index 0000000..c877ccb --- /dev/null +++ b/lib/exchange/catalog.ts @@ -0,0 +1,281 @@ +// The Exchange: a plain-English front door to everything you can rent, buy or +// sell on the c0mpute network, plus traffic through CrawlProof Ads. +// +// c0mpute.com is written for people who already know what a node or a sealed +// bid is. This page is for everybody else, so every entry says what you get in +// one sentence and links to the real page that sells it. Nothing is sold here: +// the catalog only points, which keeps prices and availability owned by the +// site that actually bills for them. +// +// Traffic is sold as ad placements, never as raw visitors. The fleet's own +// visitor counts are mostly crawlers and swarm patterns, and reselling them as +// "traffic" would be ad fraud; CrawlProof Ads only bills clicks that pass its +// bot filter. Keep it that way. + +import { CPC_CENTS, CPC_CREDITS, centsToDollars, creditsToPayoutCents } from "@/lib/ads/pricing"; + +export const C0MPUTE = "https://c0mpute.com"; + +export type ExchangeSide = "buy" | "sell"; + +export type ExchangeItem = { + id: string; + /** What a normal person would call it. */ + name: string; + /** One sentence: what you get. */ + blurb: string; + /** Price as the selling page states it, or null when it varies. */ + price: string | null; + href: string; + /** CLI command for people who would rather type. */ + cli?: string; +}; + +export type ExchangeSection = { + id: string; + title: string; + intro: string; + side: ExchangeSide; + items: ExchangeItem[]; +}; + +const c = (path: string) => `${C0MPUTE}${path}`; + +export const EXCHANGE: ExchangeSection[] = [ + { + id: "hardware", + title: "Rent hardware", + intro: "Real machines on the network, by the day or by the job. No contract and no sales call.", + side: "buy", + items: [ + { + id: "rent-a-desktop", + name: "Rent-a-desktop", + blurb: "A full Linux desktop in your browser tab, for a day or up to a month.", + price: "$5/day", + href: c("/rent/desktop"), + cli: "c0mpute rent desktop", + }, + { + id: "rent-a-shell", + name: "Rent-a-shell", + blurb: "A Linux machine you log into over SSH. Run scripts, builds or a bot.", + price: "$5/day", + href: c("/rent/shell"), + cli: "c0mpute rent shell", + }, + { + id: "rent-a-gpu", + name: "Rent-a-GPU / CPU time", + blurb: "Pay for compute by the job. You name the most you will pay; nodes bid under it.", + price: null, + href: c("/market"), + }, + { + id: "train", + name: "Train your own AI", + blurb: "Fine-tune a model on your own writing, on rented nodes.", + price: null, + href: c("/solutions/fine-tune"), + }, + ], + }, + { + id: "software", + title: "Host software and sites", + intro: "Put a site, an app or a backend on the network. Copies are kept on several machines so one going down does not take you with it.", + side: "buy", + items: [ + { + id: "rent-a-host", + name: "Website hosting", + blurb: "Publish a site; it is served from self-healing copies across the network.", + price: null, + href: c("/solutions/hosting"), + cli: "c0mpute hosting publish", + }, + { + id: "rent-a-vps", + name: "Apps and backends", + blurb: "Run a container or API without renting and babysitting a whole server.", + price: null, + href: c("/solutions/apps"), + cli: "c0mpute apps deploy", + }, + { + id: "storage", + name: "File storage", + blurb: "Store files with three copies kept on different machines.", + price: null, + href: c("/apps"), + cli: "c0mpute storage put", + }, + { + id: "scallion", + name: "Private routing", + blurb: "Scallion: three-hop private routing over the network. Experimental.", + price: null, + href: c("/scallion"), + }, + ], + }, + { + id: "ai", + title: "Rent AI help", + intro: "Open models running on the network, as a chat, an API or a specialist you can ask.", + side: "buy", + items: [ + { + id: "rent-a-marketer", + name: "Rent-a-marketer", + blurb: "The Sales Coach expert: positioning, outreach drafts and follow-ups for what you sell.", + price: null, + href: c("/experts/sales-coach"), + cli: 'c0mpute ask sales-coach "..."', + }, + { + id: "experts", + name: "AI experts", + blurb: "A security analyst, an automation engineer, and general legal and tax information.", + price: null, + href: c("/experts"), + }, + { + id: "rent-an-ai", + name: "AI chat and API", + blurb: "Chat with open models, or call an OpenAI-compatible API from your own code.", + price: null, + href: c("/solutions/chat-api"), + }, + { + id: "finance-advisor", + name: "Finance advisor", + blurb: "Cash flow, runway and P&L read from your own accounts.", + price: null, + href: c("/advisor/finance"), + }, + ], + }, + { + id: "create", + title: "Make media", + intro: "Generated on network machines, paid per job.", + side: "buy", + items: [ + { id: "images", name: "Images", blurb: "Pictures from a prompt.", price: null, href: c("/solutions/images") }, + { id: "video", name: "Video", blurb: "Short clips and promo videos.", price: null, href: c("/solutions/video") }, + { id: "music", name: "Music", blurb: "Songs and whole albums from a prompt.", price: null, href: c("/solutions/music") }, + { id: "speech", name: "Voiceover", blurb: "Text read aloud by network voices.", price: null, href: c("/solutions/speech") }, + ], + }, + { + id: "traffic", + title: "Buy or sell traffic", + intro: "Traffic here means real clicks on ads, counted conservatively: bot clicks are not billed and repeat clicks inside six hours count once.", + side: "buy", + items: [ + { + id: "buy-traffic", + name: "Buy traffic", + blurb: "Paste your landing page, get ads designed for you, and pay only when someone clicks.", + price: `${centsToDollars(CPC_CENTS)}/click`, + href: "/ads", + }, + { + id: "sell-traffic", + name: "Sell your traffic", + blurb: "Put one ad tag on your site and get paid in crypto for every real click.", + price: `${centsToDollars(creditsToPayoutCents(CPC_CREDITS))}/click`, + href: "/ads", + }, + ], + }, + { + id: "earn", + title: "Sell your spare hardware", + intro: "The other side of the exchange: your idle machine rents itself out while you sleep.", + side: "sell", + items: [ + { + id: "run-a-node", + name: "Rent out your computer", + blurb: "Install the node, and it takes jobs when your machine is idle.", + price: null, + href: c("/providers"), + }, + { + id: "estimates", + name: "What would mine earn?", + blurb: "Estimates for your hardware before you install anything.", + price: null, + href: c("/estimates"), + }, + { + id: "gallery", + name: "Show what you built", + blurb: "Get your c0mpute build listed in the public gallery.", + price: null, + href: c("/gallery/submit"), + }, + ], + }, +]; + +// --- live numbers ----------------------------------------------------------- + +export type ExchangeLive = { + nodesOnline: number | null; + gpuNodes: number | null; + expertsCount: number | null; + expertsBundleUsd: number | null; + expertsTrialDays: number | null; +}; + +export const EMPTY_LIVE: ExchangeLive = { + nodesOnline: null, + gpuNodes: null, + expertsCount: null, + expertsBundleUsd: null, + expertsTrialDays: null, +}; + +const num = (v: unknown): number | null => (typeof v === "number" && Number.isFinite(v) ? v : null); + +/** Shape-tolerant readers, exported for tests. A field we cannot read is null, never a guess. */ +export function readNodes(body: unknown): Pick { + const b = (body ?? {}) as { workers_online?: unknown; nodes?: unknown }; + const nodes = Array.isArray(b.nodes) ? (b.nodes as { class?: unknown }[]) : null; + return { + nodesOnline: num(b.workers_online) ?? (nodes ? nodes.length : null), + gpuNodes: nodes ? nodes.filter((n) => typeof n?.class === "string" && n.class.startsWith("gpu")).length : null, + }; +} + +export function readExperts( + body: unknown, +): Pick { + const b = (body ?? {}) as { count?: unknown; data?: unknown; pricing?: { all_experts_usd?: unknown; trial_days?: unknown } }; + return { + expertsCount: num(b.count) ?? (Array.isArray(b.data) ? b.data.length : null), + expertsBundleUsd: num(b.pricing?.all_experts_usd), + expertsTrialDays: num(b.pricing?.trial_days), + }; +} + +async function getJson(url: string, revalidate: number): Promise { + try { + const r = await fetch(url, { next: { revalidate }, signal: AbortSignal.timeout(4000) }); + return r.ok ? await r.json() : null; + } catch { + return null; + } +} + +/** Live counts from c0mpute. Any failure degrades to nulls; the page never waits on it for long. */ +export async function loadExchangeLive(revalidate = 300): Promise { + const [nodes, experts] = await Promise.all([ + getJson(`${C0MPUTE}/api/nodes`, revalidate), + getJson(`${C0MPUTE}/api/v1/experts`, revalidate), + ]); + return { ...EMPTY_LIVE, ...readNodes(nodes), ...readExperts(experts) }; +} diff --git a/next.config.ts b/next.config.ts index 47c5ec9..3376c79 100644 --- a/next.config.ts +++ b/next.config.ts @@ -94,6 +94,11 @@ const nextConfig: NextConfig = { // marketing page (it redirects signed-in visitors on its own), and // /ads/house/* is artwork in public/ — redirects run before the // filesystem, so a blanket /ads/:path* would 404 every house creative. + // Traffic is bought and sold on the Exchange (as ad clicks, never raw + // visitors); the obvious URLs people guess all land there. + { source: "/traffic", destination: "/exchange#traffic", permanent: false }, + { source: "/traffic-exchange", destination: "/exchange", permanent: false }, + { source: "/marketplace", destination: "/exchange", permanent: false }, { source: "/ads/:path((?!house/).*)", destination: "/dashboard/ads/:path", diff --git a/tests/exchange-catalog.test.ts b/tests/exchange-catalog.test.ts new file mode 100644 index 0000000..4b71775 --- /dev/null +++ b/tests/exchange-catalog.test.ts @@ -0,0 +1,47 @@ +import { describe, expect, it } from "vitest"; +import { EXCHANGE, readExperts, readNodes } from "@/lib/exchange/catalog"; + +describe("exchange catalog", () => { + const items = EXCHANGE.flatMap((s) => s.items); + + it("has unique section and item ids (they are page anchors)", () => { + const ids = [...EXCHANGE.map((s) => s.id), ...items.map((i) => i.id)]; + expect(new Set(ids).size).toBe(ids.length); + }); + + it("links only to c0mpute.com or a local page", () => { + for (const i of items) expect(i.href).toMatch(/^(https:\/\/c0mpute\.com\/|\/)/); + }); + + it("sells traffic only as ad clicks, never raw visitors", () => { + const traffic = EXCHANGE.find((s) => s.id === "traffic"); + expect(traffic?.items.every((i) => i.href === "/ads")).toBe(true); + expect(traffic?.items.every((i) => i.price?.endsWith("/click"))).toBe(true); + }); + + it("covers the rent-a-* lineup", () => { + for (const id of ["rent-a-desktop", "rent-a-shell", "rent-a-gpu", "rent-a-host", "rent-a-vps", "rent-an-ai", "rent-a-marketer", "storage"]) { + expect(items.some((i) => i.id === id)).toBe(true); + } + }); +}); + +describe("live readers", () => { + it("reads the c0mpute nodes payload", () => { + expect(readNodes({ workers_online: 10, nodes: [{ class: "cpu" }, { class: "gpu:amd" }] })).toEqual({ nodesOnline: 10, gpuNodes: 1 }); + expect(readNodes({ nodes: [{ class: "cpu" }] })).toEqual({ nodesOnline: 1, gpuNodes: 0 }); + }); + + it("reads the experts payload", () => { + expect(readExperts({ count: 5, pricing: { all_experts_usd: 29, trial_days: 90 } })).toEqual({ + expertsCount: 5, + expertsBundleUsd: 29, + expertsTrialDays: 90, + }); + }); + + it("returns nulls, not guesses, for a missing or odd body", () => { + expect(readNodes(null)).toEqual({ nodesOnline: null, gpuNodes: null }); + expect(readExperts("nope")).toEqual({ expertsCount: null, expertsBundleUsd: null, expertsTrialDays: null }); + }); +});