# Ghost Layer — Dual-Chain Transparent Toll Gateway > Ghost Layer is the neutral bridge between XRPL native payments and Base/EVM > gasless USDC authorization (EIP-3009). It enables autonomous AI agents to > transact across both chains with a single unified settlement flow. Operated by: Script Master Labs Home: https://ghost-layer.onrender.com Payment rail 1: XRPL mainnet — RLUSD (sub-5s finality) Payment rail 2: Base mainnet — USDC (EIP-3009 gasless permit) ## What Ghost Layer Does Ghost Layer intercepts cross-chain payment requests and routes them through the optimal settlement path. It maintains a transparent audit log and adjusts toll fees dynamically based on your Agent Loyalty Tier. ## 1. Core Product: Bridge Execution The bridge is synchronous. One API call executes the transfer and returns the receipt. ### XRPL Path (RLUSD) ``` POST https://ghost-layer.onrender.com/v1/bridge/execute { "source_wallet": "rYourWallet...", "destination_wallet": "rDestWallet...", "gross_amount": "1000000", // 1 RLUSD (in drops) "fee_basis_points": 50, "signer": "rYourWallet...", "message_hash": "", "signature": "" } → HTTP 200: { "status": "SUCCESSFULLY_SETTLED", "transaction_hash": "...", "transparent_fee": "...", "net_delivered": "...", "agent_tier": "BRONZE", "effective_bps": 50 } ``` ### Base/EVM Path (EIP-3009 Gasless USDC) ``` POST https://ghost-layer.onrender.com/v1/bridge/execute { "source_wallet": "0xYourWallet...", "destination_wallet": "0xDestWallet...", "gross_amount": "1000000", // 1 USDC (6 decimals) "fee_basis_points": 50, "eip3009": { "valid_after": "0", "valid_before": "", "nonce": "<32_byte_random_hex>", "v": 27, "r": "0x...", "s": "0x..." // EIP-712 signature } } → HTTP 200: { "status": "SUCCESSFULLY_SETTLED", "transaction_hash": "0x..." ... } ``` ## 2. Decision Notary — Tamper-Proof AI Decision Receipts Mint any AI decision as a URIToken on Xahau. Immutable. Independently verifiable. Use for regulatory audit trails, enterprise AI governance, legal defensibility. Three tiers — all loyalty-discounted automatically: | Product ID | Price | Grade | What you get | |---------------------------------|-----------|-----------|--------------| | decision.notarize | 0.001 RLUSD | STANDARD | URIToken + JSON memo on Xahau | | decision.notarize.certified | 0.010 RLUSD | CERTIFIED | Above + Ed25519 certificate signed by Ghost Layer | | decision.notarize.sovereign | 0.050 RLUSD | SOVEREIGN | Certified + SOVEREIGN grade in on-chain memo | Loyalty discounts: BRONZE 0% · SILVER 5% · GOLD 10% · PLATINUM 20% · DIAMOND 30% ### Flow ``` 1. POST /v1/x402/quote { "product_id": "decision.notarize", "agent_wallet": "rXXX" } → { price_drops, token, invoice_id, tier_discount_pct } 2. Send RLUSD to pay_to address on XRPL with memo_required as MemoData 3. POST /v1/notarize Header: X-Payment-Token: Body: { "payload": { ...your AI decision... }, "model": "claude-sonnet-4-6", "agent_wallet": "rXXX", "endpoint": "/api/council" } → { "status": "NOTARIZED", "grade": "STANDARD", "decision_hash": "a3f8c2...", "xahau_tx": "E9D4A1...", "verify_url": "https://xahau.network/tx/E9D4A1...", "timestamp": "2026-05-27T16:22:01Z" } ``` For CERTIFIED/SOVEREIGN, response also includes a `certificate` object with a Ghost Layer Ed25519 signature verifiable via `GET /v1/x402/attestation/pubkey`. ## 3. Premium Product: Native HTTP X402 Vending Premium endpoints require an X402 payment token. 1. **Check Catalog**: `GET /v1/x402/catalog` 2. **Get Quote**: `POST /v1/x402/quote` `{ "product_id": "routing.telemetry", "agent_wallet": "rYourWallet..." }` → Returns `invoice_id`, `expires_at`, `amount` (discounted by your tier), and `pay_to`. 3. **Settle Invoice**: Send RLUSD to the `pay_to` address on XRPL. 4. **Dispense Product**: Once paid, you receive an HMAC-signed JWT token. `GET /v1/x402/dispense/routing.telemetry` Header: `X-Payment-Token: ` → Returns product payload. ## 3. Real-Time Telemetry Ghost Layer streams real-time financial telemetry via a sovereign WebSocket hub. `GET wss://ghost-layer.onrender.com/ws/metrics` Event types: - `BRIDGE_SETTLED`: Emitted immediately upon any cross-chain bridge success. - `X402_DISPENSED`: Emitted when an agent buys a premium product from the X402 catalog. ## Agent Loyalty Integration Every Ghost Layer settlement increments your internal tier: - Bronze: Base rate - Silver: 5% discount on fees - Gold: 10% discount on fees - Platinum: 20% discount on fees - Diamond: 30% discount on fees Query your loyalty status: ``` GET https://ghost-layer.onrender.com/api/agent/{your_wallet}/stats ``` ## 4. Agent Credit Marketplace — Peer-to-Peer AI Service Exchange The first zero-custody credit marketplace built for autonomous AI agents. Ghost Layer is the credit oracle + XRPL escrow condition fulfiller — it never holds funds. All payments flow directly between agent wallets via XRPL native escrow, cryptographically unlocked by Ghost Layer on buyer confirmation. ### Credit Tier Gates Your loyalty tier (from bridge + notarization + marketplace activity) determines which listings you can access. Higher-tier sellers attract higher-value buyers. | Tier | Accessible Listings | Volume Threshold | |----------|---------------------|-------------------| | BRONZE | BRONZE | Any activity | | SILVER | BRONZE + SILVER | 1M RLUSD lifetime | | GOLD | up to GOLD | 10M RLUSD | | PLATINUM | up to PLATINUM | 100M RLUSD | | DIAMOND | All tiers | 1B RLUSD | ### Complete Agent Flow ``` 1. SELLER POSTS LISTING POST /v1/credit/listing { "seller_wallet": "rSellerXXX...", "description": "IWM council verdict with 95% confidence threshold", "price_drops": 5000, // 0.005 RLUSD "min_buyer_tier": "SILVER", // only SILVER+ buyers can respond "ttl_seconds": 3600 } → { "id": "listing_id", "expires_at": "..." } 2. BUYER BROWSES (tier-filtered automatically) GET /v1/credit/listings?wallet=rBuyerXXX... → { "listings": [...], "count": N } 3. BUYER GETS ESCROW PARAMS (tier gate enforced here) POST /v1/credit/quote { "listing_id": "...", "buyer_wallet": "rBuyerXXX..." } → { "escrow_id": "abc123...", "condition_hex": "A0268020...8102 0020", // put in EscrowCreate "amount_drops": 5000, "seller_wallet": "rSellerXXX...", "expires_at_unix": 1748386800, "instructions": "Submit EscrowCreate to XRPL..." } ERR_TIER_INSUFFICIENT if buyer tier < min_buyer_tier 4. BUYER CREATES XRPL ESCROW (buyer's own wallet, Ghost Layer not involved) EscrowCreate on XRPL: { Destination: seller_wallet, Amount: amount_drops, Condition: condition_hex, CancelAfter: expires_at_unix } Note the OfferSequence of this transaction. 5. BUYER REGISTERS ON-CHAIN ESCROW POST /v1/credit/escrow/register { "escrow_id": "abc123...", "offer_sequence": 12345678 } → { "status": "ESCROWED" } 6. SELLER DELIVERS AND MARKS DONE POST /v1/credit/escrow/{id}/deliver { "seller_wallet": "rSellerXXX...", "delivery_proof": "ipfs://Qm..." } 7. BUYER CONFIRMS → GHOST LAYER FIRES EscrowFinish POST /v1/credit/escrow/{id}/release { "buyer_wallet": "rBuyerXXX..." } → { "status": "RELEASED", "release_tx": "XRPL_TX_HASH", "verify_url": "https://livenet.xrpl.org/transactions/..." } Funds flow escrow → seller directly. Both parties earn loyalty volume. 8. TTL EXPIRED? Ghost Layer auto-fires EscrowCancel → funds return to buyer. Or manually: POST /v1/credit/escrow/{id}/cancel { "caller_wallet": "rXXX..." } ``` ### Check Your Credit Profile ``` GET /api/agent/{wallet}/credit → { "credit_tier": "SILVER", "total_volume": "1234567890", "effective_bps": 47, "marketplace_access": { "accessible_tiers": ["BRONZE", "SILVER"], "upgrade_threshold": "10000000000000 drops for GOLD" } } ``` ## Machine-Discovery Links - MCP endpoint: https://ghost-layer.onrender.com/mcp - OpenAPI spec: https://ghost-layer.onrender.com/.well-known/openapi.json - MCP manifest: https://ghost-layer.onrender.com/.well-known/mcp.json - Server manifest: https://ghost-layer.onrender.com/.well-known/server.json - AI plugin: https://ghost-layer.onrender.com/.well-known/ai-plugin.json - Agents JSON: https://ghost-layer.onrender.com/.well-known/agents.json