π Proof-of-Concept Subscription Infrastructure - ICP Timer + Solana Smart Contract
Decentralized recurring payment protocol combining Solana's speed with ICP's autonomous scheduling for truly automated subscriptions.
OuroC is a proof-of-concept implementation of decentralized recurring transactions on Solana, powered by Internet Computer Protocol (ICP) autonomous scheduling.
OuroC-Mesos is the core ICP canister that provides autonomous scheduling for Solana subscriptions. It serves as the bridge between ICP timer logic and Solana smart contracts.
What Mesos Does:
- π€ Autonomous Timer Management - Schedules recurring subscription payments without centralized dependencies
- π Threshold Ed25519 Signing - Uses ICP's Schnorr signature scheme to sign Solana transactions
- π‘ Cross-Chain Communication - Bridges ICP timer logic with Solana smart contracts via HTTP outcalls
- β‘ Opcode Routing - Processes payment (opcode 0) and notification (opcode 1) triggers
- πΎ Subscription State Management - Maintains subscription metadata, execution times, and failure handling
- π Exponential Backoff - Automatically retries failed payments with intelligent backoff strategy
Architecture:
ICP Timer Canister (OuroC-Mesos)
βββ Subscription Manager (creates/pauses/cancels subscriptions)
βββ Timer Module (schedules execution via ic_cdk_timers)
βββ Threshold Ed25519 (signs payment messages with 50B cycles)
βββ Solana RPC Client (HTTP outcalls to Solana devnet/mainnet)
βββ State Management (stable storage for upgrades)
β
Solana Smart Contract (OuroC-Prima)
βββ Process payment (splits merchant/platform fee)
βββ Send notification (1 day before payment for intervals > 1 day)
βββ Delegate authority (PDA pulls USDC from subscriber)
Key Technical Details:
- Delegation Model: Subscribers approve subscription PDA to spend USDC (1 year of payments by default)
- Fee Calculation: Platform takes 2% (200 basis points), merchant receives 98%
- Signature Cost: 50 billion cycles per Schnorr Ed25519 signature (increased from 27B for reliability)
- Cycle Monitoring: Built-in balance checks to prevent signing failures (minimum 100B cycles required)
- Network Support: Solana devnet (active) and mainnet (prepared)
Built on OuroC-Prima: Mesos is the first application built on top of the OuroC-Prima subscription smart contract, demonstrating how the decentralized recurring payment protocol works.
Minimalist Design: Solana = source of truth, ICP = lightweight scheduler
Subscriber β Solana Contract (subscription data + PDA delegation)
β
ICP Timer Canister (autonomous scheduling)
β
Solana Router (opcode 0=payment, 1=notification)
β
Token Processing:
β’ USDC β Direct transfer
β’ Fee split β Merchant (98%) + Platform (2%)
- Config PDA (
["config"]) - Global configuration - Subscription PDA (
["subscription", subscription_id]) - Individual subscription management
Key Innovation: Subscription PDA acts as delegate authority for automated recurring payments.
The delegation amount determines how much USDC the subscription PDA can spend on behalf of the subscriber.
Formula: 12 Months of Payments
export function calculateDelegationAmount(
amountPerPayment: number,
intervalSeconds: number
): number {
// One-time payment
if (intervalSeconds === -1) {
return amountPerPayment;
}
// Estimate number of payments in 12 months
const secondsPerMonth = 30 * 24 * 60 * 60;
const monthsToApprove = 12;
const estimatedPayments = Math.ceil((monthsToApprove * secondsPerMonth) / intervalSeconds);
// Cap between 1-100 payments
const paymentsToApprove = Math.max(1, Math.min(100, estimatedPayments));
return amountPerPayment * paymentsToApprove;
}Formula: One Year of Payments + Buffer
pub fn calculate_one_year_delegation(amount: u64, interval_seconds: i64) -> Result<u64> {
const SECONDS_IN_YEAR: i64 = 365 * 24 * 60 * 60; // 31,536,000 seconds
if interval_seconds == -1 {
return Ok(amount); // One-time payment
}
// Calculate payments per year + 1 buffer for clock drift
let payments_per_year = (SECONDS_IN_YEAR / interval_seconds) as u64;
let total_payments = payments_per_year + 1;
// Total delegation = amount Γ (payments_per_year + 1)
let delegation = amount * total_payments;
// Cap at MAX_APPROVAL_AMOUNT (1M USDC)
Ok(delegation.min(MAX_APPROVAL_AMOUNT))
}| Subscription | Amount | Interval | Delegation |
|---|---|---|---|
| Monthly | 10 USDC | 30 days | 120-130 USDC (1 year) |
| Weekly | 5 USDC | 7 days | 260-265 USDC (1 year) |
| Daily | 1 USDC | 1 day | 100-366 USDC (capped/full year) |
| One-time | 100 USDC | -1 | 100 USDC (exact amount) |
User Experience: Approve once for a full year of payments, balancing convenience with security.
# Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
# Install dfx (ICP SDK)
sh -c "$(curl -fsSL https://internetcomputer.org/install.sh)"
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shcd OuroC-Mesos
# Start local ICP replica
dfx start --background
# Deploy timer canister
dfx deploy timer_rust
# Get canister ID
dfx canister id timer_rustcd solana-contract/ouroc_prima
# Build contract
anchor build
# Deploy to devnet
anchor deploy --provider.cluster devnet
# Get program ID
solana address -k target/deploy/ouroc_prima-keypair.jsoncd OuroC-Mesos/frontend
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your canister ID and program ID
# Run dev server
npm run dev- Timer Canister:
ar3bl-2aaaa-aaaag-auhda-cai(IC mainnet) - Solana Program:
CFEtrptTe5eFXpZtB3hr1VMGuWF9oXguTnUFUaeVgeyT - USDC Mint:
4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU - RPC:
https://api.devnet.solana.com
| Layer | Technology | Purpose |
|---|---|---|
| Blockchain | Solana + Anchor | Payment execution, immutable audit trail |
| Scheduler | ICP (Rust) | Autonomous payment scheduling with Threshold Ed25519 |
| Frontend | React + Vite + Shadcn UI | User interface for subscription management |
| Wallet | Solana Wallet Adapter | Connect Phantom, Solflare, etc. |
- β Ed25519 Signature Verification - ICP β Solana cross-chain signatures
- β Payment Delegation - Users approve max amount + duration, not blank checks
- β Proper PDA Derivation - SHA256-based Program Derived Addresses
- β Pausable - Users can pause/cancel anytime
- β Transparent - All transactions on-chain and auditable
- β Exponential Backoff - Intelligent retry logic for failed payments
- β Cycle Monitoring - Prevents canister from running out of cycles
- SaaS Subscriptions - Monthly/annual billing automation
- Content Platforms - Creator subscription payments
- Developer Tools - API access with tiered pricing
- Research - Demonstrate decentralized scheduling capabilities
- β Core subscription system with USDC support
- β ICP timer integration with Threshold Ed25519
- β Solana smart contract (OuroC-Prima)
- β Basic frontend with Solana wallet integration
- β Delegation amount calculation (1 year of payments)
- β Fee split (98% merchant, 2% platform)
- β Notification system (1 day before payment)
- β Exponential backoff for failed payments
- β Devnet deployment
- π Smart contract audit
- π Mainnet deployment preparation
- π Documentation improvements
- π¦ NPM SDK package
- π€ AI agent payment delegation
- π¦ Enterprise compliance features
- π° Multi-token support (Jupiter DEX)
- π± Mobile application
We welcome contributions! The codebase is organized as follows:
OuroC/
βββ OuroC-Mesos/ # ICP timer canister
β βββ src/timer_rust/ # Rust canister code
β βββ frontend/ # React frontend
βββ solana-contract/ # Solana smart contracts
β βββ ouroc_prima/ # OuroC-Prima subscription contract
βββ Archive/ # Previous implementations (reference only)# Clone repository
git clone https://github.com/yourusername/ouroc.git
cd ouroc
# Install dependencies
npm install
# Run local development
# See Quick Start section aboveMIT License - see LICENSE for details
Built with:
- Solana - High-performance blockchain
- Internet Computer - Decentralized cloud computing with Threshold signatures
- Anchor - Solana smart contract framework
Made with β€οΈ by the OuroC Team
Proof-of-Concept: Decentralized Recurring Transactions on Solana