Crypto Tracker is a Django-based web application designed to help users monitor and manage their cryptocurrency portfolios. It provides insights into assets, staking, protocol participation, and rewards across multiple networks and protocols.
- Portfolio Management: Track cryptocurrency holdings, staking balances, and protocol participation.
- Real-Time Updates: Fetches latest prices, staking rewards, and protocol data.
- Protocol Support: Supports popular protocols like Liquity V1/V2, Aave V3, and Uniswap V3.
- Multi-Network Support: Works across Ethereum, Arbitrum, Avalanche, Gnosis Chain, and Base networks.
- User Accounts: Secure user authentication and personalized portfolio tracking.
- Invite-Based Registration: Restricted signup requiring invite codes for controlled access.
- Admin Panel: Comprehensive admin interface for user and invite code management.
- User Roles: Admin users can manage invite codes and promote other users to admin status.
- Statistics and Insights: View wallet and account balances, staking rewards, and protocol-specific data.
- Python 3.8+
- Django 4.0+
- Redis (for Celery task queue)
- APE framework (for blockchain interactions)
-
Clone the Repository:
git clone git@github.com:0xthedance/cryptotracker.git cd cryptotracker -
Create a
.envFile: Create a.envfile in the project root and add the following:export DJANGO_SECRET_KEY=your_secret_key export WEB3_ALCHEMY_PROJECT_ID=your_alchemy_project_id export ETHERSCAN_API_KEY=your_etherscan_api_key export THE_GRAPH_API_KEY=your_graph_api_key export COINGECKO_API_KEY=your_coingecko_api_key export BEACONCHAIN_API_KEY=your_beaconchain_api_key- WEB3_ALCHEMY_PROJECT_ID: Required for blockchain interactions via Alchemy.
- ETHERSCAN_API_KEY: Used for fetching blockchain data from Etherscan.
- THE_GRAPH_API_KEY: Required for querying data from The Graph.
- COINGECKO_API_KEY: Used for fetching cryptocurrency price data.
- BEACONCHAIN_API_KEY: Used for fetching ETH validators data.
(For docker, remove the export keywords)
You can use the template given by first copying into the final env file and then filling in your keys. For local running:
cp env.local.template .env.local
# Fill in your keys, then:
source .env.localFor docker:
cp env.docker.template .env.docker-
Create a Virtual Environment:
python3 -m venv venv source venv/bin/activate -
Install Dependencies:
pip install -r requirements.txt
-
Apply Migrations:
python manage.py makemigrations python manage.py migrate
-
Load Initial Data:
python manage.py initialize_db
-
Setup Invite System (Optional): This command creates an initial admin user and generates sample invite codes:
python manage.py setup_invite_system
-
Run the Development Server:
python manage.py runserver
-
Start Celery Worker: If you don't have Redis running, you can do it with:
docker run -d -p 6379:6379 --name redis redis:latest
Or with:
docker start redis
if you had run it before.
Then start celery with:
celery -A dcp worker --loglevel=info
-
Access the Application: Open your browser and navigate to
http://127.0.0.1:8000.
-
Additional Environment Variables for Production: Modify
.envfile with your preferences:export REDIS_URL=redis://redis:6379 export DJANGO_ALLOWED_HOSTS=your_production_domain export DJANGO_DEBUG=False- REDIS_URL: Specifies the Redis connection string for Celery.
- DJANGO_ALLOWED_HOSTS: Specifies the allowed hosts for the production environment.
- DJANGO_DEBUG: Set to
Falsefor production.
-
Build and Run the Application: Use
docker-compose.ymlto build (optional):docker-compose build
and run the application:
docker-compose up
-
Access the Application: Open your browser and navigate to
http://$IP_HOST:8000.
- Sign Up: Create an account using a valid invite code (first user becomes admin automatically).
- Add UserAddresses: Add your cryptocurrency wallet addresses.
- View Portfolio: Monitor your assets, staking balances, and protocol participation.
- Refresh Data: Use the "Refresh" button to fetch the latest data.
- Explore Statistics: View detailed statistics for wallets and accounts.
Admin users have access to additional functionality through the Admin tab:
- Access Admin Panel: Click the "Admin" tab in the navigation.
- Generate Invite Codes: Create new invite codes for user registration.
- Manage Invite Codes: View all codes, their status, and revoke unused codes.
- User Management: View all users and promote/demote admin status.
- Monitor Usage: Track which codes have been used and by whom.
- First User: The very first user to sign up automatically becomes admin and doesn't need an invite code.
- Subsequent Users: Must provide a valid, unused invite code to register.
- Code Generation: Only admins can generate invite codes.
- Code Status: Invite codes can be active, used, or revoked.
- Security: Each invite code can only be used once.
Sets up the invite code system with initial data:
- Creates admin user if no users exist (username: admin, password: admin123)
- Generates 5 sample invite codes for testing
python manage.py setup_invite_systeminitialize_db: Load basic application data (networks, tokens, etc.)setup_invite_system: Configure invite system and create initial admin user- Other Django management commands as usual
- Backend: Django, Celery, Celery Beat
- Authentication: Django's built-in auth system with custom user profiles
- Blockchain: Web3.py, Ape Framework
- Frontend: HTML, CSS, JavaScript (Django templates and Bulma CSS)
- Task Queue: Redis + Celery
This project is licensed under the MIT License. See the LICENSE file for details.
- Invite Code System: Only admins can generate invite codes, ensuring controlled access.
- First User Protection: The first user is automatically made admin to prevent lockout.
- Admin Privileges: Admin status cannot be toggled by users themselves (except when changing other users).
- Code Uniqueness: Each invite code is unique and can only be used once.
- Code Revocation: Admins can revoke unused invite codes if needed.
When contributing to this project, please note the invite code system restrictions:
- New users will need invite codes for testing (unless you reset the database).
- Use
setup_invite_systemcommand to quickly set up test environment. - Admin functionality is restricted to users with admin status.