Bitcoin Forum
August 22, 2026, 12:22:12 AM *
News: Latest Bitcoin Core release: 31.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: TURNLEY.DEV - Code Snippets For Crypto Creators  (Read 12 times)
strugmo (OP)
Newbie
*
Offline

Activity: 59
Merit: 0


View Profile
August 21, 2026, 09:02:45 AM
 #1

If you create faucets or other crypto sites, check out https://Turnley.Dev -

An indispensable list of tools, calculators, common routines and snippets to assist in building your next faucet or crypto site. Payments, security, FaucetPay, ads & traffic, fraud prevention and more. All free, and all tested in the real world on multiple sites.

Tools & Calculators:
Satoshi & Coin Converter
Faucet Profitability Calculator
Reward Table Designer
Cooldown & Daily Budget Planner
Crypto Address Validator
Cron Expression Explainer
htaccess Rule Generator
Meta & OpenGraph Tag Generator
Hash & HMAC Playground
Password Hash Tester

Snippets & Code Blocks:
1. FaucetPay
Send a payout — v1 API (/api/v1/send, form POST) 
Send a payout — v2 API (JSON, Bearer auth, mandatory idempotency_key)
Check FaucetPay balance before paying
Verify a wallet address is a registered FaucetPay user (checkaddress)
List supported currencies / get payout limits
USD → satoshi conversion helper (units_per_coin, usd_per_coin) 
Merchant checkout — auto-submitting POST to /merchant/webscr
IPN receiver with server-side verification — GET /merchant/get-payment/{token} (path param, not query string) 
Idempotent deposit crediting via custom key
Payout queue: hold on request, mark paid, refund on reject
Auto-payout with manual-queue fallback on API failure
Retry with exponential backoff on API timeout
Micro-payout batching (accumulate to threshold, pay once)
Payout error-code reference and what each one actually means

2. Other Payment Rails
CoinPayments IPN handler with HMAC verification
NOWPayments invoice + callback
Coinbase Commerce charge + webhook signature check
Direct node RPC: sendtoaddress via JSON-RPC (bitcoind/litecoind/dogecoind)
Watch-only deposit addresses from an xpub (BIP32 derivation)
ERC-20 / BEP-20 token transfer via JSON-RPC
TRON TRC-20 transfer + fee estimate
Gas / fee estimation before send
Address validation: base58check 
Address validation: bech32 / bech32m 
Address validation: EVM checksum (EIP-55) 
Detect coin type from an address format
QR code generation for a wallet address, no external service 

3. Price Feeds & Conversion
CoinGecko price fetch with file cache
Multi-source median price (guard against one bad feed)
Stale-price guard — refuse to pay if the feed is old
Satoshi ↔ USD ↔ coin conversion table 
Dynamic claim reward recalculated from live price
Fixed-USD payouts on a volatile coin without draining the faucet

4. Faucet Core Mechanics
Server-authoritative claim cooldown (never trust the client clock)
Atomic claim handler — credit balance inside a transaction 
Weighted random reward table (prize tiers with configurable odds)
Streak / consecutive-day bonus
Daily bonus separate from the claim timer
Loyalty level multiplier by claim count
Faucet balance guard — scale rewards down as the wallet drains
Mining / idle accumulation with a capacity cap
Fuel-gated accrual (earn actions to keep the miner running)
Internal integer credit economy with admin-set credit→coin rate
Countdown timer display that survives a page refresh
"Next claim" time formatting across timezones
Claim history table with pagination

5. Anti-Bot & Anti-Fraud
Cloudflare Turnstile server-side verify (fails closed) 
hCaptcha verify
reCAPTCHA v3 score gating
Honeypot field that bots fill and humans don't
Real client IP behind a proxy — ignore spoofable X-Forwarded-For unless trusted 
Sliding-window rate limiter (per IP, per account, per token) 
VPN / proxy / datacenter IP detection (IPHub, ProxyCheck, IP2Proxy)
Multi-account detection by IP + user-agent clustering
Browser fingerprint hash (cookieless visitor key)
Disposable / temp email domain blocklist
Email verification flow with expiring token
Bot user-agent detection (withhold earnings, never content)
Timing analysis — flag claims that are too fast to be human
Duplicate wallet address across accounts
Self-referral and circular-referral blocking
Ad-block detection with a gentle notice
Proof-of-render impression beacon — HMAC nonce bound to IP+UA 
Per-visitor daily earning governor (once per creative per day)
Minimum dwell enforcement that a script can't POST past
Suspicious-activity admin view (top earners, key concentration, signup velocity)
Shadow-ban instead of hard ban (bot keeps working, earns nothing)

6. Ads, Traffic & Offerwalls
Banner rotation and serving script with fill fallback
Fluid iframe banner embed that scales on mobile 
Popunder that opens behind the page — the swap technique 
Popunder frequency cap per visitor
Impression + click tracking with dedupe
Shortlink API client against the xut.io contract 
Multi-provider shortlink rotation with failover
Shortlink postback receiver with token verification
Per-user daily shortlink limits
PTC offer runner: open, timer, claim, credit
Offerwall postback handler — signature check + idempotency 
Chargeback / reversal handling on an offerwall postback
Surf engine: cycle a visitor through N destinations with dwell
Traffic exchange credit math (send N, receive M)
Site ownership verification via a <head> meta tag 
Referer-origin gating that limits earning without blocking content
Ad-slot manager with sponsor → network → house fallback chain

7. Accounts, Auth & Security
Registration with password_hash / password_verify done right
Login throttle by IP and by account
Session hardening: HttpOnly, Secure, SameSite, regeneration 
CSRF token generation and validation
Password reset with a single-use expiring token
TOTP 2FA without a library (RFC 6238 in plain PHP)
Remember-me token with rotation on use
Admin role gating and privilege checks
Account suspension / reactivation
Login and admin-action audit log
Security headers: CSP, nosniff, HSTS, frame options — and which pages to exempt 
SSRF-guarded outbound fetch (block private ranges, verify TLS, no redirects) 
Prepared statements everywhere — the PDO wrapper pattern
File upload validation for avatars and banners

8. Referrals
Referral code generation (collision-safe, readable)
Cookie attribution with a configurable window
Commission on claim, on deposit, and on earnings — three models compared
Referral commission ledger entries
Referral leaderboard with reset
Fake / inactive referral filtering
Referral link with pre-filled signup

9. Money & Ledger Integrity
Integer-only balance math — why floats destroy a faucet
Double-entry ledger table design
Atomic transfer with SELECT ... FOR UPDATE 
Withdrawal request → hold → paid/refund state machine
Idempotency keys on every money operation
Negative-balance guard and clawback adjustments
Daily reconciliation report (ledger vs balances vs wallet)
Minimum withdrawal and fee handling, config-driven

10. Admin & Operations
Settings table with typed get/set and in-request cache 
Migration runner — numbered, idempotent, run-before-upload 
Read-only demo mode over real data with full masking 
Cron runner with a lock file (no overlapping runs)
Cron on shared hosting via HTTP with a secret key 
mysqldump backup with rotation and off-site copy
Error logging to the database with an admin viewer
Maintenance mode with an admin bypass
Config file that never ships in a release zip
Member CRUD with balance adjustment, logged
Bulk email / announcement to all users

11. Stats & Reporting
Zero-filled date-series query layer 
Server-rendered SVG line chart — no JS, no CDN 
Server-rendered SVG bar chart
Server-rendered SVG donut chart
Colorblind-safe palette for dark dashboards
Unique visitor counting without cookies
Traffic source split — organic vs exchange vs referral
Retention cohort query (day-1 / day-7 return rate)
Funnel: visit → signup → first claim → first withdrawal

12. SEO & Frontend Plumbing
Meta / OpenGraph / Twitter head builder with per-page overrides 
Dynamic robots.txt and sitemap.xml that emit the install's real domain 
Canonical URL handling
Clean URL rewrites in .htaccess 
Cache-busted CSS by filemtime
SVG favicon in every head
Custom 404 that keeps the user on site
Responsive nav that folds into a hamburger below 760px
Countdown / progress bar in CSS only

13. Notifications
SMTP send without a library
Transactional email templates (verify, reset, payout sent)
Telegram bot notification for admin alerts
Discord webhook notification
Anomaly alert — fire when payouts spike or a wallet runs low

14. Engagement & Content
News / announcement system with pinning
Leaderboard with scheduled seasonal reset
Achievements / badges
Dynamic daily task list with a progress bar
Provably-fair lottery draw (seed + hash, verifiable)
Shoutbox with rate limiting and moderation
Contest runner with automatic prize distribution

15. Legal & Compliance
TOS / Privacy / FAQ page scaffolds for a faucet
Cookie consent banner, no third-party script
GDPR data export and account deletion
Country blocking by GeoIP
Age gate


Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!