peertube-plugin-nano-payments
v1.0.0
Published
Accept Nano (XNO) cryptocurrency payments for premium video content
Downloads
5
Maintainers
Readme
PeerTube Nano Payments Plugin
A PeerTube plugin that enables content creators to monetize their videos using Nano (XNO) cryptocurrency. Viewers can pay with Nano to access premium content.
Features
- Premium Videos: Content creators can mark videos as premium and set a price in XNO
- Nano Payments: Secure, fast, and feeless payments using Nano cryptocurrency
- Access Control: Automatic video access control based on payment status
- Admin Dashboard: Statistics and payment management for administrators
- Real-time Verification: Automatic payment verification and access granting
Installation
Install the plugin on your PeerTube instance:
npm install peertube-plugin-nano-paymentsConfigure the plugin in your PeerTube admin panel:
- Go to Administration → Plugins → peertube-plugin-nano-payments
- Set your Nano node RPC URL (default: https://proxy.nanos.cc/proxy)
- Configure your wallet seed for payment address generation
- Set payment timeout (default: 10 minutes)
Usage
For Content Creators
- Upload or edit a video
- Check "Make this a premium video" in the video edit form
- Set the price in XNO (default: 0.1 XNO)
- Save the video - it will now require payment to watch
For Viewers
- Visit a premium video - you'll see a payment overlay
- Click "Pay with Nano" to generate a payment address
- Send the exact amount of XNO to the provided address
- Wait for confirmation - access will be granted automatically
For Administrators
View statistics in the plugin admin panel:
- Number of premium videos
- Total payments received
- Revenue in XNO
- Pending payments
Export payment data as CSV for accounting purposes
Configuration
The plugin requires the following settings:
| Setting | Description | Default | |---------|-------------|---------| | Nano Node RPC URL | Endpoint for Nano network communication | https://proxy.nanos.cc/proxy | | Nano Wallet Seed | Private seed for generating payment addresses | (required) | | Payment Timeout | How long to wait for payment confirmation | 10 minutes |
API Endpoints
The plugin exposes several API endpoints:
POST /plugins/nano-payments/api/generate-payment- Generate payment addressGET /plugins/nano-payments/api/check-payment/:paymentId- Check payment statusPOST /plugins/nano-payments/api/set-premium- Mark video as premiumGET /plugins/nano-payments/api/admin/stats- Get payment statistics (admin only)GET /plugins/nano-payments/api/admin/export-payments- Export payments CSV (admin only)
Development
Building the Plugin
# Install dependencies
npm install
# Build TypeScript files
npm run build
# Development mode (watch for changes)
npm run devFile Structure
src/
├── main.ts # Main server-side plugin logic
├── client/
│ ├── common-client-plugin.ts # Common client-side functionality
│ ├── video-watch-client-plugin.ts # Video watching page logic
│ ├── video-edit-client-plugin.ts # Video editing page logic
│ └── admin-plugin-client-plugin.ts # Admin panel enhancements
assets/
├── style.css # Plugin styles
languages/
├── en.json # English translationsSecurity Considerations
- Private Keys: Store wallet seeds securely and never expose them
- Payment Verification: The plugin verifies payments through the Nano network
- Access Control: Video access is controlled server-side for security
- Data Storage: Payment data is stored in PeerTube's plugin storage system
Nano Integration
This plugin integrates with the Nano cryptocurrency network to provide:
- Fast Transactions: Near-instant payment confirmation
- Feeless: No transaction fees for users
- Environmentally Friendly: Energy-efficient consensus mechanism
- Decentralized: No reliance on traditional payment processors
Troubleshooting
Common Issues
- Payment not detected: Check Nano node connectivity and wallet configuration
- Video access denied: Ensure payment was sent to the correct address with exact amount
- Plugin not loading: Verify all files are built and TypeScript compilation succeeded
Debug Mode
Enable debug logging in your PeerTube configuration to see detailed plugin logs.
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
For support and questions:
- Create an issue on GitHub
- Join the PeerTube community discussions
- Contact the plugin developer
Note: This plugin requires PeerTube 5.0.0 or higher and a properly configured Nano node for payment verification.
