A modern, Python-based blockchain implementation focusing on simplicity, security, and scalability. RavenChain demonstrates core blockchain concepts while providing a foundation for building decentralized applications.
- β Core blockchain implementation with proof-of-work mining
- β Secure wallet management with ECDSA cryptography
- β Transaction system with digital signatures
- β Bitcoin-style address generation
- β Interactive command-line interface
- β Persistent wallet storage
- β Chain validation and integrity checking
- β Mining rewards system
- β FastAPI-based REST API
- β Database persistence with PostgreSQL
- β Docker containerization
- π Peer-to-peer networking
- π Block explorer web interface
- π Smart contract support
- π UTXO model implementation
- π Enhanced security features
- β‘ Performance optimizations
- Language: Python 3.13+
- Cryptography:
ecdsa
,hashlib
- Storage: PostgreSQL for blockchain persistence
- Backend: FastAPI for REST API endpoints
- Frontend: React 19 with TypeScript (planned)
- Future Stack:
- WebSocket for real-time updates
- Redis for caching
- Elasticsearch for block/transaction search (optional)
ravenchain/
βββ ravenchain/ # Core package
β βββ __init__.py
β βββ block.py # Block implementation
β βββ blockchain.py # Main blockchain logic
β βββ transaction.py # Transaction handling
β βββ wallet.py # Wallet management
βββ api/ # FastAPI backend
β βββ __init__.py
β βββ main.py # API entry point
β βββ routes/ # API route handlers
β β βββ block_routes.py
β β βββ mining_routes.py
β β βββ transaction_routes.py
β β βββ wallet_routes.py
β βββ database/ # Database models and config
β βββ models.py
βββ config/ # Configuration
β βββ settings.py # App settings
β βββ logging.py # Logging setup
βββ scripts/ # Utility scripts
βββ tests/ # Test suite
βββ Dockerfile # Docker build file
βββ docker-compose.yml # Docker services config
βββ requirements.txt # Python dependencies
- Python 3.13 or higher
- pip (Python package installer)
OR
- Docker
- Docker Compose
# Clone the repository
git clone https://github.com/yourusername/ravenchain.git
cd ravenchain
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -e .
# Clone the repository
git clone https://github.com/yourusername/ravenchain.git
cd ravenchain
# Build and start the containers
docker-compose up --build
# Or run in detached mode
docker-compose up -d
The Docker setup provides:
- Isolated development environment
- Consistent dependencies across platforms
- Easy setup for future features (API, database)
- Production-ready container configuration
# Run tests in a new container
docker-compose run --rm ravenchain pytest
# Run tests with coverage
docker-compose run --rm ravenchain pytest --cov=ravenchain
- Basic blockchain implementation
- Wallet management system
- Command-line interface
- Transaction handling
- Unit test coverage
- Documentation improvements
- Implement PostgreSQL for blockchain storage
- Design and implement FastAPI REST API
- Block endpoints
- Transaction endpoints
- Wallet endpoints
- Mining endpoints
- API documentation with Swagger/OpenAPI
- Request rate limiting
- API authentication system
- P2P network implementation
- Node discovery protocol
- Block synchronization
- Transaction broadcasting
- Consensus mechanism improvements
- Network state management
- Peer management system
- Basic smart contract engine
- Contract deployment system
- Standard contract templates
- Contract execution environment
- Gas fee implementation
- UTXO model implementation
- Merkle tree optimization
- Chain pruning
- Advanced security features
- Double-spend protection
- Sybil attack prevention
- DDoS mitigation
- Performance benchmarking
- Block explorer web interface
- Wallet GUI application
- Network monitoring tools
- Development tools and SDKs
pytest tests/
The REST API will provide the following endpoints:
# Authentication Endpoints
POST /api/v1/auth/register # Register a new user
POST /api/v1/auth/login # Login and get tokens
POST /api/v1/auth/refresh # Refresh access token
GET /api/v1/auth/me # Get current user info
PUT /api/v1/auth/me # Update current user info
# Admin Endpoints
GET /api/v1/admin/users # List all users (admin only)
GET /api/v1/admin/users/{id} # Get user details (admin only)
PUT /api/v1/admin/users/{id} # Update user (admin only)
DELETE /api/v1/admin/users/{id} # Delete user (admin only)
# Block Endpoints
GET /api/v1/blocks # List blocks
GET /api/v1/blocks/{hash} # Get block details
GET /api/v1/blocks/latest # Get latest block
# Transaction Endpoints
GET /api/v1/transactions # List transactions
POST /api/v1/transactions # Create transaction
# Wallet Endpoints
GET /api/v1/wallets/{address} # Get wallet info
# Mining Endpoints
POST /api/v1/mine # Mine new block
Detailed API documentation is available via Swagger UI at /docs
.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Python's cryptographic libraries
- Inspired by blockchain technology principles
- Community contributions and feedback
Ray Thurman - @raythurman2386
Project Link: https://github.com/raythurman2386/ravenchain