-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.example
More file actions
236 lines (223 loc) · 6.9 KB
/
.env.example
File metadata and controls
236 lines (223 loc) · 6.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# ==================== BLOCKCHAIN CONFIGURATION ====================
# Ethereum/Polygon Testnet Configuration
# Blockchain RPC endpoint
# RECOMMENDED: Polygon Mumbai (free, fast, perfect for hackathons)
# https://rpc-mumbai.maticvigil.com/ (free, no API key needed)
#
# Other options:
# - Polygon Amoy: https://rpc-amoy.maticvigil.com/
# - Ethereum Sepolia: https://sepolia.infura.io/v3/YOUR_INFURA_KEY
# - Ethereum Goerli: https://goerli.infura.io/v3/YOUR_INFURA_KEY
BLOCKCHAIN_RPC_URL=https://rpc-mumbai.maticvigil.com/
# Deployed smart contract address
# Get this after deploying CertificateRegistry.sol using Hardhat
# Leave empty to run in SIMULATION MODE (demo mode)
# Example: 0x1234567890abcdef1234567890abcdef12345678
CONTRACT_ADDRESS=
# Private key of the account that will issue certificates
# ⚠️ SECURITY: This key can issue transactions. Keep it secret!
# Never commit this file to git with a real private key
#
# How to get:
# 1. Open MetaMask wallet
# 2. Go Settings → Account Details → Export Private Key
# 3. Copy the 64-character hex string (without 0x prefix)
# 4. Paste here
#
# For hackathon demo: Create a new throwaway wallet
PRIVATE_KEY=
# ==================== GOOGLE GEMINI API CONFIGURATION ====================
# AI-powered certificate verification using Google's Gemini API
# Gemini API Key (FREE!)
# Get free API key at: https://ai.google.dev/
#
# How to get:
# 1. Go to https://ai.google.dev/
# 2. Click "Get API Key" button
# 3. Create new API key
# 4. Copy and paste here
#
# Features enabled by this key:
# - Certificate data authenticity analysis
# - Certificate image tampering detection
# - Text extraction from certificate PDFs/images
# - Confidence scoring (0-100)
#
# Leave empty to run AI in SIMULATION MODE (demo mode)
GEMINI_API_KEY=
# ==================== BACKEND SERVER CONFIGURATION ====================
# Server port (where API listens)
PORT=5000
# Node environment
# development = Full error messages, detailed logging
# production = Minimal error details
NODE_ENV=development
# Frontend URL (for CORS - cross-origin requests)
# This tells the backend which URL is allowed to access the API
FRONTEND_URL=http://localhost:5173
# ==================== OPTIONAL: PREMIUM RPC PROVIDERS ====================
# These are optional but provide better performance and reliability
# Alchemy API Key (for faster Polygon/Ethereum access)
# Get free tier at: https://alchemy.com/
# More reliable and faster than free public RPC
ALCHEMY_API_KEY=
# Infura Project ID (alternative premium RPC)
# Get free tier at: https://infura.io/
INFURA_PROJECT_ID=
# ==================== SETUP GUIDE ====================
#
# MODE 1: LOCAL DEMO (Recommended for Hackathons)
# ✅ No blockchain setup needed
# ✅ No API keys needed
# ✅ Perfect for demos and presentations
#
# Steps:
# 1. Copy this file to .env (remove .example)
# 2. Leave all values empty/default
# 3. npm install
# 4. npm run dev
# 5. Visit http://localhost:5173
#
# Features:
# - Certificates stored in simulated blockchain
# - AI analysis runs in simulation mode
# - All verification works end-to-end!
#
# ==================== SETUP GUIDE ====================
#
# MODE 2: BLOCKCHAIN ONLY
# Verify certificates on actual Polygon Mumbai testnet
#
# Prerequisites:
# - MetaMask wallet (free: https://metamask.io/)
# - Testnet MATIC tokens (free: https://faucet.polygon.technology/)
#
# Steps:
# 1. Add Polygon Mumbai to MetaMask:
# - Network name: Polygon Mumbai
# - RPC: https://rpc-mumbai.maticvigil.com/
# - Chain ID: 80001
# - Currency: MATIC
# - Block Explorer: https://mumbai.polygonscan.com/
#
# 2. Get testnet MATIC:
# - Go to https://faucet.polygon.technology/
# - Enter your MetaMask address
# - Confirm you get MATIC (usually 1 testnet MATIC)
#
# 3. Deploy smart contract:
# - npm install --save-dev hardhat
# - Create deployment script (in scripts/deploy.js)
# - npx hardhat run scripts/deploy.js --network mumbai
# - Copy output contract address
#
# 4. Set environment variables:
# - CONTRACT_ADDRESS=<deployed address>
# - PRIVATE_KEY=<your MetaMask private key>
#
# 5. npm run dev
#
# Testing:
# - Visit https://mumbai.polygonscan.com/
# - Paste your address to see transactions
#
# ==================== SETUP GUIDE ====================
#
# MODE 3: AI ONLY
# Use Gemini API for certificate analysis without blockchain
#
# Steps:
# 1. Get Gemini API key:
# - Visit https://ai.google.dev/
# - Click "Get API Key"
# - Create new API key
# - Copy key
#
# 2. Set in this file:
# GEMINI_API_KEY=<your_key>
#
# 3. Leave CONTRACT_ADDRESS empty
#
# 4. npm run dev
#
# Features:
# - Certificate image analysis
# - Tampering detection
# - Text extraction from images
# - Authenticity scoring
#
# ==================== SETUP GUIDE ====================
#
# MODE 4: FULL SETUP (Blockchain + AI)
# Complete verification with both blockchain and AI
#
# Complete all steps from MODE 2 and MODE 3
# Then set all variables and run npm run dev
#
# This gives you:
# ✅ Immutable certificate storage (blockchain)
# ✅ AI tampering detection
# ✅ Hash verification
# ✅ Complete audit trail
# ✅ Enterprise-grade verification
#
# ==================== IMPORTANT SECURITY NOTES ====================
#
# 🔒 PRIVATE KEY SECURITY:
# - Never share your private key
# - Never commit .env with real keys to git
# - Use a separate private key for each environment
# - Rotate keys regularly
# - For production: use hardware wallets (Ledger, Trezor)
#
# 🔒 API KEY SECURITY:
# - Keep API keys secret
# - Set rate limits on API keys
# - Regenerate keys if compromised
# - Use different keys for different environments
#
# 🔒 GIT SAFETY:
# - Add .env to .gitignore (already done)
# - Never commit this file with real keys
# - Use .env.local for local development
# - Use CI/CD secrets for deployments
#
# ==================== TROUBLESHOOTING ====================
#
# Q: "Contract not initialized" error?
# A: CONTRACT_ADDRESS is empty - run in simulation mode or deploy contract
#
# Q: "GEMINI_API_KEY not set" warning?
# A: Normal - means AI will run in simulation mode (demo mode)
#
# Q: RPC connection timeout?
# A: Try a premium RPC (Alchemy) or different endpoint
#
# Q: MetaMask transaction reverted?
# A: Might be insufficient gas or contract error - check Mumbai explorer
#
# Q: API key invalid error?
# A: Check that key is copied correctly - no spaces or newlines
#
# ==================== USEFUL LINKS ====================
#
# 🌐 Blockchain:
# - Polygon: https://polygon.technology/
# - Mumbai Testnet: https://mumbai.polygonscan.com/
# - Faucet: https://faucet.polygon.technology/
# - ChainList: https://chainlist.org/
#
# 🤖 AI:
# - Google Gemini: https://ai.google.dev/
# - API Reference: https://ai.google.dev/docs
# - Model Info: https://ai.google.dev/models/gemini
#
# 👛 Wallet:
# - MetaMask: https://metamask.io/
# - Tutorial: https://docs.metamask.io/
#
# 🔗 Tools:
# - Hardhat: https://hardhat.org/
# - Ethers.js: https://docs.ethers.org/
# - Remix IDE: https://remix.ethereum.org/
#