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).
- Automated Detection: Real-time scanning of blockchain blocks to detect incoming payments.
- Async Architecture: Fully asynchronous API and database operations using SQLAlchemy and FastAPI.
- Background Workers: Distributed task processing using Dramatiq and Redis for reliable background operations.
- Secure Address Management: HD Wallet integration for generating unique payment addresses.
- Webhooks: Automated notifications for payment status changes.
- Migration System: Robust database migrations using Alembic with a custom helper script.
- Framework: FastAPI
- Database: PostgreSQL / SQLite (Dev)
- ORM: SQLAlchemy 2.0
- Task Queue: Dramatiq with Redis
- Blockchain: Web3.py
- 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. - 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:
dramatiq app.workers.listener app.workers.sweeper app.workers.webhook
app/api/: API endpoints and routes.app/blockchain/: Multi-chain implementation and Web3 logic.app/db/: Database models, schemas, and session management.app/workers/: Dramatiq actors for background tasks.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.