Terminus is a hybrid Web3 full-stack application that acts as a cryptographically secure Digital Time Capsule. It leverages Ethereum Smart Contracts (via Ganache) to natively enforce trustless time-locks, combined with intense End-to-End Asymmetric Encryption (E2EE) to ensure that intercepted documents remain absolutely inaccessible until the exact temporal conditions are met on the blockchain.
- Smart Contract (
TimeCapsule.sol): Deployed securely to the blockchain. Natively enforcesblock.timestampchecks. - Backend API (
app.py): A Flask interface handling Python SQLite routing, user Auth (JWT), temporary payload caching, and direct connection to the Web3 smart contract. - Frontend (
frontend/): A sleek, brutalist Web2 React application utilizingnode-forgeto actively encrypt massive data payloads securely inside the user's browser before transmitting them to the backend API.
- Registration: The backend generates an RSA Keypair for users. The Private Key is encrypted using
PBKDF2/AES-GCMmapped precisely to the user's password. - Sealing: The system generates a highly optimized symmetric AES key to lock your attached documents. That specific AES key is then encrypted using the Recipient’s Public RSA Key.
- Opening: Only the targeted Recipient can unlock their specific payload, and only after the Ganache block-timer hits zero.
To run this application locally, you must instantiate three connected services: the blockchain, the backend API, and the frontend web server.
- Node.js & NPM installed
- Python 3.10+ installed
- Ganache CLI (
npm install -g ganache)
Open your first terminal window. You need a fast, local EVM (Ethereum Virtual Machine) running.
# Start the Ganache chain. It will bind to 127.0.0.1:8545
ganacheOpen a second terminal window. Initialize the Python environment, install the dependencies, and start the API wrapper.
# 1. Create a virtual environment
python -m venv venv
# 2. Activate the environment (Linux/Mac)
source venv/bin/activate
# Or on Windows: venv\Scripts\activate
# 3. Install packages
pip install -r requirements.txt
# 4. Start the Application
python app.pyNote: Upon boot, Flask will actively compile the Solidity Contract, generate the SQLite capsule.db, and mount the local REST infrastructure.
Open a third terminal window. This initializes the React/Vite development server where you can interact visually with the smart contract.
# Navigate to the frontend directory
cd frontend
# Install node dependencies
npm install
# Start the Vite environment
npm run devNavigate to http://localhost:5173/ in any modern browser.
Register unique accounts (e.g., Alice, Bob) across separate incognito windows to test deploying and unlocking secure P2P Digital Time Capsules!
The repository now includes a production-oriented Docker Compose setup with:
- Flask served through
uvicornusing an ASGI wrapper. - React built by Vite and served by nginx.
- nginx reverse proxying
/apiand/authto the backend so the browser uses same-origin requests. - Ganache running as a Compose service for local blockchain state.
Build and start the stack with:
docker compose up --buildThe app will be available at http://localhost:8080/.
For direct backend access during debugging, the Flask service still listens on port 5000 inside the Compose network, and the backend honors DATABASE_URL, UPLOAD_FOLDER, WEB3_PROVIDER_URI, and JWT_SECRET_KEY environment variables.
If you only want the production stack:
docker compose up --buildOpen http://localhost:8080 for the app and http://localhost:8545 if you want to inspect Ganache directly.
Optional environment variables can be provided through a local .env file at the repo root, for example:
JWT_SECRET_KEY=replace-me