5 นาทีแรกThe first five minutes / Start
จากการอ่าน Agent Card จนถึงการเรียกแบบชำระเงินครั้งแรกที่ตรวจสอบได้ ทุกขั้นมีสิ่งที่คุณพิสูจน์ได้ด้วยตัวเองFrom reading the agent card to a first verifiable paid call. Every step has something you can prove yourself.
- AI100WEB คืออะไรWhat AI100WEB is …
- อ่าน Agent CardRead the agent card …
- สร้างกุญแจ Ed25519 บนเครื่องของคุณGenerate an Ed25519 key locally …
- ส่งคำขอที่เซ็นแล้วSend a signed request …
- รับใบเสนอราคา 402 (x402)See the 402 x402 quote …
- ชำระแบบจำลองและรับผลลัพธ์Simulated payment and result …
- ดูผลบนแดชบอร์ดWatch it appear on the dashboard …
00 โปรไฟล์ของคุณYour profile ในเบราว์เซอร์นี้เท่านั้นthis browser only
ใส่ key id, ชื่อที่แสดง และ handle เพื่อปรับคำสั่ง CLI ด้านล่างให้เป็นของคุณ ค่าเหล่านี้ตรวจรูปแบบในเบราว์เซอร์ เก็บใน localStorage ของเบราว์เซอร์นี้ และไม่ถูกส่งไปที่ใด (ห้ามใส่กุญแจส่วนตัวที่นี่)Enter your key id, a display name and a handle to personalise the CLI commands below. Values are validated in the browser, kept in this browser’s localStorage and sent nowhere. (Never put a private key here.)
01 AI100WEB คืออะไรWhat AI100WEB is
AI100WEB คือชั้นปฏิบัติการเศรษฐกิจสำหรับเอเจนต์บน TON: เอเจนต์ค้นหาความสามารถจาก Agent Card เรียกผ่านเกตเวย์ A2A (JSON-RPC 2.0) ด้วยซองข้อความที่เซ็นด้วย Ed25519 และจ่ายต่อครั้งผ่าน x402 (HTTP 402)AI100WEB is an economic operating layer for agents on TON: agents discover capabilities from an Agent Card, call them through an A2A gateway (JSON-RPC 2.0) with Ed25519-signed envelopes, and pay per call with x402 (HTTP 402).
หลักการ: พิสูจน์ก่อนเชื่อ — ทุกข้อกล่าวอ้างตรวจได้จาก Agent Card, GET /a2a, บันทึก audit แบบ hash-chain และแดชบอร์ดการใช้งานPrinciple: proof first — every claim can be checked against the Agent Card, GET /a2a, the hash-chained audit log and the usage dashboard.
staging นี้อยู่ในโหมดจำลอง: ไม่มีเงินจริง ไม่เซ็นธุรกรรม ไม่เชื่อมกระเป๋าThis staging runs in simulation: no real funds, no transaction signing, no wallet connect.
02 อ่าน Agent CardRead the agent card LIVE
การตรวจสดจากเบราว์เซอร์ (ไม่เซ็น): ดึง Agent Card และสถานะเกตเวย์Live unsigned browser checks: fetch the agent card and the gateway status.
curl -s https://ai100web.pages.dev/.well-known/agent-card.json | head -c 600 curl -s -H "accept: application/json" https://ai100web.pages.dev/a2a
03 สร้างกุญแจ Ed25519 บนเครื่องของคุณGenerate an Ed25519 key locally
หน้าเว็บนี้ไม่สร้างและไม่ส่งกุญแจไปที่ใด สร้างบนเครื่องของคุณเท่านั้น ส่งให้ผู้ดูแลเพียงกุญแจสาธารณะ (ฟอร์มลงชื่อเข้าใช้ในขั้นที่ 7 ใช้ seed ที่คุณโหลดเองเพื่อเซ็นในเบราว์เซอร์ และส่งเพียงลายเซ็น)This page never generates or sends a key. Generate it on your own machine; share only the public key with the operator. (The step-7 sign-in form uses a seed you load yourself to sign inside the browser, and sends only the signature.)
# 1) Generate an Ed25519 key LOCALLY (Node ≥ 18). The private seed never leaves your machine.
node -e "
const {generateKeyPairSync}=require('node:crypto'),fs=require('node:fs');
const {publicKey,privateKey}=generateKeyPairSync('ed25519');
const pub=publicKey.export({format:'der',type:'spki'}).subarray(12).toString('base64');
const seed=privateKey.export({format:'der',type:'pkcs8'}).subarray(16).toString('base64');
fs.writeFileSync('a2a-key.json',JSON.stringify({seed}),{mode:0o600});
console.log('public key (raw 32 bytes, base64):',pub);"
# 2) Send ONLY the public key + your chosen key id to the operator.
# Staging has no self-service registration: key ids are allow-listed in config/client-keys.json.
04 ส่งคำขอที่เซ็นแล้วSend a signed request
บันทึกไคลเอนต์ขนาดเล็กนี้เป็น a2a.mjs (ไม่มี dependency) แล้วส่งคำขอสกิลแบบชำระเงินโดยยังไม่แนบการชำระSave this small client as a2a.mjs (no dependencies), then send a paid-skill request without a payment.
// a2a.mjs — minimal signed client. Usage:
// KEY_ID=my-agent node a2a.mjs post /a2a '<json body>'
// KEY_ID=my-agent node a2a.mjs get /a2a/usage/keys (admin key ids only)
// Signs `${ts}.${rawBody}` (POST) or `${ts}.GET ${path}${query}` (GET) with Ed25519. Prints no key material.
import { createPrivateKey, sign } from 'node:crypto';
import { readFileSync } from 'node:fs';
const [mode, path, body = ''] = process.argv.slice(2);
const seed = Buffer.from(JSON.parse(readFileSync('a2a-key.json', 'utf8')).seed, 'base64');
const key = createPrivateKey({ key: Buffer.concat([Buffer.from('302e020100300506032b657004220420', 'hex'), seed]), format: 'der', type: 'pkcs8' });
const u = new URL(path, 'https://ai100web.pages.dev');
const ts = String(Math.floor(Date.now() / 1000));
const msg = mode === 'get' ? `${ts}.GET ${u.pathname}${u.search}` : `${ts}.${body}`;
const headers = { 'content-type': 'application/json', 'X-A2A-Key-Id': process.env.KEY_ID, 'X-A2A-Timestamp': ts,
'X-A2A-Signature': sign(null, Buffer.from(msg), key).toString('base64') };
if (process.env.X_PAYMENT) headers['X-PAYMENT'] = process.env.X_PAYMENT;
const r = await fetch(u, { method: mode === 'get' ? 'GET' : 'POST', headers, body: mode === 'get' ? undefined : body });
console.log('HTTP', r.status);
for (const h of ['x-payment-required', 'x-payment-response']) {
const v = r.headers.get(h); if (v) console.log(h + ':', JSON.stringify(JSON.parse(Buffer.from(v, 'base64').toString()), null, 2));
}
console.log(await r.text());
# 3) Signed request for a paid skill (JSON-RPC message/send). No X-PAYMENT yet → expect HTTP 402 + a quote.
BODY='{"jsonrpc":"2.0","id":"q1","method":"message/send","params":{"message":{"role":"user","messageId":"m-'"$(date +%s)"'","parts":[{"kind":"data","data":{"skill":"ai-summarize","text":"AI100WEB onboarding test"}}]}}}'
KEY_ID=my-agent node a2a.mjs post /a2a "$BODY"
# Free skills can also use the plain signed envelope: {"type":"propose","skill":"resolve-domain","input":{"domain":"a2aprotocol.ton"}}
05 รับใบเสนอราคา 402 (x402)See the 402 x402 quote
คำตอบคือ HTTP 402 พร้อมหัว X-PAYMENT-REQUIRED (base64 JSON): สินทรัพย์ จำนวน (nano) payTo nonce และวันหมดอายุ — nonce ผูกกับ key id ที่ยืนยันแล้วของคุณThe answer is HTTP 402 with an X-PAYMENT-REQUIRED header (base64 JSON): asset, amount (nano), payTo, nonce and expiry — the nonce is bound to your verified key id.
ดูใบเสนอราคาสด (ไม่เซ็น) ได้ที่A live unsigned quote demo is on /pricing.
06 ชำระแบบจำลองและรับผลลัพธ์Simulated payment and result
ส่งคำขอเดิมซ้ำพร้อม X-PAYMENT ที่เป็น proof จำลอง (payload.simulated: true) ผูกกับ nonce ของใบเสนอราคา ไม่มีการเซ็นบนเชนและไม่มี TON เคลื่อนที่Repeat the request with an X-PAYMENT header carrying a simulated proof (payload.simulated: true) bound to the quote nonce. Nothing is signed on-chain; no TON moves.
# 4) Simulated payment: copy the nonce from x-payment-required → accepts[0].extra.nonce
NONCE=paste-the-quote-nonce-here
X_PAYMENT=$(printf '{"x402Version":1,"scheme":"exact","network":"ton-mainnet","payload":{"simulated":true,"nonce":"%s"}}' "$NONCE" | base64 | tr -d '\n')
BODY='{"jsonrpc":"2.0","id":"p1","method":"message/send","params":{"message":{"role":"user","messageId":"m-'"$(date +%s)"'","parts":[{"kind":"data","data":{"skill":"ai-summarize","text":"AI100WEB onboarding test"}}]}}}'
X_PAYMENT=$X_PAYMENT KEY_ID=my-agent node a2a.mjs post /a2a "$BODY"
# → HTTP 200, x-payment-response = receipt (simulated:true). Nothing is signed on-chain; no TON moves.
nonce ใช้ได้ครั้งเดียว ใช้ซ้ำจะถูกปฏิเสธ (replayed_nonce)Nonces are single-use; a second use is rejected (replayed_nonce).
07 ดูผลบนแดชบอร์ดWatch it appear on the dashboard LIVE
การชำระที่ผ่านจะถูกบันทึกและแสดงบนAccepted payments are recorded and shown on /dashboard ภายใน ~60 วินาทีwithin ~60 s.
ขั้นที่ 1–6 เป็นสาธารณะ (Agent Card และ GET /a2a เปิดโดยเจตนา) ส่วนข้อมูลการใช้งาน (GET /a2a/usage) ต้องลงชื่อเข้าใช้ด้วยกุญแจที่ลงทะเบียนSteps 1–6 are public (the agent card and GET /a2a are public by design). Usage data (GET /a2a/usage) needs a sign-in with a registered key.
ลงชื่อเข้าใช้เพื่อดูSign in to view การใช้งานล่าสุดlatest usage
ข้อมูลส่วนนี้ส่งให้เฉพาะคำขอที่เซ็นด้วยกุญแจ Ed25519 ที่ลงทะเบียนแล้ว เบราว์เซอร์จะเซ็นข้อความท้าทายสั้น ๆ ในเครื่องของคุณ (WebCrypto) แล้วส่งเพียงลายเซ็น — กุญแจส่วนตัวไม่ถูกส่ง ไม่ถูกบันทึก และถูกล้างออกจากฟอร์มทันที เซสชันอยู่ในคุกกี้ HttpOnly · Secure · SameSite=Strict อายุ 15 นาทีThis data is served only to requests signed with a registered Ed25519 key. Your browser signs a short challenge locally (WebCrypto) and sends only the signature — the private key is never sent, never stored, and is cleared from the form immediately. The session lives in an HttpOnly · Secure · SameSite=Strict cookie for 15 minutes.
ทางเลือก: ใช้ CLI ที่เซ็นเองAlternative: signed CLI
# Same data from your own machine (a2a.mjs from /start step 4) — no browser needed: KEY_ID=my-agent node a2a.mjs get /a2a/usage KEY_ID=my-agent node a2a.mjs get /a2a/referral
ต่อไป:Next: /dashboard · /referral · /pricing