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

