- Introduction
- Project Demo
- Features
- Architecture
- Tech Stack
- Getting Started
- Smart Contract Deployment
- Frontend Setup
- CLI Usage
- Project Structure
- Contributing
- License
- Contact
The Solana Subscription Protocol is a decentralized, trustless recurring payment system built on the Solana Blockchain. It enables users to subscribe to services using a secure, on-chain Pull-Payment Model. Unlike traditional Web2 subscriptions, this protocol ensures that funds are locked in Program Derived Address (PDA) vaults and can only be withdrawn by the provider according to the agreed-upon billing cycle. Users retain full control to cancel their subscriptions at any time, preventing future charges.
Below are screenshots demonstrating the user interface and functionality of the subscription system.
| Dashboard View | Subscription Management |
|---|---|
![]() |
![]() |
| Transaction Details |
|---|
![]() |
- Trustless Vaults: User funds are secured in Program Derived Addresses (PDAs), ensuring no single party has unilateral control.
- Time-Locked Release: Service providers can only withdraw funds after the specific billing period has elapsed.
- User-Controlled Cancellation: Users can cancel subscriptions instantly, stopping all future payments.
- Interactive Dashboard: A modern Next.js interface for wallet connection, subscription tracking, and management.
- Transparent Logic: All payment rules are enforced by immutable on-chain smart contracts.
The system utilizes the Anchor Framework to manage state via three primary account types:
| Account Type | Seed Structure | Description |
|---|---|---|
| PlanAccount | ["plan", owner_pubkey] |
Defines subscription terms, including price and duration. |
| SubscriptionAccount | ["subscription", user, plan] |
Records user status and the next valid billing timestamp. |
| VaultAccount | ["vault", plan_pubkey] |
A secure escrow account holding the subscribed funds. |
- Blockchain: Solana Devnet
- Smart Contract: Rust, Anchor Framework (v0.30+)
- Client SDK: TypeScript, Anchor.js, Web3.js
- Frontend: Next.js (App Router), Tailwind CSS, Framer Motion
- Wallet Integration: Solana Wallet Adapter
You need to have the following tools installed. Follow the instructions for your operating system.
Note for Windows Users: Solana development on Windows is strongly recommended to be done via WSL2 (Windows Subsystem for Linux). Native Windows support is limited.
-
Install WSL2 (Windows Only): Open PowerShell as Administrator and run:
wsl --installRestart your computer if prompted, then launch "Ubuntu" from the Start menu.
-
Rust & Cargo:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Solana CLI:
curl --proto '=https' --tlsv1.2 -sSfL https://solana-install.solana.workers.dev | bash
-
Anchor CLI (via avm):
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force avm install latest avm use latest
-
Node.js & Yarn: Use nvm to install Node.js (v18+).
npm install -g yarn
Run the following command to verify your installation:
rustc --version && solana --version && anchor --version && surfpool --version && node --version && yarn --versionSuccessful Output:
Installed Versions:
Rust: rustc 1.91.1 (ed61e7d7e 2025-11-07)
Solana CLI: solana-cli 3.0.10 (src:96c3a851; feat:3604001754, client:Agave)
Anchor CLI: anchor-cli 0.32.1
Surfpool CLI: surfpool 0.12.0
Node.js: v24.10.0
Yarn: 1.22.1
-
Clone the repository
git clone https://github.com/raushan728/solana-subscription-system.git cd solana-subscription-system -
Install root dependencies
yarn install
-
Install frontend dependencies
cd app npm install cd ..
-
Configure Solana CLI
solana config set --url https://api.devnet.solana.com -
Build the Program
anchor build
-
Deploy to Devnet
anchor deploy
Note: Update the Program ID in
lib.rsandAnchor.tomlafter the initial build.
-
Synchronize IDL Copy the generated IDL file from
target/idl/toapp/app/utils/idl.json. -
Update Configuration Update the
PROGRAM_IDconstant inapp/app/hooks/useSubscription.tswith your deployed Program ID. -
Run Application
cd app npm run devThe application will be available at
http://localhost:3000.
The project includes scripts to simulate the subscription lifecycle via the terminal.
| Command | Description |
|---|---|
anchor run create-plan |
Initializes a new subscription plan on-chain. |
anchor run subscribe |
Subscribes the configured wallet to the plan. |
anchor run trigger-billing |
Attempts to withdraw funds (subject to time-lock). |
anchor run cancel |
Cancels the active subscription immediately. |
solana-subscription-system/
├── programs/
│ └── solana_subscription_system/
│ └── src/lib.rs # Core Smart Contract Logic
├── app/ # Next.js Frontend
│ ├── app/
│ │ ├── components/ # UI Components
│ │ ├── hooks/ # Web3 Logic
│ │ └── page.tsx # Main Dashboard
├── scripts/ # Automation & Testing Scripts
├── tests/ # Integration Tests
└── Anchor.toml # Project Configuration
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Raushan Kumar - LinkedIn
Email: [email protected]


