Skip to content

Clarify devnet network ID in Agentic Payments x402 example#1591

Open
PrajwalGraj wants to merge 1 commit into
solana-foundation:mainfrom
PrajwalGraj:fix/agentic-payments-x402-network-id
Open

Clarify devnet network ID in Agentic Payments x402 example#1591
PrajwalGraj wants to merge 1 commit into
solana-foundation:mainfrom
PrajwalGraj:fix/agentic-payments-x402-network-id

Conversation

@PrajwalGraj

Copy link
Copy Markdown

Problem

The Express x402 middleware example on /docs/payments/agentic-payments uses
network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1" with no indication that this is the Solana Devnet CAIP-2 chain ID (confirmed against https://namespaces.chainagnostic.org/solana/caip2 and Coinbase's x402 docs).
Mainnet's ID is solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp. A developer copying this example to build a real paid endpoint could end up on either network without realizing the distinction, since neither value is explained.

Summary of Changes

Kept devnet as the example value but added comments clarifying which network it is and what the mainnet CAIP-2 equivalent would be, so the choice is explicit instead of silent.

Fixes #


Change classification (SDLC §2)

  • Critical — auth, secrets/key handling, fund movement, deploy/CI
    security gates, or anything that changes who can do what
  • Standard — production-facing, non-critical (features, API/route
    changes, dependency updates, monitoring/config)
  • Low — no security impact (docs, tests, dev tooling, content)

Security checklist

  • No secrets, tokens, or credentials in source, env files, or CI logs
    (use Doppler / NEXT_PUBLIC_* only for values safe to ship to the
    browser).
  • Input from users or external services is validated before use; no
    dangerouslySetInnerHTML / unsanitized HTML on untrusted input.
  • New or updated dependencies are justified below, and pnpm audit
    passes (no new High/Critical advisories).
  • Errors are handled explicitly — no silent failures on production paths.
  • For Critical changes: a trust-boundary / threat-model note is
    included below, and a second reviewer has been requested.

New dependencies: none

Threat-model note: n/a - Low-risk documentation-only change.

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

5 Skipped Deployments
Project Deployment Actions Updated (UTC)
solana-com Skipped Skipped Jun 20, 2026 7:06pm
solana-com-accelerate Skipped Skipped Jun 20, 2026 7:06pm
solana-com-breakpoint-2 Skipped Skipped Jun 20, 2026 7:06pm
solana-com-media Skipped Skipped Jun 20, 2026 7:06pm
templates Skipped Skipped Jun 20, 2026 7:06pm

Request Review

@vercel vercel Bot temporarily deployed to Preview – templates June 20, 2026 19:06 Inactive
@vercel vercel Bot temporarily deployed to Preview – solana-com-media June 20, 2026 19:06 Inactive
@vercel vercel Bot temporarily deployed to Preview – solana-com-breakpoint-2 June 20, 2026 19:06 Inactive
@vercel vercel Bot temporarily deployed to Preview – solana-com-accelerate June 20, 2026 19:06 Inactive
@vercel vercel Bot temporarily deployed to Preview – solana-com June 20, 2026 19:06 Inactive
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@PrajwalGraj is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds clarifying inline comments to the x402 Express middleware code example, making explicit that solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 is the Solana Devnet CAIP-2 chain ID and pointing to the Mainnet equivalent.

  • The paymentMiddleware network field now carries both a devnet label and a commented-out mainnet alternative, preventing silent network mismatches.
  • The x402ResourceServer.register() call receives only the devnet label; the mainnet hint added to the first occurrence is missing here.

Confidence Score: 5/5

Documentation-only change with no runtime impact; the CAIP-2 IDs are correct and the added comments accurately describe the network distinction.

Both network ID values are well-known Solana genesis hashes and match the CAIP-2 registry. The only gap is that the mainnet alternative comment added to the paymentMiddleware block was not mirrored on the x402ResourceServer.register() call, leaving the second snippet slightly less informative than the first.

No files require special attention beyond the minor comment inconsistency noted in the review.

Important Files Changed

Filename Overview
apps/docs/content/docs/en/payments/agentic-payments.mdx Adds inline comments to both CAIP-2 network ID occurrences clarifying Devnet vs. Mainnet; the mainnet alternative hint is present on the first occurrence but absent from the second (server-registration call).

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Client as AI Agent / Client
    participant Server as Express Server (x402 middleware)
    participant Facilitator as x402 Facilitator

    Client->>Server: GET /costly-data
    Server-->>Client: 402 Payment Required (CAIP-2 network, price, payTo)
    Note over Client,Server: network: solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 (Devnet)<br/>or solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp (Mainnet)
    Client->>Server: GET /costly-data + signed payment header
    Server->>Facilitator: Verify and settle payment onchain
    Facilitator-->>Server: Settlement confirmed
    Server-->>Client: 200 OK + costly data
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Client as AI Agent / Client
    participant Server as Express Server (x402 middleware)
    participant Facilitator as x402 Facilitator

    Client->>Server: GET /costly-data
    Server-->>Client: 402 Payment Required (CAIP-2 network, price, payTo)
    Note over Client,Server: network: solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 (Devnet)<br/>or solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp (Mainnet)
    Client->>Server: GET /costly-data + signed payment header
    Server->>Facilitator: Verify and settle payment onchain
    Facilitator-->>Server: Settlement confirmed
    Server-->>Client: 200 OK + costly data
Loading

Reviews (1): Last reviewed commit: "Clarify devnet network ID in Agentic Pay..." | Re-trigger Greptile

Comment on lines +82 to 83
"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", // Solana Devnet
new ExactSvmScheme()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The first occurrence of the devnet ID includes a mainnet alternative comment for discoverability, but the second occurrence in the x402ResourceServer.register() call omits it. A developer copying only the server-registration snippet would still encounter an unexplained ID.

Suggested change
"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", // Solana Devnet
new ExactSvmScheme()
"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", // Solana Devnet – use "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" for Mainnet (CAIP-2)
new ExactSvmScheme()

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant