# Next Steps - Quick Start Guide

**Date**: 2025-01-18  
**Purpose**: Quick reference for executing all Next Steps

## Overview

All Next Steps have been implemented. This guide provides quick instructions for execution.

---

## Step 1: Configure Bridge Destinations

### Prerequisites

1. **Set ChainID 138 Selector**:
   ```bash
   # Option 1: Use helper script to find selector
   ./scripts/configuration/find-chain-selector.sh
   
   # Option 2: Add to .env manually
   echo "CHAIN138_SELECTOR=<selector>" >> .env
   ```
   
   **Note**: See `CHAIN138_SELECTOR_NOTES.md` for selector information.

2. **Ensure Admin Private Key**:
   ```bash
   # Verify PRIVATE_KEY is set in .env
   grep PRIVATE_KEY .env
   ```

### Execute Configuration

```bash
# Run bridge configuration script
./scripts/configuration/configure-bridge-destinations.sh
```

**What it does**:
- Configures ChainID 138 → Mainnet (both bridges)
- Configures Mainnet → ChainID 138 (if selector is set)
- Verifies configuration

**Expected Output**: Success messages for each bridge configuration.

---

## Step 2: Deploy Off-Chain Services

### State Anchoring Service

```bash
cd services/state-anchoring-service

# Install dependencies
npm install

# Build
npm run build

# Start service
npm start
```

**Environment Variables** (in `.env` or service `.env`):
```bash
PRIVATE_KEY=<admin-private-key>
TETHER_ADDRESS=0x15DF1D5BFDD8Aa4b380445D4e3E9B38d34283619
CHAIN138_RPC_URL=http://192.168.11.211:8545
MAINNET_RPC_URL=https://eth.llamarpc.com
```

**Note**: Validator signature collection needs implementation (placeholder exists).

### Transaction Mirroring Service

```bash
cd services/transaction-mirroring-service

# Install dependencies
npm install

# Build
npm run build

# Start service
npm start
```

**Environment Variables** (in `.env` or service `.env`):
```bash
PRIVATE_KEY=<admin-private-key>
MIRROR_ADDRESS=0x4CF42c4F1dBa748601b8938be3E7ABD732E87cE9
CHAIN138_RPC_URL=http://192.168.11.211:8545
MAINNET_RPC_URL=https://eth.llamarpc.com
BATCH_INTERVAL_MS=60000
```

---

## Step 3: Verify Configuration

### Check Bridge Destinations

```bash
# Mainnet WETH9 Bridge
cast call 0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6 \
  "getDestinationChains()(uint64[])" \
  --rpc-url https://eth.llamarpc.com

# Mainnet WETH10 Bridge
cast call 0xe0E93247376aa097dB308B92e6Ba36bA015535D0 \
  "getDestinationChains()(uint64[])" \
  --rpc-url https://eth.llamarpc.com
```

**Expected**: Arrays should contain destination chain selectors.

### Check Services

1. **State Anchoring Service**: Check logs for block processing
2. **Transaction Mirroring Service**: Check logs for transaction batching

---

## Step 4: Execute Integration Testing

Follow the testing plan in `TASK4_CROSS_CHAIN_TESTING_PLAN.md`:

1. **Phase 1**: Configuration verification
2. **Phase 2**: Small amount test transfers
3. **Phase 3**: State synchronization testing
4. **Phase 4**: End-to-end integration tests
5. **Phase 5**: Edge cases and error handling

**Prerequisites**:
- Bridge destinations configured ✅
- Services running ✅
- Test accounts funded
- LINK tokens for CCIP fees

---

## Step 5: Execute Performance Testing (Optional)

When system is operational and integration tests pass:

Follow `TASK14_PERFORMANCE_TESTING_FRAMEWORK.md` for:
- Throughput testing
- Latency testing
- Gas efficiency testing
- Concurrent load testing
- Stress testing

---

## Quick Reference

### Bridge Addresses

| Contract | Mainnet | ChainID 138 |
|----------|---------|-------------|
| CCIPWETH9Bridge | `0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6` | `0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6` |
| CCIPWETH10Bridge | `0xe0E93247376aa097dB308B92e6Ba36bA015535D0` | `0xe0E93247376aa097dB308B92e6Ba36bA015535D0` |

### Chain Selectors

| Chain | Selector |
|-------|----------|
| Ethereum Mainnet | `5009297550715157269` |
| ChainID 138 | To be determined (see `CHAIN138_SELECTOR_NOTES.md`) |

### Service Status

```bash
# Check if services are running
ps aux | grep -E "state-anchoring|transaction-mirroring"

# Check service logs
tail -f services/state-anchoring-service/logs/*.log
tail -f services/transaction-mirroring-service/logs/*.log
```

---

## Troubleshooting

### Bridge Configuration Fails

- Check `PRIVATE_KEY` is correct admin key
- Verify RPC endpoints are accessible
- Check ChainID 138 selector is set correctly

### Services Won't Start

- Check `PRIVATE_KEY` is set
- Verify RPC endpoints are accessible
- Check npm dependencies are installed
- Review TypeScript compilation errors

### Integration Tests Fail

- Verify bridge destinations are configured
- Check services are running
- Verify test accounts have funds
- Check LINK tokens are available for fees

---

## Support Documentation

- **Bridge Configuration**: `TASK7_BRIDGE_CONFIG_VERIFICATION.md`
- **State Anchoring Service**: `TASK2_STATE_ANCHORING_SERVICE.md`
- **Transaction Mirroring**: `TASK3_TRANSACTION_MIRRORING_SERVICE.md`
- **Integration Testing**: `TASK4_CROSS_CHAIN_TESTING_PLAN.md`
- **Performance Testing**: `TASK14_PERFORMANCE_TESTING_FRAMEWORK.md`
- **Chain Selector**: `CHAIN138_SELECTOR_NOTES.md`

---

**Status**: ✅ **ALL NEXT STEPS IMPLEMENTED - READY FOR EXECUTION**
