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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(x402): stop same-priced payments from colliding into one Solana signature
nirholas1e82ad270e3a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 901ade2e8..e3e794c98 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,12 +6,14 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-07-17+- **AR Studio** (`/ar/studio`) — A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.- **Image to 3D — Turn a Photo into a 3D Model** (`/image-to-3d`) — Upload a photo (or up to 4 angles) and get a downloadable textured 3D model (GLB). The Forge's photo lane, opened directly — for objects and props; for faces, use Selfie to Avatar.- **Avatars you generate now come out truly animation-ready** — We rebuilt the auto-rigging engine that turns a generated 3D character into a living avatar. Rigging now finishes in seconds instead of stalling for 20 minutes, produces a full standard skeleton with fingers that our entire animation library (walk, wave, dance, emotes) can drive immediately, keeps the model's original textures perfectly intact, and adds the 52 facial expression shapes used for emotions and lip-sync. Every piece of the new pipeline is MIT-licensed open source, so it works for everyone, everywhere. (`/forge`) `[feature, improvement, fix]`- **Community feed hover previews no longer blend into the photo underneath** — Hovering a card in the Fresh from the Forge strip spins the actual 3D model in place. The spinning model used to render on a nearly transparent background, so it visually collided with the card's photo thumbnail and looked broken, with a stray browser tooltip on top. The preview now draws on a solid backdrop, the redundant tooltip is gone, image-to-3D cards are labeled with their engine name (Hunyuan3D) instead of an internal id, and every card can now be opened from the keyboard. (`/forge`) `[fix, improvement]`- **Creator profile pages work again, plus a site-wide reliability sweep** — A full automated sweep of every page and API endpoint on the site caught a bug that replaced creator profile pages (three.ws/u/yourname) with an error message. That is fixed. The sweep also repaired the login captcha for rate-limited sign-ins, fixed dead links in the dashboard and two blog posts, and added two dozen previously unlisted pages to the site index so search engines and the sitemap can find them. The audit now runs with deeper checks (blank-page detection, visible error detection, and link crawling) so regressions like these get caught before anyone hits them. (`/changelog`) `[fix, improvement]`- **Image to 3D gets its own front door** — Turning a photo into a 3D model has worked in the Forge for a while, but it hid behind a page titled Text to 3D, and the only photo surface people could find was Selfie to Avatar. There is now a dedicated Image to 3D page (three.ws/image-to-3d) that opens the Forge with the photo tab already selected, an Image to 3D link in the main navigation and footers, and clear pointers between the selfie tools (for making an avatar of you) and Image to 3D (for making a model of any object). The Forge and its feature page are also retitled to say what they actually do: text and images. (`/image-to-3d`) `[improvement]`- **Image-to-3D leaps forward: true PBR materials on a flagship GPU** — The Forge realism engine (Hunyuan3D 2.1) is now live on a new flagship-class GPU (NVIDIA RTX PRO 6000 Blackwell, 96 GB). High-tier image-to-3D generations now come out with true physically-based materials: real metal, roughness, and color maps that catch light like photographed objects instead of flat plastic. The new hardware is also dramatically faster; the full shape-plus-texture pass finished in about a minute in our live verification, where the previous GPU class could not even load the model. Alongside it, every 3D generation service is healthy again and all of yesterday’s reliability fixes are fully rolled out across the fleet. (`/forge`) `[feature, improvement, infra]`+- **Paid API calls no longer fail when two agents buy the same-priced service at once** — Since July 9, a few hundred paid x402 calls a day were answered with a 502 after the buyer's USDC transfer was rejected on Solana. Two payments for the same price, signed in the same few-second window, could compile to byte-identical transactions, and only the first one could ever land. Every payment now carries its own tiny priority-fee fingerprint, so simultaneous same-priced purchases each settle cleanly, and settlement errors now name their real cause in our logs so future issues surface faster. `[fix]`- **Prompt-to-avatar and selfie-to-avatar generation fixed end to end** — Two bugs had been failing every avatar reconstruction job. First, the platform's own 3D worker delivers finished models from our Cloud Storage bucket, but a security allowlist introduced to keep forged URLs out only recognized third-party hosts, so even successful builds were marked failed at the last step. The allowlist now recognizes our own storage bucket (and only ours). Second, avatars generated from a text prompt use a full-body reference image, whose small face the face detector often missed, ending the job with 'no face detected'. The engine now finds the face with a wide-range detector, zooms in, and reads the facial detail from the zoomed view, so full-body renders and distant selfies both work. Describing a person in your prompt still matters: a subject with no human face gets a clear message asking you to reword. (`/create/prompt`) `[fix]`- **The agent-to-agent payment economy runs far cheaper and now cycles hundreds of distinct payers** — Two improvements to the closed-loop x402 agent economy that dogfoods every paid endpoint on the platform. First, a fix: a background wallet-consolidation job was quietly closing the ring's payment account after every settlement, forcing the next one to recreate it and pay account rent each time. That single bug had pushed the real fee cost to roughly a hundred times where it should be. With it fixed and single-signature settlement turned on, each settlement is back to the network floor of a few thousandths of a cent, and the ring's working balance stays in the loop instead of leaking away. Second, a new capability: the ring can now cycle payments through a reusable pool of hundreds to a thousand distinct wallets instead of one, so the economy reads as many participants rather than a single account, with no extra cost per payment. The pool is off until funded and activated, and every wallet in it stays clearly labeled internal dogfooding, not organic demand. (`/admin/ring`) `[fix, improvement, infra]`- **The Money Pulse is beating again** — The live money feed went quiet after the July 7 infrastructure move: the switch that powers the autonomous agent activity loop did not survive the migration, so agents stopped tipping, trading, paying and launching. The switch is back on and the feed is live again, with real on-chain tips, trades, payments and coin launches flowing within minutes of the fix. The production runbook now documents the switch so a future migration cannot silently drop it. (`/pulse`) `[fix, infra]`diff --git a/api/_lib/x402/pay.js b/api/_lib/x402/pay.jsindex 963622b24..ac7f41ee4 100644--- a/api/_lib/x402/pay.js+++ b/api/_lib/x402/pay.js@@ -72,6 +72,22 @@ export function ringPriorityMicrolamports(nonce = 0) {return 5 + (Number(nonce) % 997);}+// Per-process nonce for payX402 callers that do not manage batch positions+// themselves. Two same-amount payments to the same payTo, signed against one+// shared tick blockhash with the same priority fee, compile to byte-identical+// transactions with the SAME signature: the first broadcast lands, every later+// one dies at settle preflight as already-processed (the RPC surfaces it as a+// bare "Transaction simulation failed", seen as the settle_failed 502 wave).+// A distinct default nonce per payment makes each fee signature unique within+// a blockhash window. Starts at 499 so it stays clear of the small explicit+// 0..N indices batch pipelines pass; wraps inside the same 997-slot cycle the+// fee-floor tests already prove stays under the fee ceiling.+let _autoNonce = 499;+export function nextAutoNonce() {+ _autoNonce = (_autoNonce + 1) % 997;+ return _autoNonce;+}+// Self-pay is the OPERATIVE DEFAULT for ring-internal payments: the buyer pays// its own fee → 1 signature = 5,000 lamports, half the 2-signature sponsored// base, and the facilitator broadcasts without co-signing. An explicit@@ -198,8 +214,9 @@ export function buildPaymentTx({ accept, buyer, blockhash, mintInfo, receiverAta// identical-amount payments (same payer/payTo/mint) against the one shared// blockhash produces a DISTINCT signature per call. Two byte-identical// transfers compile to the same message → same signature → the second is- // rejected as already-processed. Single-call/inline callers leave nonce at 0- // and pay the unchanged baseline of 5 µlamports.+ // rejected as already-processed. Callers that don't manage batch positions+ // get a distinct per-process nonce from payX402 (nextAutoNonce), so cross-+ // pipeline same-amount payments inside one blockhash window never collide.const ixs = [ComputeBudgetProgram.setComputeUnitLimit({ units: RING_CU_LIMIT }),ComputeBudgetProgram.setComputeUnitPrice({ microLamports: ringPriorityMicrolamports(nonce) }),@@ -252,7 +269,10 @@ export async function payX402({buyer, conn, blockhash, mintInfo,remainingCap = Infinity,userAgent = 'threews-x402-autonomous/1.0',- nonce = 0,+ // Batch pipelines pass their own position; everyone else gets a distinct+ // per-process nonce below so same-amount payments sharing a tick blockhash+ // never compile to the same signature (see nextAutoNonce).+ nonce = null,// Self-pay: buyer is its own fee payer → 1 signature (5000 lamports) instead// of 2. Half the base fee, no sponsor co-sign. The ring's operative default;// only an explicit X402_RING_SELF_PAY=false selects sponsor mode. See@@ -267,6 +287,15 @@ export async function payX402({// treated as an abort (fail-closed), never a crash.onAccept = null,}) {+ if (nonce == null) {+ nonce = nextAutoNonce();+ // Sponsor mode pays 2 signatures = 10,000 lamports base, exactly the+ // default fee ceiling, so only priority perturbations that floor to zero+ // extra lamports fit under the guard below: (5 + n) µlamports × 60k CU+ // stays below 1 lamport only for n ≤ 11. Twelve distinct fee slots still+ // keep a tick's same-amount payments from compiling to one signature.+ if (!selfPay) nonce %= 12;+ }const reqInit = {method,headers: { 'content-type': 'application/json', 'user-agent': userAgent },diff --git a/api/_lib/x402/self-facilitator.js b/api/_lib/x402/self-facilitator.jsindex a0e513157..f2bcf3752 100644--- a/api/_lib/x402/self-facilitator.js+++ b/api/_lib/x402/self-facilitator.js@@ -457,10 +457,10 @@ export async function settleRingPayment({ paymentPayload, requirement, conn, fee});} catch (err) {const m = String(err?.message || err);+ const sig = tx.signatures?.[0] ? bs58.encode(tx.signatures[0]) : null;// A resent settle (idempotent replay) hits "already processed" — the prior// broadcast landed. Recover the signature from the tx and report success.if (/already been processed|AlreadyProcessed|already processed/i.test(m)) {- const sig = tx.signatures?.[0] ? bs58.encode(tx.signatures[0]) : null;if (sig) {return {success: true,@@ -472,7 +472,24 @@ export async function settleRingPayment({ paymentPayload, requirement, conn, fee};}}- return { success: false, reason: `broadcast_failed:${m}`.slice(0, 300) };+ // web3.js drops the structured preflight cause (res.error.data.err), so on+ // some RPCs a duplicate-signature rejection arrives as a bare "Transaction+ // simulation failed" with empty logs. One status-cache probe names it: if+ // this exact signature already landed, the failure is already-processed,+ // not a simulation fault. Deliberately still a failure (fail closed) — the+ // landed transfer belongs to the payment that broadcast it first; only the+ // message-matched branch above, a true idempotent resend, recovers success.+ let alreadyLanded = false;+ if (sig && /simulation failed/i.test(m)) {+ try {+ const st = (await connection.getSignatureStatuses([sig]))?.value?.[0];+ alreadyLanded = st != null && st.err == null;+ } catch { /* probe is best-effort; the generic reason below stands */ }+ }+ const detail = alreadyLanded+ ? `already_processed:${sig}`+ : m.replace(/\s+/g, ' ').trim();+ return { success: false, reason: `broadcast_failed:${detail}`.slice(0, 300) };}const conf = await confirmSignature(connection, signature);diff --git a/data/changelog.json b/data/changelog.jsonindex 13b8f85c0..e069fb4c8 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -14156,6 +14156,14 @@"improvement"],"link": "/forge"+ },+ {+ "date": "2026-07-17",+ "title": "Paid API calls no longer fail when two agents buy the same-priced service at once",+ "summary": "Since July 9, a few hundred paid x402 calls a day were answered with a 502 after the buyer's USDC transfer was rejected on Solana. Two payments for the same price, signed in the same few-second window, could compile to byte-identical transactions, and only the first one could ever land. Every payment now carries its own tiny priority-fee fingerprint, so simultaneous same-priced purchases each settle cleanly, and settlement errors now name their real cause in our logs so future issues surface faster.",+ "tags": [+ "fix"+ ]}]}diff --git a/public/changelog.json b/public/changelog.jsonindex 577119ca1..443095d86 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,11 +1,21 @@{- "generated_at": "2026-07-17T09:07:44.555Z",+ "generated_at": "2026-07-17T09:14:59.862Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},"entries": [+ {+ "date": "2026-07-17",+ "type": "launch",+ "title": "AR Studio",+ "summary": "A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.",+ "link": "/ar/studio",+ "tags": [+ "launch"+ ]+ },{"date": "2026-07-17","type": "launch",@@ -72,6 +82,16 @@"infra"]},+ {+ "date": "2026-07-17",+ "type": "update",+ "title": "Paid API calls no longer fail when two agents buy the same-priced service at once",+ "summary": "Since July 9, a few hundred paid x402 calls a day were answered with a 502 after the buyer's USDC transfer was rejected on Solana. Two payments for the same price, signed in the same few-second window, could compile to byte-identical transactions, and only the first one could ever land. Every payment now carries its own tiny priority-fee fingerprint, so simultaneous same-priced purchases each settle cleanly, and settlement errors now name their real cause in our logs so future issues surface faster.",+ "link": null,+ "tags": [+ "fix"+ ]+ },{"date": "2026-07-17","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 8aa525126..b2df2e7b2 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -6,6 +6,14 @@<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/><description>What's new on three.ws — features, improvements, and releases, newest first.</description><language>en</language>+ <item>+ <title>AR Studio</title>+ <link>https://three.ws/ar/studio</link>+ <guid isPermaLink="false">2026-07-17:AR Studio</guid>+ <pubDate>Fri, 17 Jul 2026 12:00:00 GMT</pubDate>+ <category>launch</category>+ <description>A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.</description>+ </item><item><title>Image to 3D — Turn a Photo into a 3D Model</title><link>https://three.ws/image-to-3d</link>@@ -54,6 +62,14 @@<category>feature</category><description>The Forge realism engine (Hunyuan3D 2.1) is now live on a new flagship-class GPU (NVIDIA RTX PRO 6000 Blackwell, 96 GB). High-tier image-to-3D generations now come out with true physically-based materials: real metal, roughness, and color maps that catch light like photographed objects instead of flat plastic. The new hardware is also dramatically faster; the full shape-plus-texture pass finished in about a minute in our live verification, where the previous GPU class could not even load the model. Alongside it, every 3D generation service is healthy again and all of yesterday’s reliability fixes are fully rolled out across the fleet.</description></item>+ <item>+ <title>Paid API calls no longer fail when two agents buy the same-priced service at once</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-17:Paid API calls no longer fail when two agents buy the same-priced service at once</guid>+ <pubDate>Fri, 17 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Since July 9, a few hundred paid x402 calls a day were answered with a 502 after the buyer's USDC transfer was rejected on Solana. Two payments for the same price, signed in the same few-second window, could compile to byte-identical transactions, and only the first one could ever land. Every payment now carries its own tiny priority-fee fingerprint, so simultaneous same-priced purchases each settle cleanly, and settlement errors now name their real cause in our logs so future issues surface faster.</description>+ </item><item><title>Prompt-to-avatar and selfie-to-avatar generation fixed end to end</title><link>https://three.ws/create/prompt</link>diff --git a/tests/x402-ring-fee-floor.test.js b/tests/x402-ring-fee-floor.test.jsindex 1f5d7865f..53cd38ba3 100644--- a/tests/x402-ring-fee-floor.test.js+++ b/tests/x402-ring-fee-floor.test.js@@ -70,6 +70,49 @@ describe('fee-floor regression guard — builders never exceed the ceiling', ()});});+describe('distinct-signature guard — same-amount payments must never collide', () => {+ // Two payments with the same payer/payTo/mint/amount, one shared blockhash+ // and the same nonce compile to byte-identical transactions → the SAME+ // signature → every one after the first dies at settle preflight as+ // already-processed. payX402 defaults callers onto nextAutoNonce() so this+ // can only happen when a batch pipeline reuses an explicit position.+ const buyer = Keypair.generate();+ const treasury = Keypair.generate();+ const blockhash = '11111111111111111111111111111111';+ const accept = {+ network: 'solana:mainnet',+ asset: USDC,+ payTo: treasury.publicKey.toBase58(),+ amount: '10000', // $0.01 — the ring's most common price, the collision class+ extra: {},+ };+ const build = (nonce) => buildPaymentTx({+ accept, buyer, blockhash,+ mintInfo: { decimals: 6 }, receiverAtaExists: true, nonce, selfPay: true,+ });++ it('equal nonces compile to byte-identical txs (the collision the guard exists for)', () => {+ expect(build(7)).toBe(build(7));+ });++ it('distinct nonces produce distinct signatures', () => {+ const a = VersionedTransaction.deserialize(Buffer.from(build(1), 'base64'));+ const b = VersionedTransaction.deserialize(Buffer.from(build(2), 'base64'));+ expect(Buffer.from(a.signatures[0]).equals(Buffer.from(b.signatures[0]))).toBe(false);+ });++ it('nextAutoNonce never repeats within a blockhash-sized window and stays in the fee-tested range', () => {+ const seen = new Set();+ for (let i = 0; i < 200; i++) {+ const n = pay.nextAutoNonce();+ expect(n).toBeGreaterThanOrEqual(0);+ expect(n).toBeLessThan(997);+ seen.add(n);+ }+ expect(seen.size).toBe(200);+ });+});+describe('self-pay default — operative for the ring', () => {it('defaults to true when X402_RING_SELF_PAY is unset', () => {delete process.env.X402_RING_SELF_PAY;