Skip to content

Enterprise-grade blockchain payment infrastructure with fiat-backed stablecoin Velo Cash for secure, compliant digital transactions

Notifications You must be signed in to change notification settings

ChronoCoders/velopay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VeloPay - Blockchain Payment System

VeloPay Substrate Rust License

VeloPay is a fully-fledged blockchain-based payment system built on Substrate, enabling secure digital payments with fiat on/off ramp capabilities through mint and burn operations.


πŸš€ Features

πŸ’Έ Core Payment Features

  • Peer-to-Peer Transfers: Send and receive VCS instantly
  • Transaction History: Complete audit trail of all transactions
  • Multi-signature Support: Enhanced security for high-value transactions

🏦 Fiat On/Off Ramp

  • Mint Operations: Convert fiat to VCS through verified bank transfers
  • Burn Operations: Convert VCS back to fiat currency
  • Compliance Framework: Built-in KYC/AML verification system

πŸ” Security & Compliance

  • KYC Verification: Identity verification for regulatory compliance
  • Admin Controls: Centralized oversight for mint/burn approvals
  • JWT Authentication: Secure API access with coin-based auth
  • Rate Limiting: DDoS protection and abuse prevention

🎯 Technical Highlights

  • Substrate Framework: Built on Polkadot's battle-tested blockchain framework
  • RESTful API: Comprehensive HTTP API for easy integration
  • PostgreSQL Database: Robust data persistence layer
  • Real-time Updates: WebSocket support for live transaction monitoring

πŸ“ Project Structure

velopay/
β”œβ”€β”€ velo-chain/              # Substrate blockchain node
β”‚   β”œβ”€β”€ pallets/
β”‚   β”‚   └── velopay/         # VeloPay pallet (core logic)
β”‚   β”œβ”€β”€ runtime/             # Chain runtime configuration
β”‚   └── node/                # Node implementation
β”‚
β”œβ”€β”€ velopay-api/             # REST API Gateway (Actix-web + Rust)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ chain/           # Blockchain client integration
β”‚   β”‚   β”œβ”€β”€ db/              # Database repositories
β”‚   β”‚   β”œβ”€β”€ middleware/      # Auth & admin middleware
β”‚   β”‚   β”œβ”€β”€ models/          # Data models
β”‚   β”‚   β”œβ”€β”€ routes/          # API endpoints
β”‚   β”‚   └── services/        # Business logic
β”‚   └── migrations/          # Database migrations
β”‚
└── velopay-web/             # Frontend (SvelteKit)
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ lib/             # Shared components & utilities
    β”‚   └── routes/          # Application pages
    └── static/              # Static assets

πŸ› οΈ Technology Stack

Blockchain (velo-chain)

  • Framework: Substrate 4.0
  • Language: Rust
  • Consensus: Aura (Block Production) + GRANDPA (Finality)
  • Runtime: Custom VeloPay pallet with mint/burn logic

API Gateway (velopay-api)

  • Framework: Actix-web 4.x
  • Language: Rust
  • Database: PostgreSQL 16
  • Authentication: JWT (jsonwebcoin)
  • Rate Limiting: Governor middleware
  • Client: Subxt for blockchain interaction

Frontend (velopay-web)

  • Framework: SvelteKit
  • Language: TypeScript
  • Styling: TailwindCSS
  • Build Tool: Vite
  • State Management: Svelte stores

πŸ“‹ Prerequisites

System Requirements

  • Operating System: Windows 10/11, Linux, or macOS
  • RAM: Minimum 8GB (16GB recommended)
  • Disk Space: 20GB+ for blockchain data

Software Dependencies

  • Rust: 1.70 or higher
  • Node.js: 18.x or higher
  • PostgreSQL: 14.x or higher
  • Git: Latest version

Development Tools

  • Cargo: Rust package manager (comes with Rust)
  • npm/pnpm: Node package manager
  • psql: PostgreSQL client

πŸš€ Quick Start

1. Clone Repository

git clone https://github.com/ChronoCoders/velopay.git
cd velopay

2. Start Blockchain Node

cd velo-chain

# Build the node (first time only)
cargo build --release

# Start Alice node (development)
./target/release/velo-chain --dev --tmp

Alternative: Use provided batch scripts:

# Windows
start-local.bat

# Linux/Mac
./start-local.sh

3. Setup Database

# Create database
psql -U postgres
CREATE DATABASE velopay_db;
CREATE USER velopay_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE velopay_db TO velopay_user;
\q

# Run migrations
cd velopay-api
sqlx migrate run

4. Configure API

Create .env file in velopay-api/:

# Database
DATABASE_URL=postgresql://velopay_user:your_password@localhost:5432/velopay_db

# Server
HOST=127.0.0.1
PORT=8080

# JWT
JWT_SECRET=your-super-secret-jwt-key-min-48-chars
JWT_EXPIRATION=86400

# Admin
ADMIN_API_KEY=your-admin-api-key
ADMIN_SEED=//Alice

# Chain
CHAIN_ENDPOINT=ws://127.0.0.1:9944

# CORS
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000

5. Start API Server

cd velopay-api
cargo run --release

API will be available at: http://localhost:8080

6. Start Frontend

cd velopay-web
npm install
npm run dev

Frontend will be available at: http://localhost:5173


πŸ“š API Documentation

Authentication Endpoints

Register User

POST /api/v1/auth/register
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "SecurePass123!",
  "wallet_address": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}

Login

POST /api/v1/auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "SecurePass123!"
}

Payment Endpoints

Send Payment

POST /api/v1/payments
Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json

{
  "from_address": "5GrwvaEF...",
  "to_address": "5FHneW46...",
  "amount": "100.50"
}

Get Transaction History

GET /api/v1/payments/history/{wallet_address}?limit=10&offset=0
Authorization: Bearer <JWT_TOKEN>

Mint/Burn Operations

Create Mint Request

POST /api/v1/mint
Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json

{
  "wallet_address": "5GrwvaEF...",
  "amount": "1000.00",
  "bank_reference": "BANK-REF-12345"
}

Create Burn Request

POST /api/v1/burn
Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json

{
  "wallet_address": "5GrwvaEF...",
  "amount": "500.00",
  "bank_account": "TR330006100519786457841326"
}

KYC Endpoints

Submit KYC

POST /api/v1/kyc
Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json

{
  "document_hash": "0xabcdef1234567890",
  "full_name": "John Doe",
  "date_of_birth": "1990-01-01",
  "country": "US",
  "wallet_address": "5GrwvaEF..."
}

Admin Endpoints

Get Pending Mint Requests

GET /admin/v1/mint/pending
X-Admin-API-Key: <ADMIN_API_KEY>

Approve Mint Request

POST /admin/v1/mint/{request_id}/approve
X-Admin-API-Key: <ADMIN_API_KEY>
Content-Type: application/json

{
  "admin_id": "uuid-here",
  "chain_request_id": 0
}

πŸ§ͺ Testing

Run API Tests

cd velopay-api

# Run test suite
test-api.bat

# Or manually test endpoints
curl http://localhost:8080/health

Run Chain Tests

cd velo-chain
cargo test --release

Run Frontend Tests

cd velopay-web
npm run test

πŸ—οΈ Architecture

System Flow

User β†’ Frontend (SvelteKit) β†’ API Gateway (Actix) β†’ PostgreSQL
                                    ↓
                              Blockchain Node (Substrate)

Key Components

  1. VeloPay Pallet: Core blockchain logic for coin operations
  2. API Gateway: RESTful interface for user interactions
  3. Database: Off-chain data persistence for fast queries
  4. Frontend: User-friendly web interface

Security Model

  • JWT Authentication: Secure API access
  • Admin API Keys: Privileged operations require admin key
  • Rate Limiting: Protection against abuse
  • KYC/AML: Regulatory compliance built-in

πŸ”§ Configuration

Chain Configuration

Edit velo-chain/node/src/chain_spec.rs:

  • Genesis accounts
  • Initial balances
  • Validator set

API Configuration

All configuration via .env file:

  • Database connection
  • JWT settings
  • CORS policies
  • Rate limits

Frontend Configuration

Edit velopay-web/svelte.config.js:

  • API endpoint URLs
  • Build settings
  • Adapters

🚒 Deployment

Production Considerations

  1. Use Strong Secrets: Generate secure keys for production
  2. Enable HTTPS: Use SSL certificates for API and frontend
  3. Database Backups: Regular PostgreSQL backups
  4. Monitoring: Set up logging and alerts
  5. Rate Limiting: Adjust based on expected load

Docker Deployment (Coming Soon)

docker-compose up -d

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Substrate/Polkadot: For the amazing blockchain framework
  • Actix-web: For the performant Rust web framework
  • SvelteKit: For the elegant frontend framework

πŸ“ž Support


πŸ—ΊοΈ Roadmap

  • Core blockchain functionality
  • REST API implementation
  • Database integration
  • Authentication system
  • Admin panel endpoints
  • Frontend UI completion
  • Mobile application
  • Multi-chain support
  • Staking mechanism
  • Governance module

Built with ❀️ by ChronoCoders Team

About

Enterprise-grade blockchain payment infrastructure with fiat-backed stablecoin Velo Cash for secure, compliant digital transactions

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •