Loading repository data…
Loading repository data…
Garbii1 / repository
Simple web app to check ETH balances on Sepolia testnet using Flask (Python/Web3.py) backend and Vue.js frontend. Deployed on Render/Netlify.
A simple web application built to check the Ether (ETH) balance of any wallet address on the Ethereum Sepolia test network. This project serves as a demonstration of integrating a Python Flask backend (using Web3.py) with a Vue.js frontend to interact with blockchain data. The backend provides an API, and the frontend consumes it to display information to the user.
The application is deployed with the backend on Render and the frontend on Netlify, utilizing their free tiers.
🚀 Try the live application here: https://blockchain-tracker.netlify.app/
(Note: The backend might take ~30 seconds to wake up on the first request due to Render's free tier scaling.)
Follow these instructions to set up and run the project locally.
Clone the repository:
git clone https://github.com/Garbii1/blockchain-app.git
cd blockchain-app
Backend Setup:
cd backend
# Create
python -m venv venv
# Activate (Windows CMD/Git Bash)
.\venv\Scripts\activate
# Activate (macOS/Linux/WSL)
# source venv/bin/activate
pip install -r requirements.txt
.env file in the backend directory:
# backend/.env
# Replace with your actual Sepolia RPC URL
SEPOLIA_RPC_URL=https://rpc.sepolia.org/
# Add these lines later if implementing contract interaction
# CONTRACT_ADDRESS=YOUR_DEPLOYED_CONTRACT_ADDRESS
# CONTRACT_ABI='YOUR_CONTRACT_ABI_JSON_STRING'
Frontend Setup:
# From project root
cd ../frontend
# Or from backend directory
# cd ../frontend
npm install
.env.development in the frontend directory:
# frontend/.env.development
VUE_APP_API_BASE_URL=http://127.0.0.1:5001/api
.env.production in the frontend directory (used for the deployed version):
# frontend/.env.production
# Replace with your *deployed* Render backend URL
VUE_APP_API_BASE_URL=https://blockchain-app-s4fw.onrender.com/api
vue.config.js file as per the troubleshooting steps to disable CSS url() processing if you encountered that issue.Run the Backend (Flask):
blockchain-app/).# Windows CMD/Git Bash
.\backend\venv\Scripts\activate
# macOS/Linux/WSL
# source backend/venv/bin/activate
set for Windows CMD, $env: for PowerShell, export for macOS/Linux):
# Example for Windows CMD (Run from project root!)
set FLASK_APP=backend.app:create_app
set FLASK_ENV=development
# Example for macOS/Linux/WSL
# export FLASK_APP=backend.app:create_app
# export FLASK_ENV=development
flask run --port=5001
http://127.0.0.1:5001. Keep this terminal open.Run the Frontend (Vue):
frontend directory (blockchain-app/frontend/).npm run serve
http://localhost:8080 (check the terminal output). Open this URL in your browser.GET /api/status: Checks the connection status to the blockchain node.GET /api/balance/<address>: Retrieves the ETH balance for the specified <address> on Sepolia.(Future) GET /api/contract/value: Retrieves a stored value from a deployed smart contract.(Future) POST /api/contract/value: Sets a value in a deployed smart contract (requires backend signing - complex).backendpip install -r requirements.txtgunicorn "backend.app:create_app()" (Ensure quotes and parentheses are correct!)PYTHONPATH = /opt/render/project/srcSEPOLIA_RPC_URL = Your Sepolia RPC URLCONTRACT_ADDRESS, CONTRACT_ABI)frontendnpm run buildfrontend/distfrontend/public/_redirects file exists with /* /index.html 200 for Vue Router history mode..env.production has the correct deployed Render API URL.ImportError: attempted relative import with no known parent package when running Flask/Gunicorn.
flask run or gunicorn commands with the app specified relative to the project root (e.g., backend.app:create_app) and set the PYTHONPATH environment variable on Render to /opt/render/project/src.create_app).
gunicorn "backend.app:create_app()" ensuring quotes for the shell and parentheses for Gunicorn's factory detection.pywin32 Dependency: Build failure on Render (Linux) due to Windows-specific dependency.
pywin32 from backend/requirements.txt.Module not found: Error: Can't resolve '/img/...' despite image existing in public/img. css-loader was resolving relative to the CSS file instead of the public root.
css-loader via vue.config.js by setting chainWebpack config to modify the loader's options: options.url = false;. This passes the root-relative URL directly to the browser.VUE_APP_API_BASE_URL in frontend/.env.production is correctly set to the deployed Render backend URL and that this file is committed before deploying to Netlify./api/status. Understand free tier limitations (sleep/wake cycles, resource limits).window.ethereum.SimpleStorage.sol contract.GET /api/contract/value) to read from the contract.setValue (likely requires frontend signing via MetaMask/Ethers.js).