Skip to content

feat: add morph rails doc#137

Merged
DannyFi merged 2 commits intomorph-l2:mainfrom
SpectreMercury:feat-add-morph-rails
Mar 23, 2026
Merged

feat: add morph rails doc#137
DannyFi merged 2 commits intomorph-l2:mainfrom
SpectreMercury:feat-add-morph-rails

Conversation

@SpectreMercury
Copy link
Contributor

@SpectreMercury SpectreMercury commented Mar 20, 2026

Summary by CodeRabbit

  • Documentation
    • Added comprehensive Morph Rails docs: overview, architecture, user categories, and end-to-end flows
    • Documented agentic payment features: HTTP 402 x402 flow, MCP tool integration, and Morph Skill Hub for agent skills
    • Documented CLI interactions, AltFee gas-abstraction, Reference Key reconciliation, and private-transaction privacy options
    • Added site navigation entry for quick access to Morph Rails content

@SpectreMercury SpectreMercury requested a review from a team as a code owner March 20, 2026 06:31
@SpectreMercury SpectreMercury requested review from twcctop and removed request for a team March 20, 2026 06:31
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 372b9eec-fa10-459f-a712-af59426dee09

📥 Commits

Reviewing files that changed from the base of the PR and between e92ff9e and 2a8102d.

📒 Files selected for processing (1)
  • docs/morph-rails/infra-solutions/1-altfee.md
✅ Files skipped from review due to trivial changes (1)
  • docs/morph-rails/infra-solutions/1-altfee.md

📝 Walkthrough

Walkthrough

Adds a new Morph Rails documentation section with nine pages covering architecture, Infra (AltFee, Reference Key), Middleware (Private Transactions), and Agentic Payment (x402, Skills, CLI, MCP), and updates Docusaurus navbar and sidebar to expose the new content.

Changes

Cohort / File(s) Summary
Overview
docs/morph-rails/0-overview.md
New high-level introduction: Morph Rails purpose, four-layer architecture, component map, and two end-to-end payment flows (merchant and AI agent).
Agentic Payment
docs/morph-rails/agentic-payment/0-overview.md, docs/morph-rails/agentic-payment/1-x402-facilitator.md, docs/morph-rails/agentic-payment/2-morph-skill.md, docs/morph-rails/agentic-payment/3-morph-rails-cli.md, docs/morph-rails/agentic-payment/4-mcp.md
Adds AI-native payment docs: x402 HTTP 402 facilitator flow and headers, Morph Skill Hub spec and package layout, CLI commands and JSON-first behavior, and MCP tool advertisement/payload examples.
Infrastructure Solutions
docs/morph-rails/infra-solutions/1-altfee.md, docs/morph-rails/infra-solutions/2-reference-key.md
Documents AltFee gas-abstraction flow (ERC‑20 gas payment) and Reference Key reconciliation workflow and API usage.
Middleware Service
docs/morph-rails/middleware-service/1-private-transactions.md
Describes private transactions, selective disclosure, privacy levels, and compatibility with Reference Keys.
Docusaurus config & sidebars
docusaurus.config.js, sidebars.js
Adds a Morph Rails navbar docSidebar entry and a new exported MorphRailsSidebar organizing the new docs into Start Here / Infra Solutions / Middleware Service / Agentic Payment.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Server as Resource Server
  participant Facilitator
  participant Sequencer
  participant Chain as On-chain

  Client->>Server: GET /paid-resource
  Server-->>Client: 402 + X-Payment- headers (network, addr, amount, token)
  Client->>Facilitator: Construct & sign x402 payment (includes Reference Key)
  Facilitator->>Sequencer: Submit AltFee Tx (token-paid gas)
  Sequencer->>Chain: Execute tx, emit settlement proof
  Sequencer-->>Facilitator: Settlement proof / tx receipt
  Client->>Server: Retry with X-Payment-Proof header
  Server->>Facilitator: Verify proof / validate receipt
  Facilitator-->>Server: Validation result
  Server-->>Client: 200 OK (resource)
Loading
sequenceDiagram
  participant MerchantApp
  participant CLI/Agent
  participant MorphAPI
  participant Sequencer
  participant Chain

  MerchantApp->>CLI/Agent: Create payment request (with Reference Key)
  CLI/Agent->>MorphAPI: Submit signed tx (AltFee token selected)
  MorphAPI->>Sequencer: Relay AltFee Tx
  Sequencer->>Chain: Execute & confirm
  Chain-->>Sequencer: Confirmation
  Sequencer-->>MorphAPI: Tx receipt + Reference Key mapping
  MorphAPI-->>MerchantApp: Reconciliation data / transaction history
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • New doc style #109: Modifies Docusaurus sidebar/config similar to this PR—likely overlaps in navbar/sidebar exports.
  • Seo & AltFee #129: Adds/updates AltFee documentation and touches site config; related to the AltFee docs added here.
  • Feat jssdk doc #121: Updates Docusaurus configuration and sidebars; intersects with exported sidebar changes in this PR.

Suggested reviewers

  • twcctop
  • panos-xyz

Poem

🐇 I nibble docs with nimble paws,
New rails and x402 cause applause,
AltFee coins and skills in store,
CLI hops, agents ask for more,
I stamp my paw — docs ready — pause! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding comprehensive Morph Rails documentation across multiple new files and sidebar configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (3)
docs/morph-rails/infra-solutions/2-reference-key.md (1)

8-10: Avoid hard-coded launch month in availability notice.

Using a fixed month/year here is likely to age quickly. Prefer timeline wording that remains accurate if launch scheduling changes.

Suggested wording update
-:::info
-Reference Key will be available after the mainnet launch in April 2026.
-:::
+:::info
+Reference Key will be available after mainnet launch.
+:::
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/morph-rails/infra-solutions/2-reference-key.md` around lines 8 - 10,
Replace the hard-coded availability sentence "Reference Key will be available
after the mainnet launch in April 2026." with a timeline-neutral phrase (e.g.,
"Reference Key will be available after mainnet launch" or "Reference Key will be
available following mainnet launch") so the note remains accurate if launch
timing changes; update the content in
docs/morph-rails/infra-solutions/2-reference-key.md by locating the exact string
and substituting the neutral wording while preserving the surrounding :::info
block formatting.
docs/morph-rails/agentic-payment/3-morph-rails-cli.md (1)

21-23: Clarify key/material handling for a “stateless” CLI.

Line 57 says the CLI is stateless, but Line 21 introduces wallet creation. Add one sentence clarifying where keys are stored (or that an external signer is required) so automation users don’t assume unsafe defaults.

Suggested doc tweak
 - **Stateless** — No persistent sessions. Every command is self-contained. Agents don't need to manage connection state.
+ - **Stateless** — No persistent sessions. Every command is self-contained. Agents don't need to manage connection state.
+   Wallet key material is never kept in process memory between commands; use secure local keystore or external signer/HSM.

Also applies to: 57-59

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/morph-rails/agentic-payment/3-morph-rails-cli.md` around lines 21 - 23,
Clarify the "stateless" claim by updating the docs around the wallet commands
(morph-cli wallet create and morph-cli wallet balance) and the "stateless"
statement (lines referencing 57-59) to add one concise sentence that specifies
where private keys are kept or that the CLI requires an external signer/keystore
for key management; explicitly state that the CLI does not persist keys by
default (or conversely where it stores them) so automation users won't assume
unsafe defaults and know to supply an external signer or secure key storage.
docs/morph-rails/agentic-payment/1-x402-facilitator.md (1)

16-20: Consider migrating to non-prefixed header names per RFC 6648.

RFC 6648 deprecates the X- prefix for new HTTP headers, as it causes namespace collisions when experimental headers become standardized. Use descriptive names without the prefix (Payment-Network, Payment-Address, Payment-Amount, Payment-Token) and maintain X- variants only for backward compatibility if needed. Consider registering new headers in the IANA HTTP Field Name Registry.

Also applies to: 66-69, 73

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/morph-rails/agentic-payment/1-x402-facilitator.md` around lines 16 - 20,
The HTTP headers use deprecated X- prefixes; change the header names from
X-Payment-Network, X-Payment-Address, X-Payment-Amount, and X-Payment-Token to
non-prefixed names Payment-Network, Payment-Address, Payment-Amount, and
Payment-Token (keep X- variants only if you need backward compatibility), update
any documentation references in this file to the new names, and consider noting
registration with the IANA HTTP Field Name Registry as suggested; ensure
examples and any mentions on lines referenced (including the other occurrences
around the file) are updated consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/morph-rails/0-overview.md`:
- Line 57: Replace the hard, absolute marketing claims in the copy—specifically
the phrases "A wallet address is your merchant identity" and "Accept payments
from $0.001 to $1,000,000 through the same flow"—with qualified language (e.g.,
"can serve as," "for example," or "may allow") and add a parenthetical or
footnote linking to a source or benchmark methodology that supports the example
ranges; update the two occurrences flagged in the document to use conditional
phrasing ("can", "may", "for example") and include or reference a citation to
justify the example pricing/onboarding claim.

In `@docs/morph-rails/agentic-payment/4-mcp.md`:
- Around line 76-78: Update the absolute security claim in the "Runtime-managed
auth" bullet: replace the phrase "This prevents key leakage" in the bullet that
begins "Runtime-managed auth — Wallet keys and signing are handled by the MCP
server, not by the agent's prompt context." with a softened statement such as
"This reduces key exposure risk" (or equivalent cautious wording) so the doc no
longer asserts an absolute guarantee.

In `@docs/morph-rails/infra-solutions/1-altfee.md`:
- Around line 24-28: Clarify the USDC token_id semantics by explicitly stating
whether USDC requires a token_id, uses a reserved default, or should omit the
field in transactions: update the table row for USDC (token symbol "USDC" and
contract `0xe34c91815d7fc18A9e2148bcD4241d0a5848b693`) to show the canonical
value (e.g., "omitted", "0", or "N/A (use omitted-field)") and add one short
sentence below the table describing how integrators should populate the
transaction payload when sending USDC (e.g., omit token_id entirely or set
token_id to 0), referencing the term token_id so readers know exactly which
field to use.

---

Nitpick comments:
In `@docs/morph-rails/agentic-payment/1-x402-facilitator.md`:
- Around line 16-20: The HTTP headers use deprecated X- prefixes; change the
header names from X-Payment-Network, X-Payment-Address, X-Payment-Amount, and
X-Payment-Token to non-prefixed names Payment-Network, Payment-Address,
Payment-Amount, and Payment-Token (keep X- variants only if you need backward
compatibility), update any documentation references in this file to the new
names, and consider noting registration with the IANA HTTP Field Name Registry
as suggested; ensure examples and any mentions on lines referenced (including
the other occurrences around the file) are updated consistently.

In `@docs/morph-rails/agentic-payment/3-morph-rails-cli.md`:
- Around line 21-23: Clarify the "stateless" claim by updating the docs around
the wallet commands (morph-cli wallet create and morph-cli wallet balance) and
the "stateless" statement (lines referencing 57-59) to add one concise sentence
that specifies where private keys are kept or that the CLI requires an external
signer/keystore for key management; explicitly state that the CLI does not
persist keys by default (or conversely where it stores them) so automation users
won't assume unsafe defaults and know to supply an external signer or secure key
storage.

In `@docs/morph-rails/infra-solutions/2-reference-key.md`:
- Around line 8-10: Replace the hard-coded availability sentence "Reference Key
will be available after the mainnet launch in April 2026." with a
timeline-neutral phrase (e.g., "Reference Key will be available after mainnet
launch" or "Reference Key will be available following mainnet launch") so the
note remains accurate if launch timing changes; update the content in
docs/morph-rails/infra-solutions/2-reference-key.md by locating the exact string
and substituting the neutral wording while preserving the surrounding :::info
block formatting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7a3bbdf9-fc2f-4843-95bd-8b2fe75d7b0b

📥 Commits

Reviewing files that changed from the base of the PR and between e675884 and e92ff9e.

📒 Files selected for processing (11)
  • docs/morph-rails/0-overview.md
  • docs/morph-rails/agentic-payment/0-overview.md
  • docs/morph-rails/agentic-payment/1-x402-facilitator.md
  • docs/morph-rails/agentic-payment/2-morph-skill.md
  • docs/morph-rails/agentic-payment/3-morph-rails-cli.md
  • docs/morph-rails/agentic-payment/4-mcp.md
  • docs/morph-rails/infra-solutions/1-altfee.md
  • docs/morph-rails/infra-solutions/2-reference-key.md
  • docs/morph-rails/middleware-service/1-private-transactions.md
  • docusaurus.config.js
  • sidebars.js


### SMBs & Independent Developers

Traditional payment providers impose onboarding thresholds that exclude small businesses — monthly volume requirements, minimum ticket sizes, lengthy KYC processes. Morph Rails has none of these. A wallet address is your merchant identity. Integrate in 5 minutes. Accept payments from $0.001 to $1,000,000 through the same flow.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Replace absolute market/pricing claims with qualified, sourced wording.

Line 57 and Line 69 make hard, time-sensitive claims that may be inaccurate across regions/plans and could create legal/compliance risk in public docs. Rephrase as “example” or “can,” and link a source or benchmark methodology.

Suggested safer wording
-Traditional payment providers impose onboarding thresholds that exclude small businesses — monthly volume requirements, minimum ticket sizes, lengthy KYC processes. Morph Rails has none of these. A wallet address is your merchant identity. Integrate in 5 minutes. Accept payments from $0.001 to $1,000,000 through the same flow.
+Traditional payment providers can impose onboarding thresholds that are difficult for some small businesses — such as volume requirements, ticket-size constraints, or extended verification flows. Morph Rails is designed to reduce these barriers. In many cases, teams can integrate quickly and support a wide payment range through a unified flow.
-Paid content platforms, API usage billing, in-game purchases, creator tipping, micro-SaaS — these high-frequency, low-value payment scenarios are either unprofitable or impossible on traditional rails. A $0.10 API call incurs a $0.30 Stripe fee. On Morph Rails, the same transaction costs a fraction of a cent in gas, payable in stablecoins via AltFee.
+Paid content platforms, API usage billing, in-game purchases, creator tipping, and micro-SaaS often struggle with fee efficiency on traditional rails. For low-value transactions, fixed + percentage fee models can materially impact margins. On Morph Rails, network fees are typically much lower and can be paid in stablecoins via AltFee; actual costs vary by network conditions and route.

Also applies to: 69-69

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/morph-rails/0-overview.md` at line 57, Replace the hard, absolute
marketing claims in the copy—specifically the phrases "A wallet address is your
merchant identity" and "Accept payments from $0.001 to $1,000,000 through the
same flow"—with qualified language (e.g., "can serve as," "for example," or "may
allow") and add a parenthetical or footnote linking to a source or benchmark
methodology that supports the example ranges; update the two occurrences flagged
in the document to use conditional phrasing ("can", "may", "for example") and
include or reference a citation to justify the example pricing/onboarding claim.

Comment on lines +76 to +78
- **Standardized discovery** — Agents don't need to know Morph-specific APIs. They discover tools via MCP.
- **Runtime-managed auth** — Wallet keys and signing are handled by the MCP server, not by the agent's prompt context. This prevents key leakage.
- **Composable** — MCP tools can be chained. An agent can check balance → swap tokens → make payment → verify receipt in a single reasoning chain.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid absolute security guarantee language.

Line 77 states this “prevents key leakage,” which is too absolute for a security claim. Prefer “reduces key exposure risk” unless formal guarantees are documented elsewhere.

Suggested wording update
-- **Runtime-managed auth** — Wallet keys and signing are handled by the MCP server, not by the agent's prompt context. This prevents key leakage.
+- **Runtime-managed auth** — Wallet keys and signing are handled by the MCP server, not by the agent's prompt context. This reduces key exposure risk.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/morph-rails/agentic-payment/4-mcp.md` around lines 76 - 78, Update the
absolute security claim in the "Runtime-managed auth" bullet: replace the phrase
"This prevents key leakage" in the bullet that begins "Runtime-managed auth —
Wallet keys and signing are handled by the MCP server, not by the agent's prompt
context." with a softened statement such as "This reduces key exposure risk" (or
equivalent cautious wording) so the doc no longer asserts an absolute guarantee.

Comment on lines +24 to +28
| Token | Contract Address | Token ID |
|-------|-----------------|----------|
| USDC | `0xe34c91815d7fc18A9e2148bcD4241d0a5848b693` | — |
| BGB | `0x389C08Bc23A7317000a1FD76c7c5B0cb0b4640b5` | 4 |

Copy link

@coderabbitai coderabbitai bot Mar 20, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify USDC token_id semantics to avoid integration errors.

Line 17 says token_id is part of the transaction, but Line 26 leaves USDC token ID undefined (). Please explicitly document whether USDC uses a concrete ID, a reserved default, or omitted-field behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/morph-rails/infra-solutions/1-altfee.md` around lines 24 - 28, Clarify
the USDC token_id semantics by explicitly stating whether USDC requires a
token_id, uses a reserved default, or should omit the field in transactions:
update the table row for USDC (token symbol "USDC" and contract
`0xe34c91815d7fc18A9e2148bcD4241d0a5848b693`) to show the canonical value (e.g.,
"omitted", "0", or "N/A (use omitted-field)") and add one short sentence below
the table describing how integrators should populate the transaction payload
when sending USDC (e.g., omit token_id entirely or set token_id to 0),
referencing the term token_id so readers know exactly which field to use.

Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的token 除了USDC和BGB 是不是还有USDT?要加上USDT 吗

Copy link

Choose a reason for hiding this comment

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

@vvpink,是的,您的观察非常准确!文档中存在不一致之处:

  • **Overview 部分(第13行)**明确列出了 "USDC, USDT, BGB" 作为支持的代币
  • 但 **Supported Tokens 表格(第24-28行)**中只有 USDC 和 BGB,缺少了 USDT

建议在表格中补充 USDT 的条目,格式如下:

| Token | Contract Address | Token ID |
|-------|-----------------|----------|
| USDC  | `0xe34c91815d7fc18A9e2148bcD4241d0a5848b693` ||
| USDT  | `<USDT contract address on Morph L2>` | <token_id or —> |
| BGB   | `0x389C08Bc23A7317000a1FD76c7c5B0cb0b4640b5` | 4 |

@SpectreMercury 确认 USDT 在 Morph L2 上的合约地址和 token_id,然后将其补充进表格,以确保文档与 Overview 描述保持一致。

@DannyFi DannyFi merged commit 8aba823 into morph-l2:main Mar 23, 2026
1 check passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 23, 2026
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.

3 participants