cTrip is a high-performance, multi-chain cryptocurrency payment gateway built with FastAPI. It supports automated payment detection, confirmation monitoring, and funds sweeping across multiple EVM-compatible blockchains.
- Multi-Chain Support: Native support for BSC, Ethereum, and local testing environments (Anvil).
- Real-Time Detection: WebSocket-based payment detection via chain-sniper, with no block polling required.
- Async Architecture: Fully asynchronous API and database operations using SQLAlchemy and FastAPI.
- Background Workers: Async task processing using ARQ and Redis with built-in cron scheduling.
- Secure Address Management: HD Wallet integration for generating unique payment addresses.
- Webhooks: Automated notifications for payment status changes (HMAC-SHA256 signed).
- Migration System: Robust database migrations using Alembic with a custom helper script.
- Admin API: Manual task triggering via
/admin/*endpoints.
- Framework: FastAPI
- Database: PostgreSQL / SQLite (Dev)
- ORM: SQLAlchemy 2.0
- Task Queue: ARQ with Redis
- Blockchain: Web3.py + chain-sniper (WebSocket detection)
- Migrations: Alembic
- Python 3.10+
- Docker & Docker Compose
- Redis (for background workers)
- PostgreSQL (for production)
- Create a
.envfile from the environment template. - Configure your chains in
chains.yaml— use WebSocket URLs (ws://orwss://) for real-time payment detection. - Set your HD Wallet mnemonic in the environment variables.
docker-compose up --buildThis will start the API, PostgreSQL, Redis, and background workers.
-
Install Dependencies:
python -m venv venv source venv/bin/activate pip install -r requirements.txt -
Run Migrations:
python migrate.py upgrade
-
Start the API:
uvicorn server:app --reload
-
Start Workers:
python run_worker.py
app/api/: API endpoints and routes.app/blockchain/: Multi-chain implementation and Web3 logic.app/db/: Database models, schemas, and session management.app/workers/: ARQ tasks and worker configuration for background processing.app/services/: Core business logic for scanning and sweeping.migrate.py: Helper script for managing database migrations.
For more detailed information, see Documentation.
This project is licensed under the terms included in the LICENSE.txt file.