Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

durcoin

🎡 SoloHost

Single-file PHP media hosting with blockchain-gated subscriptions.
Zero database. Zero dependencies. Zero build step. One PHP file.

License: MIT PHP Single File No Database Waves DURCOIN

Drop one file in any folder. Instantly get a media site with Radio mode, Cinema mode, crypto subscriptions, and 10 languages. That's it.

πŸ‘‰ Live demo: djdurcoin.ru


✨ What it does

  • πŸ“ Drop-in deployment β€” single index.php file, no composer install, no npm, no database, no cron
  • 🎡 Smart media player β€” Radio mode (continuous audio shuffle) and Cinema mode (video playlist)
  • πŸ”€ Shuffle & repeat β€” server-side persistent order, client-side repeat
  • πŸ”— Shareable playlists β€” URLs that auto-start playback at any track
  • πŸ”’ Crypto-gated access β€” Waves blockchain subscriptions via DURCOIN token
  • 🦊 Keeper Wallet integration β€” one-click sign-in + on-chain payment
  • 🌍 10 languages β€” English, Русский, δΈ­ζ–‡, EspaΓ±ol, FranΓ§ais, Deutsch, ζ—₯本θͺž, ν•œκ΅­μ–΄, PortuguΓͺs, Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ© (RTL supported)
  • 🎨 Dark + minimalist light theme β€” monochrome grayscale for light mode
  • πŸ“± Mobile-first β€” compact row layout on phones, grid on desktop
  • ⚑ Scales to 500K+ files β€” JSON index cache (1h TTL), paginated API, infinite scroll
  • 🎧 HTML5 streaming β€” byte-range requests, MediaSession API, lock-screen controls
  • πŸ” Ed25519 verification β€” proper Curve25519β†’Ed25519 conversion for Waves signatures

πŸš€ Quick Start (60 seconds)

1. Download

curl -O [http://github.com/vekuz/durcoin/tree/main]

2. Configure

Open index.php, edit the top section:

$SITE_TITLE              = 'My Media Hub';
$SITE_DESCRIPTION        = 'My songs, paid via DURCOIN';
$WAVES_SYSTEM_ADDRESS    = 'YOUR_WAVES_ADDRESS_HERE';
$WAVES_MIN_AMOUNT        = 10.00;   // DURCOIN per subscription
$WAVES_SUBSCRIPTION_DAYS = 1;       // access duration

3. Drop your files

my-site/
β”œβ”€β”€ index.php       ← the only file you need
β”œβ”€β”€ song1.mp3
β”œβ”€β”€ video.mp4
β”œβ”€β”€ photo.jpg
└── document.pdf

4. Upload to any PHP host

# Any cheap shared hosting works. Or locally:
php -S localhost:8000

Done. Visit https://your-domain.com/ β€” your media site is live. Earnings go directly to your Waves wallet.


πŸ“‹ Requirements

  • PHP 7.4+ with:
    • ext-sodium β€” Ed25519 verification
    • ext-gmp β€” Curve25519 math
    • ext-curl (optional β€” falls back to file_get_contents)
  • Write permission for _index.cache.json
  • Any web server β€” Apache, nginx, Caddy, built-in PHP server

That's the entire dependency tree.


🎯 Philosophy: Token-Powered, Fork-Friendly

This project is a gift to the DURCOIN + Waves ecosystem. It exists to make it trivial for anyone to monetize their media collection using DURCOIN as the payment layer.

What we want you to do βœ…

  • Host your own media β€” drop index.php in any folder with your MP3s/MP4s
  • Deploy on your domain β€” one file, deploy anywhere
  • Customize look & feel β€” change colors, titles, default language
  • Keep the DURCOIN payment layer β€” all subscription $$$ go to your wallet, we don't touch it
  • Scale your content business β€” no Stripe, no PayPal, no chargebacks

What we kindly ask you not to do ⚠️

Please don't fork this specifically to swap DURCOIN for another token.

It's legal under MIT β€” we can't stop you β€” but it defeats the purpose. The obfuscated _core_*() functions in the code are a gentle signal: "the author intends this for DURCOIN."

If you genuinely need a different blockchain or token, please:

  • ✍️ Rewrite your own implementation from scratch
  • πŸ“– Use this codebase as a design reference, not a template
  • πŸ€– Use the AI prompt below to bootstrap your own version faster

πŸ€– Fork-With-AI Prompt

Need a different blockchain entirely? Feed this to Claude / GPT-4 along with index.php:

"Here is a reference single-file PHP media hosting implementation with Waves blockchain + DURCOIN token subscriptions. I want to build a similar system for [YOUR_CHAIN] with [YOUR_TOKEN]. Preserve these features: file indexing with JSON cache, Radio/Cinema playback modes, shareable playlist URLs, dark/light themes, i18n with 10 languages, pagination with infinite scroll, HTTP byte-range streaming. Replace the blockchain layer entirely β€” don't adapt the Waves code, rewrite it. Keep everything in a single PHP file with zero dependencies."

This produces cleaner results than patching our code and keeps the DURCOIN ecosystem intact. Win-win.

Why this model?

We believe open code + token economics > paywalled code.

  • You get a free, working tool β€” no subscription to us, no backend lock-in
  • We get token utility growth β€” every new site increases DURCOIN demand
  • The entire ecosystem benefits from the network effects

This is not altruism. This is aligned incentives.


πŸ” Full Transparency

The code contains one intentionally obfuscated section β€” three functions that hex-encode:

  • The DURCOIN token asset ID on Waves blockchain
  • Token decimals
  • Waves public node URL

What it is: pack('H*', 'hexstring') encoding. One line to decode.
What it's NOT: encryption, DRM, or license enforcement.

Why obfuscated? It's a friction signal, not a lock. It makes "use as-is with DURCOIN" the path of least resistance while letting anyone who reads the code understand what they're using.

How to decode:

php -r "echo pack('H*', '4631486F414C79...') . PHP_EOL;"

How to replace with your own values (if you're writing a fork for your token):

function _core_asset_id()       { return 'YOUR_ASSET_ID'; }
function _core_asset_decimals() { return 8; }
function _core_node()           { return 'https://your-node.example.com'; }

That's it. MIT allows this. We just ask you consider writing your own implementation instead β€” see the Philosophy section above.


🎨 Screenshots

Desktop Dark Mobile Light
Media grid with subscription gating Minimalist monochrome row layout

(Add your screenshots to docs/screenshots/ and link them here.)


πŸ’‘ How It Works

File handling

Every file in the same folder as index.php is served. Categories auto-detected by extension:

Category Extensions
🎡 Audio mp3, wav, ogg, flac, m4a, aac, opus, wma
🎬 Video mp4, webm, mov, mkv, avi, m4v, 3gp, flv
πŸ–Ό Images jpg, jpeg, png, gif, webp, svg, bmp, avif, ico, tiff
πŸ“„ Documents pdf, doc, docx, xls, xlsx, ppt, pptx, txt, rtf, odt, md, csv
πŸ“¦ Archives zip, rar, 7z, tar, gz, bz2, xz

Subscription model

Action Free? Subscriber-only?
🎡 Radio mode (audio continuous play) βœ… β€”
🎬 Cinema mode (video playlist) βœ… β€”
πŸ”— Share playlist URLs βœ… β€”
πŸ–Ό Preview images on cards β€” πŸ”’
πŸ“„ Open/download individual files β€” πŸ”’

This creates organic "try before you buy" funnel. Visitors enjoy Radio/Cinema free, then pay to unlock direct file access.

Index cache

On first request, the script scans the folder and caches file metadata into _index.cache.json. Subsequent requests read this JSON instead of opendir()-ing thousands of files. Cache rebuilds every 1 hour or on-demand via "Shuffle again" button.

This is what lets one PHP file handle hundreds of thousands of media files without slowing down.


πŸ”§ Configuration Reference

Setting Default Description
$SITE_TITLE (your title) Page title and header
$SITE_DESCRIPTION (your subtitle) Header subtitle
$DEFAULT_THEME 'dark' 'dark' or 'light'
$DEFAULT_LANG 'en' Default language code
$WAVES_SYSTEM_ADDRESS β€” Your Waves wallet for payments
$WAVES_MIN_AMOUNT 10.00 Minimum subscription payment (in DURCOIN)
$WAVES_SUBSCRIPTION_DAYS 1 Subscription duration
$INDEX_CACHE_TTL 3600 Cache TTL in seconds
$PAGE_SIZE 60 Cards per infinite-scroll page
$MAX_SHARE_LIST_SIZE 300 Max files in share URL

🌐 API Endpoints

All AJAX via ?action=<name>:

Endpoint Method Purpose
?action=list&tab=all&search=&page=1 GET Paginated file list
?action=playlist&cat=audio GET Full playlist for Radio/Cinema
?action=names&tab=audio GET Filtered names for sharing
?action=reshuffle GET Re-randomize index
?action=nonce GET Get session auth nonce
?action=keeperAuth POST Verify Keeper signature
?action=checkPayment GET Poll blockchain for payment
?stream=file.mp3 GET Audio/video stream (public)
?open=file.jpg GET Direct file (subscribers)
?download=file.pdf GET Force download (subscribers)

πŸ”— Shareable URLs

Generate auto-playing playlist links:

https://your.site/#play=audio&list=song1.mp3|song2.mp3&from=song1.mp3
https://your.site/#play=video&search=tutorial

URL fragments (#) keep params client-side β€” no server logs of what people share.


🎯 Use Cases

  • 🎸 Musicians β€” sell access to demos, unreleased tracks, stems
  • 🎬 Video creators β€” monetize archive content without YouTube's cut
  • 🎀 Podcasters β€” subscriber-only episodes with no Patreon fees
  • πŸ“Έ Photographers β€” high-res image packs with instant access
  • πŸ“š Researchers β€” paywalled PDF collections
  • 🎨 Anyone with a folder of files wanting to sell access simply

πŸ” Security

  • βœ… All file access via resolveFile() β€” can't escape directory, can't access dotfiles
  • βœ… Sessions use session_regenerate_id(true) on auth success
  • βœ… Ed25519 signatures verified server-side via sodium_crypto_sign_verify_detached
  • βœ… Waves addresses validated by regex + on-chain public-key lookup
  • βœ… Minimal external resources (only QR code generator)

Not included (by design β€” single-file constraint):

  • ❌ Rate limiting β†’ use nginx limit_req or Cloudflare
  • ❌ HTTPS β†’ use reverse proxy or Cloudflare Tunnel
  • ❌ File upload β†’ SFTP/rsync your files manually

πŸ“– Why Waves Blockchain?

Feature Waves Traditional (Stripe/PayPal)
Transaction fee ~$0.01 2.9% + $0.30
Chargeback risk None High
Geographic restrictions None Many countries excluded
Settlement time ~1 minute 2-7 days
Micropayments βœ… Viable ❌ Fees eat profits
Custom tokens βœ… Any asset ❌ USD only

🀝 Contributing

This is a deliberately minimal project. The whole philosophy is "one file, zero dependencies, zero tooling."

Welcome PRs:

  • βœ… Features that don't add dependencies
  • βœ… i18n translations / language improvements
  • βœ… Security fixes
  • βœ… Performance optimizations
  • βœ… Bug fixes

Not welcome:

  • ❌ Framework refactors (Laravel / Symfony / etc.)
  • ❌ Build steps (webpack / TypeScript / SASS)
  • ❌ Database integrations (SQLite / MySQL / PostgreSQL)
  • ❌ Forks that strip DURCOIN β€” please rewrite from scratch instead (see Philosophy)

πŸ“œ License

MIT License β€” see LICENSE file.

The license imposes no restrictions on forking with different tokens. The request in "Philosophy" section is a social norm, not a legal requirement. We trust the community to respect the ecosystem that gave them the tool.


πŸ™ Built On

  • Waves Blockchain β€” payment settlement layer
  • Waves Keeper β€” browser wallet extension
  • Native browser APIs β€” MediaSession, IntersectionObserver, Clipboard
  • QR codes by goqr.me

πŸ’¬ Support

  • ⭐ Star this repo β€” helps visibility
  • 🐦 Share on social β€” tag #DURCOIN and #Waves
  • πŸ’° Hold some DURCOIN β€” be part of the ecosystem
  • 🏠 Deploy a site β€” use it, send me the URL, I'll feature it

Author's reference deployment: djdurcoin.ru
Author's wallet: 3P95dfoJHC6dP6GaeCYGEMRYg7o4UAXE1w6


Built because I got tired of Plex, Jellyfin, and "just use S3+CloudFront." Sometimes you just need one file that works.

About

Single-file PHP media hosting with blockchain-gated subscriptions

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages