AI100WEB
x402 · A2A · TON · เดโม · Staging

จ่าย แล้วเรียกใช้: เดโม x402 + A2A บน TON

เอเจนต์หนึ่งจ่ายไมโครเพย์เมนต์ผ่าน Agentic Wallet แล้วเรียกสกิลของอีกเอเจนต์ผ่าน A2A

Simulation — no real funds · ไม่มีการสร้าง เซ็น หรือส่งธุรกรรม และไม่มีการแตะ Agentic Wallet หลักฐานทุกขั้นบันทึกจากเกตเวย์จริง แล้วปิดข้อมูลลับก่อนเผยแพร่

บันทึกเมื่อ 30 Oct 2026, 16:46:49 ICT · เกตเวย์ https://ai100web.pages.dev/a2a · 10/10 ผ่าน

สถานะเกตเวย์สด: ต้องใช้ JavaScript

00 สถาปัตยกรรม

Agent A

ผู้เรียก / ผู้จ่าย

Registered test client key payment-agent. Signs every request with Ed25519 (X-A2A-* headers). Payer 0:a1a1a1…1a1a1 is a simulated address.

Agent B

AI100WEB TON Agent

A2A gateway at /a2a. Verifies the signature, quotes paid skills over HTTP 402 (x402), checks the payment proof and its single-use nonce, then answers the task.

payTo

Agentic Wallet

UQBzg5yX…YdSXZ — wallet v5r1 owner, x402 pay-to. In this demo the 0.01 TON transfer is simulated: nothing reaches the chain.

01 เอเจนต์ A ขอสกิลเสียเงิน → ได้ใบเสนอราคา HTTP 402

จำลอง — ไม่มีเงินจริง30 Oct 2026, 16:46:49 ICT

Request
signed POST /a2a · message/send · skill ai-analyze
Response
HTTP 402 · task input-required
resource
https://ai100web.pages.dev/a2a#ai-analyze
amount
10000000 nano TON (= 0.01 TON)
payTo
UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ
nonce
27a07b49-b303-4df5-b48b-78eb38554676 · หมดอายุ 30 Oct 2026, 16:51:49 ICT
{
  "PAYMENT-REQUIRED (decoded) accepts[TON]": {
    "scheme": "exact",
    "network": "ton-mainnet",
    "payTo": "UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ",
    "resource": "https://ai100web.pages.dev/a2a#ai-analyze",
    "description": "One call to paid skill ai-analyze",
    "mimeType": "application/json",
    "maxTimeoutSeconds": 300,
    "asset": "TON",
    "maxAmountRequired": "10000000",
    "extra": {
      "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
      "comment": "x402:27a07b49-b303-4df5-b48b-78eb38554676",
      "expiry": "2026-10-30T09:51:49.956Z",
      "simulationMode": true,
      "binding": {
        "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
        "requesterBound": true,
        "note": "pay FROM this payer address; the paying tx source wallet must match"
      },
      "decimals": 9,
      "amount": "0.01"
    }
  }
}
หลักฐานดิบ (ปิดข้อมูลลับแล้ว)
{
  "request": {
    "method": "POST",
    "url": "https://ai100web.pages.dev/a2a",
    "headers": {
      "content-type": "application/json",
      "X-A2A-Key-Id": "payment-agent",
      "X-A2A-Timestamp": "1793353609",
      "X-A2A-Signature": "WDy16j…[redacted 88 chars]"
    },
    "body": {
      "jsonrpc": "2.0",
      "id": "demo-quote-mvusfp05",
      "method": "message/send",
      "params": {
        "message": {
          "role": "user",
          "kind": "message",
          "messageId": "demo-quote-eoeeqiqo",
          "parts": [
            {
              "kind": "data",
              "data": {
                "skill": "ai-analyze",
                "text": "Demo: analyze the TON agent payment flow (simulated x402)."
              }
            }
          ],
          "metadata": {
            "x402.payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1"
          }
        }
      }
    }
  },
  "response": {
    "status": 402,
    "headers": {
      "content-type": "application/json; charset=utf-8",
      "x-audit-id": "1"
    },
    "paymentRequiredDecoded": {
      "x402Version": 1,
      "error": "X-PAYMENT (or PAYMENT-SIGNATURE) header is required",
      "accepts": [
        {
          "scheme": "exact",
          "network": "ton-mainnet",
          "payTo": "UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ",
          "resource": "https://ai100web.pages.dev/a2a#ai-analyze",
          "description": "One call to paid skill ai-analyze",
          "mimeType": "application/json",
          "maxTimeoutSeconds": 300,
          "asset": "TON",
          "maxAmountRequired": "10000000",
          "extra": {
            "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
            "comment": "x402:27a07b49-b303-4df5-b48b-78eb38554676",
            "expiry": "2026-10-30T09:51:49.956Z",
            "simulationMode": true,
            "binding": {
              "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
              "requesterBound": true,
              "note": "pay FROM this payer address; the paying tx source wallet must match"
            },
            "decimals": 9,
            "amount": "0.01"
          }
        },
        {
          "scheme": "exact",
          "network": "ton-mainnet",
          "payTo": "UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ",
          "resource": "https://ai100web.pages.dev/a2a#ai-analyze",
          "description": "One call to paid skill ai-analyze",
          "mimeType": "application/json",
          "maxTimeoutSeconds": 300,
          "asset": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
          "maxAmountRequired": "10000",
          "extra": {
            "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
            "comment": "x402:27a07b49-b303-4df5-b48b-78eb38554676",
            "expiry": "2026-10-30T09:51:49.956Z",
            "simulationMode": true,
            "binding": {
              "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
              "requesterBound": true,
              "note": "pay FROM this payer address; the paying tx source wallet must match"
            },
            "symbol": "USDT",
            "decimals": 6,
            "jettonMaster": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
            "amount": "0.01"
          }
        }
      ]
    },
    "taskState": "input-required",
    "agentMessage": "Payment required for ai-analyze: pay 0.01 TON or 0.01 USDT to UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ with comment \"x402:27a07b49-b303-4df5-b48b-78eb38554676\" before 2026-10-30T09:51:49.956Z, then retry with an X-PAYMENT header."
  }
}

02 จ่าย 0.01 TON แบบจำลองไปยัง Agentic Wallet

จำลอง — ไม่มีเงินจริง30 Oct 2026, 16:46:50 ICT

from
0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 (ที่อยู่จำลอง)
to
UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ
amount
10000000 nano TON
comment
x402:27a07b49-b303-4df5-b48b-78eb38554676
สถานะ
simulated · signed: false · broadcast: false · txHash: null
{
  "simulatedReceipt": {
    "simulated": true,
    "signed": false,
    "broadcast": false,
    "txHash": null,
    "network": "ton-mainnet",
    "from": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
    "to": "UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ",
    "asset": "TON",
    "amountNano": "10000000",
    "amount": "0.01",
    "comment": "x402:27a07b49-b303-4df5-b48b-78eb38554676",
    "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
    "createdAt": "2026-10-30T09:46:50.500Z",
    "note": "Simulation — no real funds. No transaction was built, signed or sent; the Agentic Wallet was not accessed."
  },
  "X-PAYMENT (decoded)": {
    "x402Version": 1,
    "scheme": "exact",
    "network": "ton-mainnet",
    "payload": {
      "simulated": true,
      "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
      "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1"
    }
  }
}

03 เรียกสกิลเสียเงินผ่าน A2A พร้อมหลักฐานการจ่าย → ผลลัพธ์

จำลอง — ไม่มีเงินจริง30 Oct 2026, 16:46:50 ICT

Response
HTTP 200 · task completed · payment-completed
receipt
71c8eeea-cb7d-4a86-98a5-9c23ef9eb147 · nonce ตรงกับใบเสนอราคา
amount → payTo
10000000 nano TON → UQBzg5yX…YdSXZ
simulated
true · txHash
ข้อความเอเจนต์
ai-analyze: x402 payment accepted (SIMULATED). The skill itself is not executed on this edge endpoint; run it via the Supabase a2a-inbox with this receipt.
{
  "PAYMENT-RESPONSE (decoded)": {
    "receiptId": "71c8eeea-cb7d-4a86-98a5-9c23ef9eb147",
    "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
    "skillId": "ai-analyze",
    "resource": "https://ai100web.pages.dev/a2a#ai-analyze",
    "payTo": "UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ",
    "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
    "asset": "TON",
    "amount": "10000000",
    "txHash": null,
    "network": "ton-mainnet",
    "simulated": true,
    "verifiedAt": "2026-10-30T09:46:51.114Z",
    "proof": {
      "alg": "SHA-256",
      "signed": false,
      "digest": "4104a5463163610b1bd05c4843025f95a334158aa79e1454e8038e2902c16d4a",
      "note": "unsigned digest; set RECEIPT_SECRET for HMAC-SHA256"
    }
  }
}
หลักฐานดิบ (ปิดข้อมูลลับแล้ว)
{
  "request": {
    "method": "POST",
    "url": "https://ai100web.pages.dev/a2a",
    "headers": {
      "content-type": "application/json",
      "X-A2A-Key-Id": "payment-agent",
      "X-A2A-Timestamp": "1793353610",
      "X-A2A-Signature": "Q4xmfU…[redacted 88 chars]",
      "X-PAYMENT": "<base64 JSON, decoded below>"
    },
    "body": {
      "jsonrpc": "2.0",
      "id": "demo-paid-mvusfpxg",
      "method": "message/send",
      "params": {
        "message": {
          "role": "user",
          "kind": "message",
          "messageId": "demo-paid-m8078ekn",
          "parts": [
            {
              "kind": "data",
              "data": {
                "skill": "ai-analyze",
                "text": "Demo: analyze the TON agent payment flow (simulated x402)."
              }
            }
          ]
        }
      }
    },
    "xPaymentDecoded": {
      "x402Version": 1,
      "scheme": "exact",
      "network": "ton-mainnet",
      "payload": {
        "simulated": true,
        "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
        "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1"
      }
    }
  },
  "response": {
    "status": 200,
    "headers": {
      "content-type": "application/json; charset=utf-8",
      "x-audit-id": "2"
    },
    "paymentResponseDecoded": {
      "receiptId": "71c8eeea-cb7d-4a86-98a5-9c23ef9eb147",
      "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
      "skillId": "ai-analyze",
      "resource": "https://ai100web.pages.dev/a2a#ai-analyze",
      "payTo": "UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ",
      "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
      "asset": "TON",
      "amount": "10000000",
      "txHash": null,
      "network": "ton-mainnet",
      "simulated": true,
      "verifiedAt": "2026-10-30T09:46:51.114Z",
      "proof": {
        "alg": "SHA-256",
        "signed": false,
        "digest": "4104a5463163610b1bd05c4843025f95a334158aa79e1454e8038e2902c16d4a",
        "note": "unsigned digest; set RECEIPT_SECRET for HMAC-SHA256"
      }
    },
    "taskState": "completed",
    "agentMessage": "ai-analyze: x402 payment accepted (SIMULATED). The skill itself is not executed on this edge endpoint; run it via the Supabase a2a-inbox with this receipt.",
    "paymentStatus": "payment-completed",
    "artifact": {
      "name": "ai-analyze-result",
      "data": {
        "executed": false,
        "paid": true,
        "receipt": {
          "receiptId": "71c8eeea-cb7d-4a86-98a5-9c23ef9eb147",
          "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
          "skillId": "ai-analyze",
          "resource": "https://ai100web.pages.dev/a2a#ai-analyze",
          "payTo": "UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ",
          "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
          "asset": "TON",
          "amount": "10000000",
          "txHash": null,
          "network": "ton-mainnet",
          "simulated": true,
          "verifiedAt": "2026-10-30T09:46:51.114Z",
          "proof": {
            "alg": "SHA-256",
            "signed": false,
            "digest": "4104a5463163610b1bd05c4843025f95a334158aa79e1454e8038e2902c16d4a",
            "note": "unsigned digest; set RECEIPT_SECRET for HMAC-SHA256"
          }
        },
        "quote": {
          "amount": "0.01",
          "currency": "TON",
          "settledVia": "x402 HTTP 402 quote at the gateway (simulation on staging)",
          "x402": {
            "endpoint": "https://ryounoi100web.com/a2a",
            "network": "ton-mainnet",
            "assets": [
              "TON",
              "USDT"
            ],
            "header": "X-PAYMENT",
            "note": "Edge price set by X402_PRICE_TON / X402_PRICE_USDT; see documentationUrl"
          }
        },
        "inbox": "upstream a2a-inbox (URL not published; configured as a secret, reached only through the signed /a2a gateway)",
        "verification": {
          "checks": [
            {
              "check": "SIMULATED proof accepted (X402_SIMULATION=true); no on-chain verification performed",
              "ok": true
            }
          ],
          "source": null
        }
      }
    }
  }
}

04 ใช้หลักฐานการจ่ายซ้ำ → ถูกปฏิเสธ

จำลอง — ไม่มีเงินจริง30 Oct 2026, 16:46:52 ICT

Response
HTTP 402 · payment-rejected · replayed_nonce
ความหมาย
nonce ใช้ได้ครั้งเดียว — จ่ายครั้งเดียวเรียกได้ครั้งเดียว
หลักฐานดิบ (ปิดข้อมูลลับแล้ว)
{
  "request": {
    "method": "POST",
    "url": "https://ai100web.pages.dev/a2a",
    "headers": {
      "content-type": "application/json",
      "X-A2A-Key-Id": "payment-agent",
      "X-A2A-Timestamp": "1793353612",
      "X-A2A-Signature": "eKzXIh…[redacted 88 chars]",
      "X-PAYMENT": "<base64 JSON, decoded below>"
    },
    "body": {
      "jsonrpc": "2.0",
      "id": "demo-replay-mvusfr4p",
      "method": "message/send",
      "params": {
        "message": {
          "role": "user",
          "kind": "message",
          "messageId": "demo-replay-2lsuho4t",
          "parts": [
            {
              "kind": "data",
              "data": {
                "skill": "ai-analyze",
                "text": "Demo: analyze the TON agent payment flow (simulated x402)."
              }
            }
          ]
        }
      }
    },
    "xPaymentDecoded": {
      "x402Version": 1,
      "scheme": "exact",
      "network": "ton-mainnet",
      "payload": {
        "simulated": true,
        "nonce": "27a07b49-b303-4df5-b48b-78eb38554676",
        "payer": "0:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1"
      }
    }
  },
  "response": {
    "status": 402,
    "paymentStatus": "payment-rejected",
    "paymentError": "replayed_nonce",
    "error": null
  }
}

05 คำขอที่ไม่เซ็น → 401

จำลอง — ไม่มีเงินจริง30 Oct 2026, 16:46:53 ICT

Response
HTTP 401
ความหมาย
ไม่มีลายเซ็น Ed25519 ก็ไม่มีใบเสนอราคาและไม่มีการเรียกสกิล
หลักฐานดิบ (ปิดข้อมูลลับแล้ว)
{
  "status": 401,
  "body": {
    "error": "unauthorized"
  }
}

06 ผลการตรวจในรอบที่บันทึก

  • PASS discover.card card 200, ai-analyze price 0.01 TON
  • PASS discover.simulation GET /a2a x402.simulation=true
  • PASS quote.402 HTTP 402
  • PASS quote.terms resource https://ai100web.pages.dev/a2a#ai-analyze, 10000000 nano TON, payTo UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ, simulationMode true
  • PASS pay.simulated to UQBzg5yX7h5m-DLINTeWzxc5lwmPjJrgMtWisw4rRUDYdSXZ, 10000000 nano, broadcast=false
  • PASS paid.200 HTTP 200, state completed
  • PASS paid.receipt receipt nonce match true, simulated true, amount 10000000, status payment-completed
  • PASS replay.rejected HTTP 402, payment status payment-rejected, error replayed_nonce
  • PASS unsigned.401 HTTP 401
  • PASS sanitized no key material or full signatures in transcript

บันทึกโดยสคริปต์ฝั่งเซิร์ฟเวอร์ด้วยกุญแจทดสอบที่ลงทะเบียนไว้ กุญแจไม่เคยถูกส่งถึงเบราว์เซอร์ ค่าลายเซ็นถูกตัดออก Transcript JSON · โปรไฟล์เอเจนต์ · /ton