A decentralized content monetization platform that allows authors to publish articles on Walrus storage and monetize them through x402 payment protocol.
- Decentralized Storage: Articles stored on Walrus (Sui blockchain)
- Content Encryption: AES-256 encryption for secure content storage
- Payment Integration: x402 protocol for seamless crypto payments
- Preview System: Users can preview content before purchasing
- ENS Integration: Support for Ethereum Name Service (ENS) names
- Modern UI: Clean, responsive interface built with Next.js and Tailwind CSS
- Next.js 14 with App Router
- TypeScript for type safety
- Tailwind CSS for styling
- shadcn/ui components
- Wagmi for wallet integration
- x402-fetch for payment handling
- Express.js REST API
- Walrus Client for decentralized storage
- AES-256 content encryption
- x402-express payment middleware
- Sui blockchain integration
- Node.js 18+
- npm or yarn
- Sui wallet with testnet WAL tokens
- Ethereum wallet (for ENS support)
-
Clone the repository
git clone <repository-url> cd mediearn
-
Install dependencies
# Frontend cd frontend npm install # Backend cd ../server npm install
-
Environment Setup
Create
.envfile in/server:PORT=8000 SUI_PRIVATE_KEY=your_sui_private_key SUI_PUBLIC_KEY=your_sui_public_key AES_SECRET=your_32_byte_hex_secret RESOURCE_WALLET_ADDRESS=your_receiving_wallet_address
-
Start the development servers
# Terminal 1 - Backend cd server npm start # Terminal 2 - Frontend cd frontend npm run dev
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- Connect Wallet: Connect your Ethereum wallet
- Upload Article:
- Go to
/upload - Enter title, description, and content
- Upload to Walrus storage
- Go to
- Monetize: Set price (default: $0.01 USDC)
- Browse Articles: View available articles on homepage
- Preview Content: Click article to see preview
- Purchase Access: Pay with crypto to read full content
- Read Article: Access full content after payment
GET /api/health- Health checkGET /api/blobs/preview- List all article previewsGET /api/blobs/:id/preview- Get article preview (no payment)
GET /api/blobs/:id/content- Get full article content (requires payment)DELETE /api/blobs/:id- Delete article (owner only)
POST /api/upload- Upload new article
- Preview: Users see article preview without payment
- Payment: x402 protocol handles crypto payment
- Access: Full content unlocked after successful payment
- Storage: Content stored securely on Walrus with encryption
- Content Encryption: AES-256 encryption for all stored content
- Payment Verification: x402 middleware validates payments
- Access Control: Only paid users can access full content
- Wallet Integration: Secure wallet connection via Wagmi
- Sui Testnet: For Walrus storage
- Base Sepolia: For x402 payments (testnet)
- Ethereum Mainnet: For ENS name resolution
mediearn/
โโโ frontend/ # Next.js frontend
โ โโโ src/
โ โ โโโ app/ # App router pages
โ โ โโโ components/ # React components
โ โ โโโ lib/ # Utilities and API client
โโโ server/ # Express.js backend
โ โโโ src/
โ โ โโโ server.ts # Main server file
โ โ โโโ blobStorage.ts # Storage management
โโโ README.md
Frontend:
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- shadcn/ui
- Wagmi (Web3)
- x402-fetch
Backend:
- Express.js
- TypeScript
- Walrus Client
- x402-express
- AES encryption
Articles are stored in the following format:
Title
Description
Content Preview (first 200 characters)
Visit /debug to:
- Check localStorage status
- Test content store
- Verify navigation
- View browser information
The server provides detailed logging for:
- Preview content processing
- Payment verification
- Walrus operations
- Error handling
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the debug page (
/debug) - Review server logs
- Open an issue on GitHub
- Support for multiple payment tokens
- Content categories and tags
- Author profiles and reputation
- Social features (likes, comments)
- Mobile app
- Advanced search and filtering
- Subscription models
- Content recommendations
Built with โค๏ธ for the decentralized web