A blockchain-based evidence management system deployed on Avalanche C-Chain.
This application allows users to securely file complaints and store evidence on the blockchain. It uses:
- Backend: Node.js with Express
- Database: MongoDB
- Blockchain: Avalanche C-Chain
- Storage: IPFS via Pinata
- User authentication and authorization
- Secure complaint filing
- Evidence storage on IPFS
- Blockchain verification using Avalanche C-Chain
- Immutable record keeping
- Node.js (v14 or higher)
- MongoDB
- Avalanche C-Chain wallet with AVAX
- Pinata API keys for IPFS storage
- Clone the repository
git clone <repository-url>
cd evid-bc- Install dependencies
npm install- Configure environment variables
Create a .env file in the root directory with the following variables:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
RPC_URL=https://api.avax-test.network/ext/bc/C/rpc
PRIVATE_KEY=your_wallet_private_key
CONTRACT_ADDRESS=your_deployed_contract_address
PINATA_API_KEY=your_pinata_api_key
PINATA_API_SECRET=your_pinata_api_secret
This project is configured for deployment on the Avalanche C-Chain. For detailed deployment instructions, see AVALANCHE_DEPLOYMENT.md.
To deploy the smart contract to Avalanche:
npm run deploy:avalancheThis will:
- Compile and deploy the ComplaintRegistry contract
- Update your .env file with the new contract address
# Development mode
npm run dev
# Production mode
npm startThe server will start on http://localhost:3000 (or the port specified in your environment).
POST /api/auth/register- Register a new userPOST /api/auth/login- Login and get JWT token
POST /api/complaints- File a new complaintGET /api/complaints- Get all complaintsGET /api/complaints/:id- Get a specific complaint
The ComplaintRegistry smart contract is deployed on the Avalanche C-Chain and provides the following functions:
addComplaint(string _id, string _user, string _hash)- Add a new complaintgetComplaint(uint index)- Get complaint details by indextotalComplaints()- Get the total number of complaints
The application includes utilities for interacting with the Avalanche blockchain:
executeTransaction()- Handles transaction execution with fallback mechanismsgetSafeGasPrice()- Gets optimal gas prices for Avalanche
ISC