AI100WEB
Onboarding · 7 ขั้น · Staging

5 นาทีแรก / Start

จากการอ่าน Agent Card จนถึงการเรียกแบบชำระเงินครั้งแรกที่ตรวจสอบได้ ทุกขั้นมีสิ่งที่คุณพิสูจน์ได้ด้วยตัวเอง

SIMULATION / ตัวอย่าง · โหมดจำลอง — staging นี้ไม่รับเงินจริง ไม่เซ็นธุรกรรม TON และไม่เชื่อมต่อกระเป๋าเงิน ตัวเลขทั้งหมดเป็นการชำระแบบจำลอง (simulated x402) เท่านั้น

00 โปรไฟล์ของคุณ ในเบราว์เซอร์นี้เท่านั้น

ใส่ key id, ชื่อที่แสดง และ handle เพื่อปรับคำสั่ง CLI ด้านล่างให้เป็นของคุณ ค่าเหล่านี้ตรวจรูปแบบในเบราว์เซอร์ เก็บใน localStorage ของเบราว์เซอร์นี้ และไม่ถูกส่งไปที่ใด (ห้ามใส่กุญแจส่วนตัวที่นี่)

1–64 · A–Z a–z 0–9 . _ -

1–40 ตัวอักษร ตัวเลข ช่องว่าง . _ -

3–16 · A–Z 0–9

01 AI100WEB คืออะไร

AI100WEB คือชั้นปฏิบัติการเศรษฐกิจสำหรับเอเจนต์บน TON: เอเจนต์ค้นหาความสามารถจาก Agent Card เรียกผ่านเกตเวย์ A2A (JSON-RPC 2.0) ด้วยซองข้อความที่เซ็นด้วย Ed25519 และจ่ายต่อครั้งผ่าน x402 (HTTP 402)

หลักการ: พิสูจน์ก่อนเชื่อ — ทุกข้อกล่าวอ้างตรวจได้จาก Agent Card, GET /a2a, บันทึก audit แบบ hash-chain และแดชบอร์ดการใช้งาน

staging นี้อยู่ในโหมดจำลอง: ไม่มีเงินจริง ไม่เซ็นธุรกรรม ไม่เชื่อมกระเป๋า

02 อ่าน Agent Card LIVE

การตรวจสดจากเบราว์เซอร์ (ไม่เซ็น): ดึง Agent Card และสถานะเกตเวย์

bash · curl
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 บนเครื่องของคุณ

หน้าเว็บนี้ไม่สร้างและไม่ส่งกุญแจไปที่ใด สร้างบนเครื่องของคุณเท่านั้น ส่งให้ผู้ดูแลเพียงกุญแจสาธารณะ (ฟอร์มลงชื่อเข้าใช้ในขั้นที่ 7 ใช้ seed ที่คุณโหลดเองเพื่อเซ็นในเบราว์เซอร์ และส่งเพียงลายเซ็น)

node · keygen (local only)
# 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 ส่งคำขอที่เซ็นแล้ว

บันทึกไคลเอนต์ขนาดเล็กนี้เป็น a2a.mjs (ไม่มี dependency) แล้วส่งคำขอสกิลแบบชำระเงินโดยยังไม่แนบการชำระ

a2a.mjs · signer (local)
// 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());
bash · 402 quote
# 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)

คำตอบคือ HTTP 402 พร้อมหัว X-PAYMENT-REQUIRED (base64 JSON): สินทรัพย์ จำนวน (nano) payTo nonce และวันหมดอายุ — nonce ผูกกับ key id ที่ยืนยันแล้วของคุณ

ดูใบเสนอราคาสด (ไม่เซ็น) ได้ที่ /pricing.

06 ชำระแบบจำลองและรับผลลัพธ์

ส่งคำขอเดิมซ้ำพร้อม X-PAYMENT ที่เป็น proof จำลอง (payload.simulated: true) ผูกกับ nonce ของใบเสนอราคา ไม่มีการเซ็นบนเชนและไม่มี TON เคลื่อนที่

bash · simulated payment
# 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)

07 ดูผลบนแดชบอร์ด LIVE

การชำระที่ผ่านจะถูกบันทึกและแสดงบน /dashboard ภายใน ~60 วินาที.

ขั้นที่ 1–6 เป็นสาธารณะ (Agent Card และ GET /a2a เปิดโดยเจตนา) ส่วนข้อมูลการใช้งาน (GET /a2a/usage) ต้องลงชื่อเข้าใช้ด้วยกุญแจที่ลงทะเบียน

ลงชื่อเข้าใช้เพื่อดู การใช้งานล่าสุด

ข้อมูลส่วนนี้ส่งให้เฉพาะคำขอที่เซ็นด้วยกุญแจ Ed25519 ที่ลงทะเบียนแล้ว เบราว์เซอร์จะเซ็นข้อความท้าทายสั้น ๆ ในเครื่องของคุณ (WebCrypto) แล้วส่งเพียงลายเซ็น — กุญแจส่วนตัวไม่ถูกส่ง ไม่ถูกบันทึก และถูกล้างออกจากฟอร์มทันที เซสชันอยู่ในคุกกี้ HttpOnly · Secure · SameSite=Strict อายุ 15 นาที

ทางเลือก: ใช้ CLI ที่เซ็นเอง
bash · signed GET
# 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

ต่อไป: /dashboard · /referral · /pricing