# Blockscout Start Instructions

**Date**: $(date)  
**Blockscout Location**: VMID 5000 on pve2  
**Purpose**: Start Blockscout service to enable contract verification

---

## 🚀 Quick Start

### Option 1: Use Start Script (If on Proxmox host)

```bash
cd /home/intlc/projects/proxmox
./scripts/start-blockscout.sh
```

This script will:
1. Check container status
2. Start container if stopped
3. Start Blockscout service
4. Verify API accessibility

### Option 2: Manual Start (On pve2)

SSH to pve2 and run:

```bash
# Check container status
pct status 5000

# Start container if stopped
pct start 5000

# Start Blockscout service
pct exec 5000 -- systemctl start blockscout

# Enable auto-start on boot
pct exec 5000 -- systemctl enable blockscout

# Check service status
pct exec 5000 -- systemctl status blockscout
```

---

## 🔍 Verification Steps

### 1. Check Container Status

```bash
pct status 5000
```

**Expected**: `status: running`

### 2. Check Service Status

```bash
pct exec 5000 -- systemctl status blockscout
```

**Expected**: `Active: active (running)`

### 3. Check Docker Containers

```bash
pct exec 5000 -- docker ps | grep blockscout
```

**Expected**: Two containers running:
- `blockscout` (main application)
- `blockscout-postgres` (database)

### 4. Test API Accessibility

```bash
curl -s https://explorer.d-bis.org/api | head -20
```

**Expected**: JSON response (not error 502)

### 5. Test Web UI

Open in browser: https://explorer.d-bis.org

**Expected**: Blockscout explorer interface loads

---

## 📋 Troubleshooting

### Container Not Running

**Symptom**: `pct status 5000` shows container is stopped

**Solution**:
```bash
pct start 5000
```

### Service Fails to Start

**Symptom**: `systemctl status blockscout` shows failed

**Solution**:
```bash
# Check service logs
pct exec 5000 -- journalctl -u blockscout -n 50

# Check Docker logs
pct exec 5000 -- docker logs blockscout
pct exec 5000 -- docker logs blockscout-postgres

# Restart service
pct exec 5000 -- systemctl restart blockscout
```

### API Returns 502

**Symptom**: API returns "502 Bad Gateway"

**Possible Causes**:
1. Service is still starting (wait 1-2 minutes)
2. Docker containers not running
3. Database connection issue
4. Port conflict

**Solution**:
```bash
# Check if containers are running
pct exec 5000 -- docker ps

# Check service logs
pct exec 5000 -- journalctl -u blockscout -n 100

# Restart service
pct exec 5000 -- systemctl restart blockscout

# Wait a few minutes and retry
sleep 120
curl https://explorer.d-bis.org/api
```

### Docker Containers Not Starting

**Symptom**: `docker ps` shows no blockscout containers

**Solution**:
```bash
# Check Docker service
pct exec 5000 -- systemctl status docker

# Start Docker if needed
pct exec 5000 -- systemctl start docker

# Manually start containers
pct exec 5000 -- cd /opt/blockscout && docker-compose up -d

# Check logs
pct exec 5000 -- docker-compose logs
```

---

## ✅ After Blockscout is Running

Once Blockscout is accessible, you can:

### 1. Retry Contract Verification

```bash
cd /home/intlc/projects/proxmox
./scripts/retry-contract-verification.sh
```

Or manually:
```bash
./scripts/verify-all-contracts.sh 0.8.20
```

### 2. Verify Individual Contracts

Navigate to contract on Blockscout:
- Oracle Proxy: https://explorer.d-bis.org/address/0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6
- CCIP Router: https://explorer.d-bis.org/address/0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e

### 3. Check Verification Status

```bash
./scripts/check-contract-verification-status.sh
```

---

## 🔗 Related Documentation

- **Blockscout Status Guide**: `docs/BLOCKSCOUT_STATUS_AND_VERIFICATION.md`
- **Verification Guide**: `docs/BLOCKSCOUT_VERIFICATION_GUIDE.md`
- **Final Validation Report**: `docs/FINAL_VALIDATION_REPORT.md`

---

**Last Updated**: $(date)

