-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
57 lines (45 loc) Β· 1.53 KB
/
setup.sh
File metadata and controls
57 lines (45 loc) Β· 1.53 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
#!/bin/bash
echo "π Setting up VoteChain - Blockchain Voting Platform"
echo "=================================================="
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "β Node.js is not installed. Please install Node.js v16 or higher."
exit 1
fi
# Check Node.js version
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 16 ]; then
echo "β Node.js v16 or higher is required. Current version: $(node -v)"
exit 1
fi
echo "β
Node.js version check passed: $(node -v)"
# Install dependencies
echo "π¦ Installing dependencies..."
npm install
if [ $? -ne 0 ]; then
echo "β Failed to install dependencies"
exit 1
fi
echo "β
Dependencies installed successfully"
# Compile smart contracts
echo "π¨ Compiling smart contracts..."
npm run compile
if [ $? -ne 0 ]; then
echo "β Failed to compile smart contracts"
exit 1
fi
echo "β
Smart contracts compiled successfully"
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
echo "π Creating .env file from template..."
cp .env.example .env
echo "β οΈ Please edit .env file with your RPC URLs and private keys"
fi
echo ""
echo "π Setup complete! Next steps:"
echo "1. Edit .env file with your blockchain network credentials"
echo "2. Run 'npm run node' to start local blockchain network"
echo "3. In another terminal, run 'npm run deploy:local' to deploy contracts"
echo "4. Run 'npm start' to start the frontend"
echo ""
echo "π For detailed instructions, see README.md"