How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.
The gateway authenticates AI clients, enforces per-project policy, admits payment, dispatches to the model provider, settles exact usage, and writes the ledger row every receipt is signed from. Five worker processes sit around it and do everything the request path must not: settle on-chain, credit top-ups, sign receipts, publish epoch roots, and expire ciphertext.The division is deliberate. Nothing in the request path holds a wallet key, broadcasts a transaction, or signs a receipt.
Service shape
A Rust service on axum.
GIWA_GATEWAY_BIND_ADDR is required and has no code default: a missing value is a startup configuration error. The shipped topologies bind port 8788 inside the container and publish it on loopback only.
The router has no browser-session or cookie dependency. The console is a separate Next.js app; the gateway boundary accepts API keys only.
In the default localnet the gateway is not published to the host at all.
For the route table, the 402 challenge shape, and the error taxonomy, see Gateway API.
Protocol adapters
Three native protocol adapters parse inbound requests into one canonical form and render provider responses back into the client’s protocol:
OpenAI Chat Completions: the API shape OpenRouter-style SDKs default to.
OpenAI Responses: the protocol Codex speaks.
Anthropic Messages, with token counting: the protocol Claude Code speaks.
Parsing yields the two numbers pricing depends on: an input-token upper bound (a canonical JSON byte bound that never underestimates what the provider will bill) and an output-token cap (requested output clamped to the catalog maximum). The estimator identity is a fixed string, canonical-json-byte-upper-bound-v1, so a later dispute can name the exact bound function rather than argue about intent.
Auth: per-project tok_ keys
Keys carry the tok_ prefix and are scoped to one project.
OpenAI routes accept exactly one Authorization: Bearer tok_… header. Anthropic routes accept exactly one bearer header or exactly one x-api-key: tok_… header, never both.
The gateway stores only a SHA-256 key hash plus an 8-character display suffix. Presented keys and idempotency keys are redacted at the execution boundary.
All admission, pricing, and ledger state is per-project.
Policy enforcement
Project policy is a durable admission boundary in PostgreSQL, not an application-side read/check/write convention:
Model allowlists: a policy revision can restrict which models a project may request. Denials are durable decisions, not best-effort checks.
Lifetime spend caps: a policy revision can cap cumulative project spend, in exact 4-decimal USD.
Policy revisions and admitted decisions are immutable. Every post-activation credit or x402 admission pins one decision, so a later policy edit cannot retroactively change what a request was admitted under.
Credit admission
The prepaid-credit path is a dark module with no HTTP route. A caller holds one per-project PostgreSQL session lease from admission through terminal settlement:
Admission authorizes a conservative maximum derived from the same body-aware bounds used for x402 quoting, at the active model price snapshot.
Dispatch runs the provider call under the lease’s idempotent authority.
Settlement charges exact-decimal actual usage against that admission and releases the remainder. A provider error before billable work charges exactly 0.0000.
The invariant is never-overdraw: settlement can never exceed the admission, the admission can never exceed policy, and one admission funds exactly one request. The lease connection is marked close-on-drop, so an error can never return a locked backend to the pool for another request.The other payment axis, x402, is documented separately in x402 Payments on GIWA.
The request ledger
Every request ends as exactly one row: status (ok, provider_error, or dispatch_unknown), token counts, and exact-decimal cost. A BEFORE UPDATE OR DELETE trigger raises giwa request ledger is append-only on any mutation, so history can never be rewritten in place. This table is the substrate every receipt is signed from.
GIWA_TEST_PROVIDER is a test-only fixture. With GIWA_TEST_PROVIDER=enabled (the local default) the gateway answers from a deterministic local provider fixture and a trivial echo catalog entry. The production-shaped topology sets it to disabled, and the gateway config rejects enabled in production. Nothing about the test provider is a claim about a real model provider.
The five workers
All five are bounded, single-authority processes. The polling loop is owned outside them, each accepts one bounded batch and exits, and none has a listener unless that listener is its whole job. A worker that cannot finish honestly exits nonzero, so a retry is visible rather than silent.
The x402 adapter: the payment boundary
The adapter is a separate process that owns everything x402-shaped, so the gateway never links an x402-rs crate. The framework version mismatch that forces the boundary is explained in x402 Payments on GIWA.
Surface: port 8090, exactly four endpoints (POST /v1/verify, POST /v1/settle, POST /v1/recover, GET /healthz), reached over a single bearer-authenticated local JSON interface. No x402-rs type crosses the seam.
Sole chain and facilitator client: it is the only component that talks to the facilitator, the chain RPC, and the settlement journal. It decodes the Permit2 payment header, re-derives the authorization nonce from the request binding, checks the full requirement and witness, calls the facilitator, and decodes the settle calldata word by word before accepting chain evidence.
Append-only journal: before its sole settlement side effect it writes a prepared record, so a lost response can never become a second broadcast, and recovery is read-only. The mechanics are in x402 Stage B.
The top-up reconciler: sends no transactions
The reconciler completes Stage A credit top-ups. Its design constraint is explicit: it is not a facilitator, not a middleware, not a wallet signer, and it sends no transaction. Its only write authority is a fenced set of ACL-granted database procedures.
Startup lockdown: it rejects every RPC endpoint except the fixed internal one, checks chain 91342, the fixed genesis timestamp and hash, the recorded tUSD address and runtime code hash, and that the asset has 6 decimals. No public RPC, testnet, or arbitrary database URL is accepted.
Credit condition: it credits only after observing the exact ERC-3009 evidence chain, which is one canonical AuthorizationUsed log, exactly matching calldata, a successful receipt with exactly one matching Transfer log, and finality confirmed by a second block-hash re-read. The full condition list is in x402 Stage A.
Failure honesty: if a dispatched top-up is absent after its authorization can no longer be used, the reconciler persists a deterministic final-negative observation before asking the database to abandon the intent. If the token says the nonce was consumed but logs are absent, it fails closed. It never resends, so recovery cannot duplicate a payment.
A fault-injection overlay kills and recreates this worker around a real settlement:
bun run local:stage-a:crash:e2e# pass marker: GIWA_LOCAL_STAGE_A_CRASH_E2E_OK
The attestation publisher: epoch Merkle roots
The publisher converts already verified, database-sealed receipt epochs into exactly one EAS transaction per epoch. This is what makes “1M or 100M requests, same on-chain cost” literal rather than rhetorical.
Narrow authority: it never reads raw tables, consuming ACL-fenced eligibility and publication procedures instead. It never accepts a non-local endpoint, and never signs a replacement transaction once signed raw bytes are durable.
Merkle construction: an epoch’s receipts are ordered canonically into a tree under the V1 merkle domain separators TOKSCALE_RECEIPT_LEAF_V1 and TOKSCALE_RECEIPT_NODE_V1. The transaction carries the epoch summary commitment, and individual receipt proofs verify against the anchored root in a browser. See Receipt Attestation.
Signing: one EIP-1559 raw transaction from a dedicated publisher key isolated from the deployer, facilitator, treasury, receipt issuer, and browser payer, so its transaction nonce is exclusively owned by this worker. Bounded batches of 25 by default, capped at 100, under short leases.
Epoch attestation is proven against the local EAS fixture only. Publishing the first Usage Root on public GIWA Sepolia is still ahead of us; see Live Evidence.
The receipt issuer: signs UsageReceiptV1
It claims a bounded batch of terminal ledger rows under a lease, signs one EIP-712 UsageReceiptV1 per row, and releases or marks failures honestly.
The signer key is a dedicated issuer key, separate from the published vector signer. Before any work it asserts the bound deployment network, so a misconfigured database stops the pass instead of signing into the wrong network.
It expires encrypted protocol-terminal payloads after their retention window, and has no listener, no chain client, no gateway credential, and no direct table authority. Its dedicated no-inherit database role can invoke exactly two expiry procedures, and it validates that its own database URL targets that role.
Each run is a bounded pass of 256 rows per call, at most 16 passes, then it exits. Keeping ciphertext expiry in a separate least-privilege poller means the encryption key material and the deletion authority never live in the gateway process.
Evidence
The gateway and all five workers are exercised by the sealed localnet harness, which waits on published database evidence rather than process-ready signals:
BUILDX_BUILDER=desktop-linux bun run local:e2e# pass marker: GIWA_LOCAL_E2E_OK
Next steps
For the route table, the 402 response shape, and the error taxonomy, see Gateway API.
For the receipt format the issuer signs, see UsageReceiptV1.
For where these processes sit in the system, see Gateway Overview.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Tokscale","colors":{"primary":"#75d3ff","light":"#75d3ff","dark":"#53d1f3"},"logo":{"light":"https://mintcdn.com/tokscale-giwa/PZ-qe7GbREC4q3PR/public/logo-dark.svg?fit=max\u0026auto=format\u0026n=PZ-qe7GbREC4q3PR\u0026q=85\u0026s=aad29ee9f990a8ce0caffd7df4263818","dark":"https://mintcdn.com/tokscale-giwa/PZ-qe7GbREC4q3PR/public/logo-light.svg?fit=max\u0026auto=format\u0026n=PZ-qe7GbREC4q3PR\u0026q=85\u0026s=c5c82dceb36449636111e13af946790f"},"favicon":"https://mintcdn.com/tokscale-giwa/hL37RrbSs-Mzq8Is/public/favicon.png?fit=max\u0026auto=format\u0026n=hL37RrbSs-Mzq8Is\u0026q=85\u0026s=e5267dabbe44c0195412260e069a4f92","navbar":{"links":[{"href":"https://giwa.io","label":"GIWA"},{"href":"https://github.com/junhoyeo/tokscale","label":"GitHub"}],"primary":{"type":"button","label":"Tokscale for GIWA","href":"https://giwa.tokscale.ai"}},"footer":{"socials":{"github":"https://github.com/junhoyeo/tokscale"}},"fonts":{"family":"Manrope"},"contextual":{"options":["copy","chatgpt","claude"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Explorer","icon":"magnifying-glass","href":"https://sepolia-explorer.giwa.io"},{"anchor":"Faucet","icon":"gas-pump","href":"https://faucet.giwa.io"},{"anchor":"GIWA Docs","icon":"book-open","href":"https://docs.giwa.io"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"tokscale-giwa","hasAudioNarration":false,"actualSubdomain":"tokscale-giwa","customDomains":["docs.giwa.tokscale.ai"],"gitSource":{"type":"github","owner":"junhoyeo","repo":"tokscale-giwa-docs","deployBranch":"master","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae95d32e1186677be475ffa:success","clientVersion":"0.0.4336","searchFilterCounts":[{"language":"default","tag":"Gateway","count":13},{"language":"default","tag":"Overview","count":11},{"language":"default","tag":"Usage Tracker","count":6},{"language":"default","tag":"Builder Passport","count":5},{"language":"default","tag":"Proof","count":4},{"language":"default","tag":"Identity","count":3},{"language":"default","tag":"Reference","count":3},{"language":"default","tag":"Runtime","count":3},{"language":"default","tag":"Payment","count":3},{"language":"default","tag":"Start here","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[]}
{"page":{"pagePath":"gateway/service","slug":"/gateway/service","pageMetadata":{"title":"The Gateway and Its Workers","description":"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.","href":"/gateway/service"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The gateway authenticates AI clients, enforces per-project policy, admits payment, dispatches to the model provider, settles exact usage, and writes the ledger row every receipt is signed from. Five worker processes sit around it and do everything the request path must not: settle on-chain, credit top-ups, sign receipts, publish epoch roots, and expire ciphertext.`}),`\n`,_jsx(_components.p,{children:`The division is deliberate. Nothing in the request path holds a wallet key, broadcasts a transaction, or signs a receipt.`}),`\n`,_jsx(Heading,{level:`2`,id:`service-shape`,children:`Service shape`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A Rust service on axum.`}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GIWA_GATEWAY_BIND_ADDR`}),` is required and has no code default: a missing value is a startup configuration error. The shipped topologies bind port 8788 inside the container and publish it on loopback only.`]}),`\n`,_jsx(_components.li,{children:`The router has no browser-session or cookie dependency. The console is a separate Next.js app; the gateway boundary accepts API keys only.`}),`\n`,_jsx(_components.li,{children:`In the default localnet the gateway is not published to the host at all.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`For the route table, the 402 challenge shape, and the error taxonomy, see `,_jsx(_components.a,{href:`/gateway/api`,children:`Gateway API`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`protocol-adapters`,children:`Protocol adapters`}),`\n`,_jsx(_components.p,{children:`Three native protocol adapters parse inbound requests into one canonical form and render provider responses back into the client’s protocol:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`OpenAI Chat Completions: the API shape OpenRouter-style SDKs default to.`}),`\n`,_jsx(_components.li,{children:`OpenAI Responses: the protocol Codex speaks.`}),`\n`,_jsx(_components.li,{children:`Anthropic Messages, with token counting: the protocol Claude Code speaks.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Parsing yields the two numbers pricing depends on: an input-token upper bound (a canonical JSON byte bound that never underestimates what the provider will bill) and an output-token cap (requested output clamped to the catalog maximum). The estimator identity is a fixed string, `,_jsx(_components.code,{children:`canonical-json-byte-upper-bound-v1`}),`, so a later dispute can name the exact bound function rather than argue about intent.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`auth-per-project-tok_-keys`,children:[`Auth: per-project `,_jsx(_components.code,{children:`tok_`}),` keys`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Keys carry the `,_jsx(_components.code,{children:`tok_`}),` prefix and are scoped to one project.`]}),`\n`,_jsxs(_components.li,{children:[`OpenAI routes accept exactly one `,_jsx(_components.code,{children:`Authorization: Bearer tok_…`}),` header. Anthropic routes accept exactly one bearer header or exactly one `,_jsx(_components.code,{children:`x-api-key: tok_…`}),` header, never both.`]}),`\n`,_jsx(_components.li,{children:`The gateway stores only a SHA-256 key hash plus an 8-character display suffix. Presented keys and idempotency keys are redacted at the execution boundary.`}),`\n`,_jsx(_components.li,{children:`All admission, pricing, and ledger state is per-project.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`policy-enforcement`,children:`Policy enforcement`}),`\n`,_jsx(_components.p,{children:`Project policy is a durable admission boundary in PostgreSQL, not an application-side read/check/write convention:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Model allowlists: a policy revision can restrict which models a project may request. Denials are durable decisions, not best-effort checks.`}),`\n`,_jsx(_components.li,{children:`Lifetime spend caps: a policy revision can cap cumulative project spend, in exact 4-decimal USD.`}),`\n`,_jsx(_components.li,{children:`Policy revisions and admitted decisions are immutable. Every post-activation credit or x402 admission pins one decision, so a later policy edit cannot retroactively change what a request was admitted under.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`credit-admission`,children:`Credit admission`}),`\n`,_jsx(_components.p,{children:`The prepaid-credit path is a dark module with no HTTP route. A caller holds one per-project PostgreSQL session lease from admission through terminal settlement:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Admission authorizes a conservative maximum derived from the same body-aware bounds used for x402 quoting, at the active model price snapshot.`}),`\n`,_jsx(_components.li,{children:`Dispatch runs the provider call under the lease’s idempotent authority.`}),`\n`,_jsxs(_components.li,{children:[`Settlement charges exact-decimal actual usage against that admission and releases the remainder. A provider error before billable work charges exactly `,_jsx(_components.code,{children:`0.0000`}),`.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The invariant is never-overdraw: settlement can never exceed the admission, the admission can never exceed policy, and one admission funds exactly one request. The lease connection is marked close-on-drop, so an error can never return a locked backend to the pool for another request.`}),`\n`,_jsxs(_components.p,{children:[`The other payment axis, x402, is documented separately in `,_jsx(_components.a,{href:`/gateway/x402-payments`,children:`x402 Payments on GIWA`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-request-ledger`,children:`The request ledger`}),`\n`,_jsxs(_components.p,{children:[`Every request ends as exactly one row: status (`,_jsx(_components.code,{children:`ok`}),`, `,_jsx(_components.code,{children:`provider_error`}),`, or `,_jsx(_components.code,{children:`dispatch_unknown`}),`), token counts, and exact-decimal cost. A `,_jsx(_components.code,{children:`BEFORE UPDATE OR DELETE`}),` trigger raises `,_jsx(_components.code,{children:`giwa request ledger is append-only`}),` on any mutation, so history can never be rewritten in place. This table is the substrate every receipt is signed from.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`GIWA_TEST_PROVIDER`}),` is a test-only fixture. With `,_jsx(_components.code,{children:`GIWA_TEST_PROVIDER=enabled`}),` (the local default) the gateway answers from a deterministic local provider fixture and a trivial `,_jsx(_components.code,{children:`echo`}),` catalog entry. The production-shaped topology sets it to `,_jsx(_components.code,{children:`disabled`}),`, and the gateway config rejects `,_jsx(_components.code,{children:`enabled`}),` in production. Nothing about the test provider is a claim about a real model provider.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`the-five-workers`,children:`The five workers`}),`\n`,_jsx(_components.p,{children:`All five are bounded, single-authority processes. The polling loop is owned outside them, each accepts one bounded batch and exits, and none has a listener unless that listener is its whole job. A worker that cannot finish honestly exits nonzero, so a retry is visible rather than silent.`}),`\n`,_jsx(Heading,{level:`3`,id:`the-x402-adapter-the-payment-boundary`,children:`The x402 adapter: the payment boundary`}),`\n`,_jsxs(_components.p,{children:[`The adapter is a separate process that owns everything x402-shaped, so the gateway never links an x402-rs crate. The framework version mismatch that forces the boundary is explained in `,_jsx(_components.a,{href:`/gateway/x402-payments`,children:`x402 Payments on GIWA`}),`.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Surface: port 8090, exactly four endpoints (`,_jsx(_components.code,{children:`POST /v1/verify`}),`, `,_jsx(_components.code,{children:`POST /v1/settle`}),`, `,_jsx(_components.code,{children:`POST /v1/recover`}),`, `,_jsx(_components.code,{children:`GET /healthz`}),`), reached over a single bearer-authenticated local JSON interface. No x402-rs type crosses the seam.`]}),`\n`,_jsx(_components.li,{children:`Sole chain and facilitator client: it is the only component that talks to the facilitator, the chain RPC, and the settlement journal. It decodes the Permit2 payment header, re-derives the authorization nonce from the request binding, checks the full requirement and witness, calls the facilitator, and decodes the settle calldata word by word before accepting chain evidence.`}),`\n`,_jsxs(_components.li,{children:[`Append-only journal: before its sole settlement side effect it writes a prepared record, so a lost response can never become a second broadcast, and recovery is read-only. The mechanics are in `,_jsx(_components.a,{href:`/gateway/x402-stage-b`,children:`x402 Stage B`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`the-top-up-reconciler-sends-no-transactions`,children:`The top-up reconciler: sends no transactions`}),`\n`,_jsx(_components.p,{children:`The reconciler completes Stage A credit top-ups. Its design constraint is explicit: it is not a facilitator, not a middleware, not a wallet signer, and it sends no transaction. Its only write authority is a fenced set of ACL-granted database procedures.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Startup lockdown: it rejects every RPC endpoint except the fixed internal one, checks chain 91342, the fixed genesis timestamp and hash, the recorded tUSD address and runtime code hash, and that the asset has 6 decimals. No public RPC, testnet, or arbitrary database URL is accepted.`}),`\n`,_jsxs(_components.li,{children:[`Credit condition: it credits only after observing the exact ERC-3009 evidence chain, which is one canonical `,_jsx(_components.code,{children:`AuthorizationUsed`}),` log, exactly matching calldata, a successful receipt with exactly one matching `,_jsx(_components.code,{children:`Transfer`}),` log, and finality confirmed by a second block-hash re-read. The full condition list is in `,_jsx(_components.a,{href:`/gateway/x402-stage-a`,children:`x402 Stage A`}),`.`]}),`\n`,_jsx(_components.li,{children:`Failure honesty: if a dispatched top-up is absent after its authorization can no longer be used, the reconciler persists a deterministic final-negative observation before asking the database to abandon the intent. If the token says the nonce was consumed but logs are absent, it fails closed. It never resends, so recovery cannot duplicate a payment.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`A fault-injection overlay kills and recreates this worker around a real settlement:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` local:stage-a:crash:e2e`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# pass marker: GIWA_LOCAL_STAGE_A_CRASH_E2E_OK`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`the-attestation-publisher-epoch-merkle-roots`,children:`The attestation publisher: epoch Merkle roots`}),`\n`,_jsx(_components.p,{children:`The publisher converts already verified, database-sealed receipt epochs into exactly one EAS transaction per epoch. This is what makes “1M or 100M requests, same on-chain cost” literal rather than rhetorical.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Narrow authority: it never reads raw tables, consuming ACL-fenced eligibility and publication procedures instead. It never accepts a non-local endpoint, and never signs a replacement transaction once signed raw bytes are durable.`}),`\n`,_jsxs(_components.li,{children:[`Merkle construction: an epoch’s receipts are ordered canonically into a tree under the V1 merkle domain separators `,_jsx(_components.code,{children:`TOKSCALE_RECEIPT_LEAF_V1`}),` and `,_jsx(_components.code,{children:`TOKSCALE_RECEIPT_NODE_V1`}),`. The transaction carries the epoch summary commitment, and individual receipt proofs verify against the anchored root in a browser. See `,_jsx(_components.a,{href:`/gateway/receipt-attestation`,children:`Receipt Attestation`}),`.`]}),`\n`,_jsx(_components.li,{children:`Signing: one EIP-1559 raw transaction from a dedicated publisher key isolated from the deployer, facilitator, treasury, receipt issuer, and browser payer, so its transaction nonce is exclusively owned by this worker. Bounded batches of 25 by default, capped at 100, under short leases.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Epoch attestation is proven against the local EAS fixture only. Publishing the first Usage Root on public GIWA Sepolia is still ahead of us; see `,_jsx(_components.a,{href:`/overview/live-evidence`,children:`Live Evidence`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`the-receipt-issuer-signs-usagereceiptv1`,children:`The receipt issuer: signs UsageReceiptV1`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`It claims a bounded batch of terminal ledger rows under a lease, signs one EIP-712 `,_jsx(_components.code,{children:`UsageReceiptV1`}),` per row, and releases or marks failures honestly.`]}),`\n`,_jsx(_components.li,{children:`The signer key is a dedicated issuer key, separate from the published vector signer. Before any work it asserts the bound deployment network, so a misconfigured database stops the pass instead of signing into the wrong network.`}),`\n`,_jsxs(_components.li,{children:[`Receipt format: `,_jsx(_components.a,{href:`/gateway/usage-receipt-v1`,children:`UsageReceiptV1`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`terminal-retention-ciphertext-expiry`,children:`Terminal retention: ciphertext expiry`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`It expires encrypted protocol-terminal payloads after their retention window, and has no listener, no chain client, no gateway credential, and no direct table authority. Its dedicated no-inherit database role can invoke exactly two expiry procedures, and it validates that its own database URL targets that role.`}),`\n`,_jsx(_components.li,{children:`Each run is a bounded pass of 256 rows per call, at most 16 passes, then it exits. Keeping ciphertext expiry in a separate least-privilege poller means the encryption key material and the deletion authority never live in the gateway process.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`evidence`,children:`Evidence`}),`\n`,_jsx(_components.p,{children:`The gateway and all five workers are exercised by the sealed localnet harness, which waits on published database evidence rather than process-ready signals:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`BUILDX_BUILDER`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`desktop-linux`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` local:e2e`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# pass marker: GIWA_LOCAL_E2E_OK`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next steps`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`For the route table, the 402 response shape, and the error taxonomy, see `,_jsx(_components.a,{href:`/gateway/api`,children:`Gateway API`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`For how a 402 becomes an on-chain settlement, see `,_jsx(_components.a,{href:`/gateway/x402-payments`,children:`x402 Payments on GIWA`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`For the receipt format the issuer signs, see `,_jsx(_components.a,{href:`/gateway/usage-receipt-v1`,children:`UsageReceiptV1`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`For where these processes sit in the system, see `,_jsx(_components.a,{href:`/gateway/overview`,children:`Gateway Overview`}),`.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"The Gateway and Its Workers","description":"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.","href":"/gateway/service"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Service shape","slug":"service-shape","depth":2,"children":[]},{"title":"Protocol adapters","slug":"protocol-adapters","depth":2,"children":[]},{"title":"Auth: per-project tok_ keys","slug":"auth-per-project-tok_-keys","depth":2,"children":[]},{"title":"Policy enforcement","slug":"policy-enforcement","depth":2,"children":[]},{"title":"Credit admission","slug":"credit-admission","depth":2,"children":[]},{"title":"The request ledger","slug":"the-request-ledger","depth":2,"children":[]},{"title":"The five workers","slug":"the-five-workers","depth":2,"children":[{"title":"The x402 adapter: the payment boundary","slug":"the-x402-adapter-the-payment-boundary","depth":3,"children":[]},{"title":"The top-up reconciler: sends no transactions","slug":"the-top-up-reconciler-sends-no-transactions","depth":3,"children":[]},{"title":"The attestation publisher: epoch Merkle roots","slug":"the-attestation-publisher-epoch-merkle-roots","depth":3,"children":[]},{"title":"The receipt issuer: signs UsageReceiptV1","slug":"the-receipt-issuer-signs-usagereceiptv1","depth":3,"children":[]},{"title":"Terminal retention: ciphertext expiry","slug":"terminal-retention-ciphertext-expiry","depth":3,"children":[]}]},{"title":"Evidence","slug":"evidence","depth":2,"children":[]},{"title":"Next steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"tokscale-giwa","siteName":"Tokscale","title":"The Gateway and Its Workers - Tokscale","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-26T14:21:07.330Z","originalFileLocation":"gateway/service.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Tokscale\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"The Gateway and Its Workers - Tokscale\">\u003cmeta data-mint-head property=\"og:description\" content=\"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Tokscale\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.giwa.tokscale.ai/gateway/service\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://tokscale-giwa.mintlify.site/_mintlify/api/og/v2?division=Runtime\u0026amp;title=The+Gateway+and+Its+Workers\u0026amp;description=How+the+gateway+admits+and+prices+a+request%2C+and+what+each+of+the+five+bounded+worker+processes+around+it+is+allowed+to+do.\u0026amp;theme=7304c06c5801f501973c9c88\u0026amp;signature=9d5f23b677c3b38cb03a875733306075a390403aee0e3aba40123c27379d71e4\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"The Gateway and Its Workers - Tokscale\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://tokscale-giwa.mintlify.site/_mintlify/api/og/v2?division=Runtime\u0026amp;title=The+Gateway+and+Its+Workers\u0026amp;description=How+the+gateway+admits+and+prices+a+request%2C+and+what+each+of+the+five+bounded+worker+processes+around+it+is+allowed+to+do.\u0026amp;theme=7304c06c5801f501973c9c88\u0026amp;signature=9d5f23b677c3b38cb03a875733306075a390403aee0e3aba40123c27379d71e4\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/tokscale-giwa/Qj55nM6I2XppdOWO/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Tokscale\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#75d3ff\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.giwa.tokscale.ai/gateway/service\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/gateway/service.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.giwa.tokscale.ai/#organization\",\"name\":\"Tokscale\",\"url\":\"https://docs.giwa.tokscale.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/tokscale-giwa/PZ-qe7GbREC4q3PR/public/logo-dark.svg?fit=max\u0026auto=format\u0026n=PZ-qe7GbREC4q3PR\u0026q=85\u0026s=aad29ee9f990a8ce0caffd7df4263818\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.giwa.tokscale.ai#website\",\"name\":\"Tokscale\",\"url\":\"https://docs.giwa.tokscale.ai\",\"publisher\":{\"@id\":\"https://docs.giwa.tokscale.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.giwa.tokscale.ai/gateway/service#webpage\",\"url\":\"https://docs.giwa.tokscale.ai/gateway/service\",\"name\":\"The Gateway and Its Workers\",\"description\":\"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.\",\"dateModified\":\"2026-07-26T14:21:07.330Z\",\"isPartOf\":{\"@id\":\"https://docs.giwa.tokscale.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.giwa.tokscale.ai/gateway/service#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.giwa.tokscale.ai/gateway/service#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tokscale\",\"item\":\"https://docs.giwa.tokscale.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Gateway and Its Workers\",\"item\":\"https://docs.giwa.tokscale.ai/gateway/service\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.giwa.tokscale.ai/gateway/service#article\",\"headline\":\"The Gateway and Its Workers\",\"name\":\"The Gateway and Its Workers\",\"description\":\"How the gateway admits and prices a request, and what each of the five bounded worker processes around it is allowed to do.\",\"url\":\"https://docs.giwa.tokscale.ai/gateway/service\",\"mainEntityOfPage\":{\"@id\":\"https://docs.giwa.tokscale.ai/gateway/service#webpage\"},\"dateModified\":\"2026-07-26T14:21:07.330Z\",\"publisher\":{\"@id\":\"https://docs.giwa.tokscale.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.giwa.tokscale.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Tokscale\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Tokscale\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/gateway/service.md","siteName":"Tokscale","nav":{"global":{"anchors":[{"anchor":"Explorer","icon":"magnifying-glass","href":"https://sepolia-explorer.giwa.io"},{"anchor":"Faucet","icon":"gas-pump","href":"https://faucet.giwa.io"},{"anchor":"GIWA Docs","icon":"book-open","href":"https://docs.giwa.io"}]},"tabs":[{"tab":"Overview","icon":"compass","pages":[{"title":"Overview","href":""}]},{"tab":"Gateway","icon":"server","groups":[{"group":"Overview","icon":"compass","pages":[{"title":"Gateway Overview","href":"/gateway/overview"},{"title":"Client Integration","href":"/gateway/client-integration"}]},{"group":"Payment","icon":"credit-card","pages":[{"title":"x402 Payments on GIWA","href":"/gateway/x402-payments"},{"title":"x402 Stage A: Credit Top-Up","href":"/gateway/x402-stage-a"},{"title":"x402 Stage B: Per-Request Settlement","href":"/gateway/x402-stage-b"}]},{"group":"Proof","icon":"shield-check","pages":[{"title":"UsageReceiptV1","href":"/gateway/usage-receipt-v1"},{"title":"Receipt Attestation (EAS)","description":"Learn the EAS schema behind a Usage Root, how salting keeps epoch totals private, and how the publisher avoids double-attesting.","href":"/gateway/receipt-attestation"}]},{"group":"Runtime","icon":"sitemap","pages":[{"title":"The Gateway and Its Workers","href":"/gateway/service"},{"title":"Contracts","description":"The test payment asset, why a shared chain ID can never authorize a deployment, and how upstream bytecode is pinned before it ships.","href":"/gateway/contracts"},{"title":"Network Separation: Localnet vs Sepolia","href":"/gateway/network-separation"}]},{"group":"Reference","icon":"book-open","pages":[{"title":"Gateway API","href":"/gateway/api"},{"title":"The Public Chain","href":"/gateway/public-chain"},{"title":"Verification Log","href":"/gateway/verification-log"}]}]},{"tab":"Builder Passport","icon":"id-card","pages":[{"title":"Builder Passport","href":"/builder-passport/overview"}]},{"tab":"Usage Tracker","icon":"chart-simple","pages":[{"title":"Usage Tracker","href":"/usage-tracker/quickstart"}]}]},"basePath":"","title":"The Gateway and Its Workers - Tokscale","deploymentId":"dpl_9bQLTw9nc2h9csDGYcKwWenPcQWn","buildId":"dpl_9bQLTw9nc2h9csDGYcKwWenPcQWn","dynamics":[],"chunks":[]}