Auton started as a lightweight tipping miniapp and now ships a Patreon-style, pay-to-access experience on Solana Devnet using the x402 protocol. Creators encrypt any file (video, audio, PDF, zip, text) client-side, choose whether to surface a spoiler, and fans unlock the full drop via a one-time Solana payment. Funds stream straight to the creatorโs walletโno custody, no platform middlemen, and purchases are final on-chain.
- Encrypted paywall drops: Upload any file, encrypt with AES-256-GCM, and store on S3 (or local dev storage) before sharing a pay-to-access link.
- Preview control: Give fans nothing, a short teaser, or a custom preview file. Creators choose โauto snippetโ, โcustom textโ, or โdemo uploadโ.
- Instant wallet payouts: Solana Pay flows send funds directly to each creator. Auton never holds custody and surfaces an explicit โno refundsโ disclaimer.
- x402-first server:
/content/:id/paywallresponds with HTTP402 Payment Required, Solana Pay headers, and unique payment IDs + references. - Short-lived access tokens: After on-chain verification, users receive a JWT-style token and signed asset URL that expires within minutes.
- Wallet Adapter UX: Phantom + Solflare via
@solana/wallet-adapterpower both creator onboarding and buyer checkout, including direct extension checks on desktop. - Legacy tipping mode: Original
/tip/:creatorIdendpoints still exist for simple gratuities or backwards compatibility.
โโโโโโโโโโโโโโโโโโโโโโโ encrypt/upload โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Next.js Frontend โโโโโโโโโโโโโโโโโโโโโโโโถโ Express x402 API โ
โ โ โ โ
โ โข Creator workspace โโโโ gated asset token โโค โข /content CRUD + previews โ
โ โข Content paywall โ โ โข 402 paywall + verification โ
โ โข Wallet Adapter UI โ โ โข AES key custody + JWT โ
โโโโโโโโโโโฌโโโโโโโโโโโโ โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ โ
request txโ โverify tx
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Solana wallets โ โ Storage (S3 or local) โ
โ (Phantom/Solflare) โ โ โข Encrypted blobs โ
โ โข Signs payments โ โ โข Optional preview โ
โ โข Receives access โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Node.js 18+ and npm
- A Solana wallet (Phantom, Solflare, etc.)
- Solana CLI (optional, for wallet generation)
git clone <[repository-url](https://github.com/eshaanmathakari/auton)>
cd autoncd backend
npm installGenerate a platform wallet:
npm run generate-walletThis will create a .env file with your platform wallet address. You'll need to fund this wallet with Devnet SOL:
- Visit https://faucet.solana.com/
- Enter your platform wallet address
- Request Devnet SOL
Create/extend backend/.env with the new paywall parameters:
ACCESS_TOKEN_SECRET=replace-me
PUBLIC_API_BASE=http://localhost:3001
PAYMENT_TTL_MINUTES=10
ACCESS_TOKEN_TTL_SECONDS=300
PLATFORM_FEE_PERCENTAGE=0
# Optional S3 upload path
# S3_BUCKET=your-bucket
# S3_REGION=us-east-1
# AWS_ACCESS_KEY_ID=...
# AWS_SECRET_ACCESS_KEY=...
If S3 variables are omitted (or USE_LOCAL_STORAGE=true), the server writes encrypted blobs to backend/uploads/ (gitignored) so you can demo everything locally.
cd frontend
npm installCreate a .env.local file:
NEXT_PUBLIC_API_URL=http://localhost:3001cd backend
npm run devThe backend will run on http://localhost:3001
cd frontend
npm run devThe frontend will run on http://localhost:3000
- Run both servers and visit
http://localhost:3000. - Connect Phantom/Solflare (or manually paste a payout address). A creator ID is derived from your wallet prefix.
- Fill out the new โEncrypt & publishโ form:
- Upload any file to gate.
- Pick a preview strategy: auto text snippet, custom teaser text, teaser file, or fully gated.
- Set price (SOL for MVP), categories, and whether to allow downloads after unlock.
- Submit. The backend encrypts the payload, stores it, and returns a sharable link:
/content/<contentId>. - Manage all drops from the dashboardโpreview snippet, price badge, stream/download toggle.
- Open a creatorโs share link (
/content/<contentId>). - Review the spoiler/preview and the mandatory โno refundsโ disclaimer.
- Connect a wallet, click โGet payment requestโ to receive the HTTP 402 payload, then approve the SOL transfer.
- After on-chain confirmation, the app returns a short-lived download URL (backed by an HMAC access token). Click โOpen downloadโ to decrypt and fetch the file.
The original /tip/:creatorId and dashboard remain available in case you still want lightweight tipping links beside the premium paywall.
| Method & Path | Description |
|---|---|
POST /content |
Accepts encrypted upload metadata (base64 payload), preview preferences, price, categories, etc. Stores AES-256-GCM ciphertext + preview artifacts. |
GET /content |
Lists every published drop (optionally filtered by ?creatorId=). |
GET /content/:id |
Returns metadata + preview details without exposing encryption keys. |
GET /content/:id/paywall?buyerPubkey=... |
Responds with HTTP 402, Solana Pay headers, and a short-lived payment intent tied to the buyer. |
POST /content/:id/paywall |
Accepts { paymentId, signature, buyerPubkey }, verifies the on-chain transfer, records an access grant, and returns { accessToken, downloadUrl }. |
GET /content/:id/asset?token=... |
Validates the signed token, decrypts the ciphertext, and streams the original file (respecting download/stream settings). |
GET /content/:id/preview-asset |
If a creator uploaded a custom teaser file, this endpoint streams it in the clear. |
All paywall responses include the non-refundable disclaimer so wallets and frontends can surface it before payment.
The previous tipping API is untouched and still works side-by-side with the new paywall:
Returns a 402 Payment Required response with payment parameters.
Query Parameters:
amount(optional): Amount in SOL/USDC (default: 0.1)assetType(optional): 'SOL' or 'USDC' (default: 'SOL')walletAddress(optional): Creator wallet address (if creator not registered)
Response Headers (402):
X-Payment-Required: 'true'X-Payment-Id: Unique payment IDX-Max-Amount: Maximum amount requiredX-Asset-Type: Asset type (SOL/USDC)X-Payment-Address: Recipient wallet addressX-Platform-Fee: Platform fee amountX-Creator-Amount: Amount creator will receiveX-Network: Network (devnet)X-Nonce: Payment nonce
Submit payment transaction for verification.
Request Body:
{
"signature": "transaction_signature",
"paymentId": "payment_id_from_402_response",
"fromAddress": "tipper_wallet_address"
}Response:
{
"success": true,
"message": "Payment verified and tip recorded",
"tip": {
"id": "tip_id",
"amount": "0.1",
"assetType": "SOL",
"signature": "transaction_signature",
"timestamp": "2024-01-01T00:00:00.000Z"
},
"transactionUrl": "https://explorer.solana.com/tx/..."
}Get tip history for a creator.
Response:
{
"creatorId": "creator_id",
"creator": {
"id": "creator_id",
"walletAddress": "wallet_address",
"createdAt": "2024-01-01T00:00:00.000Z"
},
"tips": [...],
"totals": {
"totalSOL": 1.5,
"totalCreatorAmountSOL": 1.44
},
"count": 10
}Creators can embed a tip button on their websites:
<a href="https://your-domain.com/tip/YOUR_CREATOR_ID"
target="_blank"
rel="noopener noreferrer"
style="display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; background: linear-gradient(135deg, #9333ea 0%, #6366f1 100%); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;">
๐ Tip with Auton
</a>See frontend/public/widget-example.html for more examples.
- All transactions are verified on-chain before being recorded
- Payment signatures are validated against Solana blockchain
- Platform wallet private keys should never be committed to version control
- Use environment variables for sensitive configuration
- Start backend (
npm run devin/backend) and frontend (npm run devin/frontend). - Connect Wallet A on the homepage, upload a small text file, and publish it (preview auto or custom).
- Copy the generated link
/content/<id>and open it in an incognito window with Wallet B. - Request the payment instructions, inspect the HTTP 402 headers in DevTools if needed.
- Approve the SOL transfer, wait for confirmation, and click โOpen downloadโ to verify the decrypted file contents.
- Check the backend logs (or
backend/db.json) to confirm the payment intent + access grant records.
- Connect a creator wallet and grab the
/tip/<creatorId>link. - Open it with a second wallet, choose an amount, and submit the transaction.
- Confirm the tip shows up in the historical list as before.
- Create a
vercel.jsonin the backend directory:
{
"version": 2,
"builds": [
{
"src": "server.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "server.js"
}
]
}- Set environment variables in Vercel dashboard
- Deploy:
vercel --prod
- Update
NEXT_PUBLIC_API_URLin.env.localto your backend URL - Deploy:
vercel --prod
auton/
โโโ backend/
โ โโโ routes/
โ โ โโโ tip.js # Legacy tipping endpoint
โ โ โโโ tips.js # Tip history endpoint
โ โ โโโ content.js # Encrypted content + paywall routes
โ โโโ utils/
โ โ โโโ accessToken.js # Short-lived download tokens
โ โ โโโ encryption.js # AES helpers
โ โ โโโ payment.js # Payment verification logic
โ โโโ storage/
โ โ โโโ localStorage.js # Dev-friendly filesystem storage
โ โ โโโ s3Storage.js # Optional AWS S3 adapter
โ โ โโโ storageProvider.js
โ โโโ scripts/
โ โ โโโ generate-wallet.js # Wallet generation script
โ โโโ database.js # Simple JSON database
โ โโโ db.json # Database file
โ โโโ server.js # Express server
โโโ frontend/
โ โโโ app/
โ โ โโโ page.tsx # Creator workspace (upload + catalog)
โ โ โโโ content/
โ โ โ โโโ [contentId]/ # Paywall + unlock flow
โ โ โโโ tip/
โ โ โโโ [creatorId]/ # Legacy tipping page
โ โ โโโ layout.tsx # Root layout with wallet provider
โ โโโ components/
โ โ โโโ WalletContextProvider.tsx
โ โโโ public/
โ โโโ widget-example.html
โโโ README.md
This project was built for the Solana X402 Hackathon. Contributions are welcome!
MIT License
- Solana Foundation for the x402 protocol
- Solana Wallet Adapter team
- OpenLibx402-Core contributors
- USDC token transfer support
- Multi-chain support
- Social login integration
- Automated wallet creation for new users
- Analytics dashboard
- Recurring tips/subscriptions
- NFT gating for premium content