Technical Docs
🧩 Overview
Link402 is a decentralized paywall infrastructure built on BNB CHAIN, powered by the x402 protocol — a framework for programmable payments between users and AI agents.
It enables:
Instant BNB-based paywalled content delivery
Autonomous AI-agent payments and rebilling
Encrypted content access tied to on-chain transactions
Real-time analytics and webhook integration for developers
🔶 Architecture Overview
Core components:
Frontend (Link402 App)
Built with Next.js + TailwindCSS
API interaction with Link402 backend via REST
Backend (Link402 Core)
Node.js + Express-based middleware
Handles link creation, encryption, payment validation, and webhook triggers
Smart Contract Layer
On-chain payment verification
Emits transaction receipts to off-chain webhook processors
x402 Engine
Handles “Agent <-> Paywall” logic
Enables autonomous transactions where agents can:
Create links
Purchase content
Rebuy or renew access
🧠 x402 Protocol Explained
x402 is Link402’s internal standard for paywall communication between:
Human users (buyers)
AI agents (automated buyers)
Webhooks or smart contracts (verifiers)
It defines how a paywalled resource is priced, bought, and verified using BNBtransaction metadata.
🧩 Data Model
🔄 Data Flow Diagrams
1️⃣ Human Payment Flow
Steps:
User selects paywalled content
Link402 backend generates a
link_idand awaits BNB transactionWallet signs and sends BNB → Smart contract verifies receipt
Backend confirms payment → Generates encrypted access token
Redirects user to
target_url
2️⃣ Agent Integration Flow (x402)
Agent posts JSON payload to
/api/agent/create-linkBackend authenticates via
x-agent-api-keyTransaction initiated and confirmed on-chain
Webhook triggers → Response contains status + purchase receipt
Agent consumes unlocked data (or rebuys if allowed)
3️⃣ Analytics Flow
Tracks:
views,clicks,conversionsTransaction count and average order value
Agent rebuy frequency
Stack:
Supabase / PostgreSQL + Prisma + Next.js
🔐 Security & Validation
All payments validated via on-chain BNB transactions
Webhook payloads signed with HMAC-SHA256
Access URLs are time-bound and AES-encrypted
Agents require API key rotation every 30 days
🧰 Developer Guide
Create a Link (API)
Verify Payment (Webhook)
Webhook payload structure:
🧬 Future Expansion
x402 v2: On-chain NFT token access
Token-gated paywalls (based on SPL holdings)
Cross-agent billing network for shared data models
Linkchain analytics SDK for 3rd-party platforms
📊 Example Agent Workflow
Last updated

