feat: explorer API, wallet, CCIP scripts, and config refresh
- Backend REST/gateway/track routes, analytics, Blockscout proxy paths. - Frontend wallet and liquidity surfaces; MetaMask token list alignment. - Deployment docs, verification scripts, address inventory updates. Check: go build ./... under backend/ (pass). Made-with: Cursor
This commit is contained in:
@@ -1,30 +1,45 @@
|
||||
# Database Connection Guide
|
||||
|
||||
## Important: Two Different Database Users
|
||||
## Supported Database Layouts
|
||||
|
||||
There are **two separate database systems**:
|
||||
The explorer backend supports **two deployment modes**:
|
||||
|
||||
1. **Blockscout Database** (for Blockscout explorer)
|
||||
- User: `blockscout`
|
||||
- Password: `blockscout`
|
||||
- Database: `blockscout`
|
||||
1. **Standalone explorer DB**
|
||||
- User: usually `explorer`
|
||||
- Database: usually `explorer`
|
||||
- Migration mode: full Track 2-4 schema
|
||||
|
||||
2. **Custom Explorer Backend Database** (for tiered architecture)
|
||||
- User: `explorer`
|
||||
- Password: `L@ker$2010`
|
||||
- Database: `explorer`
|
||||
2. **Shared Blockscout DB**
|
||||
- User: usually `blockscout`
|
||||
- Database: usually `blockscout`
|
||||
- Migration mode: explorer auth/operator subset only
|
||||
|
||||
Use `bash scripts/run-migration-0010.sh` for both modes. The helper auto-detects whether it is connected to a standalone explorer database or a shared Blockscout database and chooses the safe migration path automatically.
|
||||
|
||||
## Correct Connection Command
|
||||
|
||||
For the **custom explorer backend** (tiered architecture), use:
|
||||
For a **standalone explorer database**, use:
|
||||
|
||||
```bash
|
||||
PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c "SELECT 1;"
|
||||
export DB_PASSWORD='<your explorer DB password>'
|
||||
PGPASSWORD="$DB_PASSWORD" psql -h localhost -U explorer -d explorer -c "SELECT 1;"
|
||||
```
|
||||
|
||||
For a **shared Blockscout database**, use:
|
||||
|
||||
```bash
|
||||
export DB_HOST=localhost
|
||||
export DB_USER=blockscout
|
||||
export DB_NAME=blockscout
|
||||
export DB_PASSWORD='<your Blockscout DB password>'
|
||||
PGPASSWORD="$DB_PASSWORD" psql -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -c "SELECT 1;"
|
||||
```
|
||||
|
||||
Do **not** run the full `0010_track_schema.up.sql` directly against the shared Blockscout DB.
|
||||
|
||||
**NOT:**
|
||||
```bash
|
||||
# ❌ Wrong - this is for Blockscout
|
||||
# ❌ Wrong - mismatched user/database pair
|
||||
PGPASSWORD='blockscout' psql -h localhost -U blockscout -d explorer -c "SELECT 1;"
|
||||
```
|
||||
|
||||
@@ -34,40 +49,32 @@ PGPASSWORD='blockscout' psql -h localhost -U blockscout -d explorer -c "SELECT 1
|
||||
|
||||
```bash
|
||||
# Test connection to custom explorer database
|
||||
PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c "SELECT version();"
|
||||
export DB_PASSWORD='<your explorer DB password>'
|
||||
PGPASSWORD="$DB_PASSWORD" psql -h localhost -U explorer -d explorer -c "SELECT version();"
|
||||
```
|
||||
|
||||
### 2. Check if Tables Exist
|
||||
|
||||
```bash
|
||||
# Check for track schema tables
|
||||
PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c "
|
||||
SELECT table_name
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transfers')
|
||||
ORDER BY table_name;
|
||||
"
|
||||
# Check the database mode and required tables
|
||||
bash scripts/check-database-connection.sh
|
||||
```
|
||||
|
||||
### 3. Run Migration (if tables don't exist)
|
||||
|
||||
```bash
|
||||
cd explorer-monorepo
|
||||
PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer \
|
||||
-f backend/database/migrations/0010_track_schema.up.sql
|
||||
export DB_PASSWORD='<your explorer DB password>'
|
||||
bash scripts/run-migration-0010.sh
|
||||
```
|
||||
|
||||
### 4. Verify Migration
|
||||
|
||||
```bash
|
||||
# Should return 4 or more
|
||||
PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c "
|
||||
SELECT COUNT(*) as table_count
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transfers', 'analytics_flows', 'operator_events');
|
||||
"
|
||||
# Standalone explorer DB should include Track 2-4 tables plus auth/operator tables.
|
||||
# Shared Blockscout DB should include at least:
|
||||
# wallet_nonces, operator_roles, operator_events, operator_ip_whitelist
|
||||
bash scripts/check-database-connection.sh
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
@@ -94,10 +101,10 @@ AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transf
|
||||
|
||||
You should see both `blockscout` and `explorer` databases.
|
||||
|
||||
4. **Create user and database if missing:**
|
||||
4. **Create a standalone explorer user and database if you want a dedicated backend DB:**
|
||||
```bash
|
||||
sudo -u postgres psql << EOF
|
||||
CREATE USER explorer WITH PASSWORD 'L@ker\$2010';
|
||||
CREATE USER explorer WITH PASSWORD '<set-a-strong-password>';
|
||||
CREATE DATABASE explorer OWNER explorer;
|
||||
GRANT ALL PRIVILEGES ON DATABASE explorer TO explorer;
|
||||
\q
|
||||
@@ -106,9 +113,10 @@ AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transf
|
||||
|
||||
### If Password Authentication Fails
|
||||
|
||||
1. **Verify password is correct:**
|
||||
- Custom explorer: `L@ker$2010`
|
||||
- Blockscout: `blockscout`
|
||||
1. **Verify the correct password is exported in `DB_PASSWORD`**
|
||||
2. **Confirm you are connecting with the right mode pair**
|
||||
- standalone explorer DB: `explorer` / `explorer`
|
||||
- shared Blockscout DB: `blockscout` / `blockscout`
|
||||
|
||||
2. **Check pg_hba.conf:**
|
||||
```bash
|
||||
@@ -128,7 +136,7 @@ Use the provided script:
|
||||
|
||||
```bash
|
||||
cd explorer-monorepo
|
||||
export DB_PASSWORD='L@ker$2010'
|
||||
export DB_PASSWORD='<your explorer DB password>'
|
||||
bash scripts/fix-database-connection.sh
|
||||
```
|
||||
|
||||
@@ -144,7 +152,7 @@ This script will:
|
||||
```bash
|
||||
pkill -f api-server
|
||||
cd explorer-monorepo/backend
|
||||
export DB_PASSWORD='L@ker$2010'
|
||||
export DB_PASSWORD='<your explorer DB password>'
|
||||
export JWT_SECRET='your-secret-here'
|
||||
./bin/api-server
|
||||
```
|
||||
@@ -162,10 +170,10 @@ This script will:
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"address":"0x1234567890123456789012345678901234567890"}'
|
||||
```
|
||||
If the response mentions `wallet_nonces`, returns `service_unavailable`, or the wallet popup shows `Nonce: undefined`, rerun `bash scripts/run-migration-0010.sh`, restart the backend, and retry.
|
||||
|
||||
## Summary
|
||||
|
||||
- **Custom Explorer Backend:** Use `explorer` user with password `L@ker$2010`
|
||||
- **Blockscout:** Use `blockscout` user with password `blockscout`
|
||||
- **They are separate systems** with separate databases
|
||||
|
||||
- **Standalone explorer DB:** use the `explorer` user/database pair and the full Track 2-4 schema
|
||||
- **Shared Blockscout DB:** use the Blockscout credentials and let `scripts/run-migration-0010.sh` apply only the auth/operator subset
|
||||
- **Do not** apply `0010_track_schema.up.sql` directly to the shared Blockscout DB
|
||||
|
||||
Reference in New Issue
Block a user