# Blockscout Status and Verification Guide

**Date**: $(date)  
**Blockscout Location**: VMID 5000 on pve2  
**URL**: https://explorer.d-bis.org  
**API Endpoint**: https://explorer.d-bis.org/api

---

## 📍 Blockscout Configuration

### Container Information
- **VMID**: 5000
- **Host**: pve2
- **Hostname**: blockscout-1
- **Service**: Blockscout Explorer (self-hosted)

### Access Information
- **Web UI**: https://explorer.d-bis.org
- **API Endpoint**: https://explorer.d-bis.org/api
- **Service Name**: `blockscout.service`

---

## 🔍 Checking Blockscout Status

### Quick Status Check

Use the provided script to check Blockscout status:

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

This script will check:
1. Container status (running/stopped)
2. Blockscout service status (active/inactive)
3. Docker containers status
4. API accessibility

### Manual Status Check

If you're on the Proxmox host (pve2):

```bash
# Check container status
pct status 5000

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

# Check Docker containers
pct exec 5000 -- docker ps | grep blockscout

# Test API accessibility
curl -s https://explorer.d-bis.org/api | head -20
```

---

## 🚀 Starting Blockscout

If Blockscout is not running, start it with:

```bash
# 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 status
pct exec 5000 -- systemctl status blockscout
```

---

## 📋 Troubleshooting

### Error 502 (Bad Gateway)

**Symptom**: API returns 502 error  
**Cause**: Blockscout service is down or not accessible

**Solution**:
1. Check container status: `pct status 5000`
2. Check service status: `pct exec 5000 -- systemctl status blockscout`
3. Start service: `pct exec 5000 -- systemctl start blockscout`
4. Check logs: `pct exec 5000 -- journalctl -u blockscout -n 50`

### Error 522 (Connection Timeout)

**Symptom**: Connection timeout when accessing API  
**Cause**: Network connectivity issue or service overloaded

**Solution**:
1. Check if service is responding: `curl -v https://explorer.d-bis.org/api`
2. Check container resources: `pct exec 5000 -- docker stats --no-stream`
3. Check service logs for errors
4. Retry verification later

### Service Not Starting

If Blockscout service fails to start:

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

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

# Check database connection
pct exec 5000 -- docker logs blockscout-postgres

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

---

## ✅ Verifying Contracts

Once Blockscout is running and accessible, you can verify contracts:

### Automated Verification

```bash
cd /home/intlc/projects/proxmox
./scripts/verify-all-contracts.sh 0.8.20
```

### Manual Verification

1. Navigate to contract on Blockscout:
   - Example: https://explorer.d-bis.org/address/0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6

2. Click "Code" tab, then "Verify & Publish"

3. Upload source code and metadata

4. Provide constructor arguments (if needed)

5. Submit for verification

**Detailed Guide**: See `docs/BLOCKSCOUT_VERIFICATION_GUIDE.md`

---

## 📊 Current Status

**Last Checked**: $(date)  
**Status**: ⚠️ **API returns 502 (service may be down)**

**Action Required**:
1. Check Blockscout service status on pve2
2. Start service if stopped
3. Verify API is accessible
4. Retry contract verification

---

## 🔗 Related Documentation

- **Verification Guide**: `docs/BLOCKSCOUT_VERIFICATION_GUIDE.md`
- **Validation Report**: `docs/FINAL_VALIDATION_REPORT.md`
- **Contract Addresses**: `docs/CROSS_CHAIN_BRIDGE_ADDRESSES.md`

---

**Last Updated**: $(date)

