Skip to content
Subchain

Subchain

Decentralized Subscription Payment System

Created on 17th January 2026

•

Subchain

Subchain

Decentralized Subscription Payment System

The problem Subchain solves

What Problem It Solves

The Problem

Traditional subscription systems force users to trust companies with sensitive payment data, creating security risks through centralized data storage. Companies can arbitrarily change prices, ban users without recourse, and manipulate subscriber metrics with no independent verification possible. Payment processors extract high fees (2.9% + $0.30 per transaction) while excluding billions globally through geographic restrictions. Users have zero control over their subscriptions and no transparency into how systems operate.


Our Solution

We built a fully decentralized subscription platform on Ethereum blockchain where users pay directly from their crypto wallets.

Smart Contract Architecture: Deployed on Ethereum Sepolia testnet, our Solidity contract enforces immutable subscription logic—0.001 ETH for 30 days with automatic expiry tracking. Every payment is a blockchain transaction creating permanent, tamper-proof records. The contract emits events (Subscribed, Cancelled) for real-time monitoring and handles all business logic autonomously.

Web3 Integration: Frontend connects directly to Ethereum via ethers.js and MetaMask. Users approve transactions in their wallet—payments go straight to the contract address, bypassing traditional payment infrastructure entirely. No intermediaries, no stored credentials, no payment processors.

Read-Only Backend API: Built a Python Flask REST API using web3.py that queries smart contract view functions (isActive, getExpiry, totalSubscribers) and returns JSON responses. Critically, the backend holds no private keys and cannot send transactions—purely read-only for security.

Transparency: All data lives on-chain and is publicly verifiable through Etherscan. Anyone can audit subscriber counts, total revenue, and transaction history. No databases to manipulate, no admin panels—mathematical proof replaces corporate trust.

Global Infrastructure: Runs on Ethereum's decentralized network of thousands of nodes worldwide. No single point of failure. Deployed frontend on Vercel's global CDN for fast access anywhere.


Technical Implementation

Smart Contract (Solidity)

  • Gas-optimized storage using mappings for O(1) lookups
  • Custom error handling reducing gas costs
  • Event emission for off-chain indexing
  • View functions for zero-cost data queries
  • Immutable constants preventing price manipulation

Backend (Python + Flask + Web3.py)

  • Blockchain service layer abstracting Web3 complexity
  • RESTful API with comprehensive error handling
  • Environment-based configuration (Infura RPC URLs never exposed)
  • Checksum address validation preventing transaction errors
  • Stateless design enabling horizontal scalability

Frontend (HTML/JavaScript + ethers.js)

  • MetaMask wallet integration with automatic network detection
  • Multiple RPC fallback logic for reliability
  • Real-time subscription status updates
  • Transaction lifecycle management (pending, confirmed, failed)
  • Responsive UI with loading states

Security & DevOps

  • Zero private key storage anywhere in stack
  • All transactions require explicit MetaMask approval
  • Git-based version control with .gitignore for sensitive data
  • Vercel deployment with automatic GitHub CI/CD
  • Read-only backend (cannot initiate transactions)

Who Benefits

Content Creators: Receive 100% of payments directly to wallets. No platform fees, no payment holds, complete subscriber relationship ownership.

Global Users: Access from anywhere with just a crypto wallet. No banking requirements, no geographic restrictions, no KYC friction.

SaaS Businesses: Eliminate payment processing fees, chargeback fraud, and billing database maintenance. Smart contracts handle subscription logic automatically.

Privacy-Focused Users: Transact pseudonymously using wallet addresses. No personal data collection, no advertising profiles, no surveillance.

Decentralized Communities: Token-gated membership with on-chain verification. Composable with other smart contracts and services.


Challenges we ran into

First big problem was transactions getting stuck , we'd click subscribe in Remix and it would just sit there saying "pending" forever. Took us a while to figure out

MetaMask was holding things up .
The Web3 kept getting "ethers is not defined" errors because the script wasn't loading properly. We tried different CDN links until one finally worked.

Then connecting to Sepolia was unreliable. The public RPC nodes would randomly fail or timeout, so our stats wouldn't load. We ended up trying multiple fallback options and eventually just signed up for Infura to get a stable connection.

Managing multiple test accounts was harder than expected. We wanted to show multiple subscribers but kept running into "insufficient funds" errors when trying to send ETH between accounts. Gas fees were eating up more than we thought.

Tracks Applied (1)

Blockchain

Smart Contract Implementation Written in Solidity (blockchain programming language) Deployed contract at verified addres...Read More

Discussion

Builders also viewed

See more projects on Devfolio