# Next Steps - Deployment and Integration Guide

Comprehensive list of all next steps to complete the deployment and integration of ChainID 138.

**Last Reviewed**: 2026-04-13  
**Status**: Historical next-steps snapshot

This document preserves an earlier deployment sequence. Check `docs/deployment/MASTER_INDEX.md` and `docs/PROJECT_OPTIMIZATION_STATUS.md` for the current operator view before executing tasks below.

## Overview

This document provides a prioritized list of all next steps required to complete the deployment and integration of ChainID 138, including infrastructure deployment, contract deployment, DNS configuration, and MetaMask integration.

## Status Summary

- ✅ **Code Tasks**: 112/112 completed (100%)
- ⚠️ **Deployment Tasks**: 0/15 completed (0%)
- ⚠️ **Integration Tasks**: 0/10 completed (0%)
- ⚠️ **Operational Tasks**: 0/5 completed (0%)

## 🔴 Critical Priority - Immediate Actions (Week 1)

### Infrastructure Deployment

#### 1. Azure Authentication (WSL Users)
- [ ] Install Azure CLI (if not already installed)
  ```bash
  curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
  ```
- [ ] Login to Azure
  ```bash
  az login
  ```
  This will open a browser window for authentication.
- [ ] Verify login
  ```bash
  az account show
  ```
- [ ] Set subscription (if needed)
  ```bash
  az account set --subscription <subscription-id>
  ```
- [ ] Or use the helper script
  ```bash
  ./scripts/deployment/azure-login.sh
  ```

**Note**: Azure authentication is required before running deployment scripts that interact with Azure (infrastructure, Kubernetes, Cloudflare DNS).

#### 2. Configure Environment Variables
- [ ] Create `.env` file from `.env.example`
- [ ] Set `AZURE_SUBSCRIPTION_ID`
- [ ] Set `AZURE_TENANT_ID`
- [ ] Set `AZURE_CLIENT_ID` (optional, for service principal)
- [ ] Set `AZURE_CLIENT_SECRET` (optional, for service principal)
- [ ] Set `AZURE_RESOURCE_GROUP`
- [ ] Set `CLOUDFLARE_API_TOKEN`
- [ ] Set `CLOUDFLARE_ZONE_ID`
- [ ] Set `PRIVATE_KEY` (deployer key)
- [ ] Set `RPC_URL` (production URL)
- [ ] Set `EXPLORER_URL` (production URL)

**Script**: `./scripts/deployment/deploy-all.sh --help`

#### 3. Deploy Azure Infrastructure
- [ ] Initialize Terraform backend
- [ ] Create `terraform.tfvars` with production values
- [ ] Run `terraform plan` to review changes
- [ ] Run `terraform apply` to deploy infrastructure
- [ ] Verify AKS cluster is created
- [ ] Verify Application Gateway is created
- [ ] Verify Key Vault is created
- [ ] Verify Network Security Groups are created

**Script**: `./scripts/deployment/deploy-all.sh --skip-kubernetes --skip-blockscout --skip-contracts --skip-cloudflare`

#### 4. Configure Cloudflare DNS
- [ ] Get Application Gateway public IP address
- [ ] Run Cloudflare DNS configuration script
- [ ] Verify DNS records are created:
  - [ ] `d-bis.org` (A record)
  - [ ] `www.d-bis.org` (A record)
  - [ ] `rpc.d-bis.org` (A record)
  - [ ] `rpc2.d-bis.org` (A record)
  - [ ] `explorer.d-bis.org` (A record)
- [ ] Wait for DNS propagation (5-30 minutes)
- [ ] Verify DNS resolution with `dig` or `nslookup`

**Script**: `./scripts/deployment/cloudflare-dns.sh --zone-id <ZONE_ID> --api-token <TOKEN> --ip <IP_ADDRESS>`

#### 5. Configure SSL Certificates
- [ ] Enable Cloudflare SSL/TLS (Automatic)
- [ ] Verify SSL certificates are issued
- [ ] Test HTTPS access to all domains
- [ ] Configure SSL/TLS mode (Full or Full Strict)
- [ ] Verify certificate validity

**Manual**: Cloudflare Dashboard → SSL/TLS → Overview

#### 6. Deploy Kubernetes Resources
- [ ] Configure kubectl for AKS cluster
- [ ] Create namespace: `besu-network`
- [ ] Deploy validators (Helm chart)
- [ ] Deploy sentries (Helm chart)
- [ ] Deploy RPC nodes (Helm chart)
- [ ] Verify all pods are running
- [ ] Verify RPC endpoints are accessible

**Script**: `./scripts/deployment/deploy-all.sh --skip-infrastructure --skip-blockscout --skip-contracts --skip-cloudflare`

#### 7. Deploy Blockscout Explorer
- [ ] Deploy Blockscout database (StatefulSet)
- [ ] Deploy Blockscout application (Deployment)
- [ ] Wait for database migrations to complete
- [ ] Verify Blockscout is accessible
- [ ] Configure CORS headers for MetaMask Portfolio
- [ ] Test Blockscout API endpoints

**Script**: `./scripts/deployment/deploy-all.sh --skip-infrastructure --skip-kubernetes --skip-contracts --skip-cloudflare`

#### 8. Deploy Contracts
- [ ] Deploy WETH contract
- [ ] Deploy Multicall contract
- [ ] Deploy Oracle Aggregator contract
- [ ] Deploy CCIP Router contract (optional)
- [ ] Verify contracts are deployed
- [ ] Verify contract code on Blockscout
- [ ] Save contract addresses to `contracts-deployed.json`

**Script**: `./scripts/deployment/deploy-all.sh --skip-infrastructure --skip-kubernetes --skip-blockscout --skip-cloudflare`

#### 9. Update Token List
- [ ] Read contract addresses from `contracts-deployed.json`
- [ ] Update `metamask/token-list.json` with WETH address
- [ ] Update `metamask/token-list.json` with other token addresses
- [ ] Validate token list against schema
- [ ] Commit token list changes to repository

**Script**: `./scripts/deployment/update-token-list.sh`

#### 10. Verify Deployment
- [ ] Run deployment verification script
- [ ] Test RPC endpoint accessibility
- [ ] Test Blockscout explorer accessibility
- [ ] Test contract deployments
- [ ] Test Kubernetes resources
- [ ] Test MetaMask integration files
- [ ] Test DNS configuration
- [ ] Generate verification report

**Script**: `./scripts/deployment/verify-deployment.sh`

## 🟡 High Priority - Short-Term Actions (Month 1)

### MetaMask Integration

#### 10. Submit Ethereum-Lists PR
- [ ] Fork `ethereum-lists/chains` repository
- [ ] Create branch: `add-chainid-138`
- [ ] Add chain data file: `_data/chains/e138.json`
- [ ] Validate chain data JSON
- [ ] Create PR with description from template
- [ ] Respond to review comments
- [ ] Wait for PR approval and merge
- [ ] Verify ChainID 138 appears on Chainlist

**Script**: `./scripts/deployment/submit-ethereum-lists-pr.sh`

#### 11. Submit Token List to CoinGecko
- [ ] Fork `coingecko/token-lists` repository
- [ ] Add token list file to repository
- [ ] Create PR to coingecko/token-lists
- [ ] Respond to review comments
- [ ] Wait for PR approval and merge
- [ ] Verify token list is accepted

**Script**: `./scripts/deployment/submit-token-list.sh` (provides instructions)

#### 12. Submit Token List to Uniswap
- [ ] Fork `Uniswap/token-lists` repository
- [ ] Add token list file to `src/tokens/` directory
- [ ] Update `tokens.ts` to include the list
- [ ] Create PR to Uniswap/token-lists
- [ ] Respond to review comments
- [ ] Wait for PR approval and merge
- [ ] Verify token list is accepted

**Script**: `./scripts/deployment/submit-token-list.sh` (provides instructions)

#### 13. Submit Token List to Token Lists Aggregator
- [ ] Visit https://tokenlists.org
- [ ] Click "Add Token List"
- [ ] Enter token list URL: `https://raw.githubusercontent.com/Defi-Oracle-Tooling/smom-dbis-138/main/metamask/token-list.json`
- [ ] Submit for review
- [ ] Wait for approval
- [ ] Verify token list appears on aggregator

**Manual**: Visit tokenlists.org and submit URL

#### 14. Verify MetaMask Portfolio Compatibility
- [ ] Add ChainID 138 to MetaMask
- [ ] Add tokens to MetaMask
- [ ] Open MetaMask Portfolio
- [ ] Verify token balances display correctly
- [ ] Verify token symbols display correctly
- [ ] Verify token logos display correctly
- [ ] Test token auto-detection (if applicable)
- [ ] Document any issues

**Manual**: Test with MetaMask browser extension

#### 15. Host Token Logos
- [ ] Create token logo images (512x512 PNG)
- [ ] Upload logos to Blockscout or CDN
- [ ] Update token list with logo URLs
- [ ] Verify logos are accessible via HTTPS
- [ ] Test logo display in MetaMask

**Manual**: Upload to Blockscout or CDN

## 🟢 Medium Priority - Long-Term Actions (Quarter 1)

### Bridge and DEX Integration

#### 16. Bridge Integration
- [ ] Research bridge providers that support ChainID 138
- [ ] Evaluate bridge security and audits
- [ ] Partner with bridge provider (if needed)
- [ ] Integrate bridge into dapps
- [ ] Test bridge functionality
- [ ] Document bridge usage

**Status**: Requires partnership with bridge provider

#### 17. DEX Integration
- [ ] Research DEX providers that support ChainID 138
- [ ] Evaluate DEX security and audits
- [ ] Partner with DEX provider (if needed)
- [ ] Integrate DEX into dapps
- [ ] Test DEX functionality
- [ ] Document DEX usage

**Status**: Requires partnership with DEX provider

#### 18. On-Ramp Integration
- [ ] Research on-ramp providers (MoonPay, Ramp, etc.)
- [ ] Evaluate on-ramp security and compliance
- [ ] Partner with on-ramp provider
- [ ] Integrate on-ramp into dapps
- [ ] Test on-ramp functionality
- [ ] Document on-ramp usage

**Status**: Requires partnership with on-ramp provider

### Business Development

#### 19. Consensys Outreach
- [ ] Prepare integration proposal
- [ ] Contact Consensys business development
- [ ] Schedule meeting to discuss integration
- [ ] Submit proposal for Swaps integration
- [ ] Submit proposal for Bridge integration
- [ ] Submit proposal for on-ramp integration
- [ ] Follow up on proposals
- [ ] Track integration progress

**Documentation**: `docs/METAMASK_BD.md`

#### 20. Monitor MetaMask Feature Updates
- [ ] Subscribe to MetaMask updates
- [ ] Monitor Delegation Toolkit pages
- [ ] Track network support announcements
- [ ] Update documentation as features are added
- [ ] Test new features when available

**Manual**: Monitor MetaMask announcements

## 🔵 Low Priority - Future Enhancements

### Advanced Features

#### 21. Enhanced Token Discovery
- [ ] Implement token discovery API
- [ ] Add token metadata endpoint
- [ ] Implement token logo CDN
- [ ] Add token verification system
- [ ] Document token discovery process

#### 22. Advanced MetaMask Features
- [ ] Implement wallet connect integration
- [ ] Add transaction signing UI
- [ ] Implement gas estimation helpers
- [ ] Add network switching UI
- [ ] Document advanced features

#### 23. User Documentation
- [ ] Create user guides for adding network
- [ ] Create user guides for adding tokens
- [ ] Create troubleshooting guides
- [ ] Create video tutorials
- [ ] Update documentation based on user feedback

## 📋 Deployment Checklist

### Pre-Deployment
- [ ] Environment variables configured
- [ ] Azure credentials verified
- [ ] Cloudflare credentials verified
- [ ] Private keys secured
- [ ] Terraform state backend configured
- [ ] DNS zone verified

### Deployment
- [ ] Infrastructure deployed
- [ ] DNS configured
- [ ] SSL certificates configured
- [ ] Kubernetes resources deployed
- [ ] Blockscout deployed
- [ ] Contracts deployed
- [ ] Token list updated

### Post-Deployment
- [ ] Deployment verified
- [ ] RPC endpoints tested
- [ ] Blockscout tested
- [ ] Contracts verified
- [ ] MetaMask integration tested
- [ ] Documentation updated

## 🚀 Quick Start Commands

### Complete Deployment
```bash
# Deploy everything
./scripts/deployment/deploy-all.sh

# Deploy with options
./scripts/deployment/deploy-all.sh \
  --skip-infrastructure \
  --skip-kubernetes \
  --skip-blockscout \
  --skip-contracts \
  --skip-cloudflare
```

### Individual Steps
```bash
# Configure Cloudflare DNS
./scripts/deployment/cloudflare-dns.sh \
  --zone-id <ZONE_ID> \
  --api-token <TOKEN> \
  --ip <IP_ADDRESS>

# Update token list
./scripts/deployment/update-token-list.sh

# Verify deployment
./scripts/deployment/verify-deployment.sh

# Submit Ethereum-Lists PR
./scripts/deployment/submit-ethereum-lists-pr.sh

# Submit token list
./scripts/deployment/submit-token-list.sh
```

## 📊 Progress Tracking

### Week 1 (Critical)
- [ ] Infrastructure deployment
- [ ] DNS configuration
- [ ] SSL certificates
- [ ] Kubernetes deployment
- [ ] Blockscout deployment
- [ ] Contract deployment
- [ ] Token list update
- [ ] Deployment verification

### Month 1 (High Priority)
- [ ] Ethereum-Lists PR
- [ ] CoinGecko token list submission
- [ ] Uniswap token list submission
- [ ] Token Lists aggregator submission
- [ ] MetaMask Portfolio verification
- [ ] Token logo hosting

### Quarter 1 (Medium Priority)
- [ ] Bridge integration
- [ ] DEX integration
- [ ] On-ramp integration
- [ ] Consensys outreach
- [ ] MetaMask feature monitoring

## 🔗 Related Documentation

- [Deployment Guide](../../deployment/DEPLOYMENT.md)
- [MetaMask Integration Guide](../integrations/METAMASK_INTEGRATION.md)
- [MetaMask Gaps Analysis](../integrations/METAMASK_GAPS_ANALYSIS.md)
- [MetaMask Completion Summary (Archived)](../../archive/status-reports/operations-legacy/COMPLETION_SUMMARY_METAMASK.md)
- [Quick Start Guide](../../guides/QUICKSTART.md)
- [TODO List](TODO.md)

## 📝 Notes

### Environment Variables
All required environment variables must be set in `.env` file:
- Azure credentials (subscription, tenant, client, secret)
- Cloudflare credentials (API token, zone ID)
- Deployment keys (private key, RPC URL, explorer URL)

### Deployment Order
1. Infrastructure (Terraform)
2. DNS (Cloudflare)
3. Kubernetes (Helm charts)
4. Blockscout (Kubernetes)
5. Contracts (Foundry)
6. Token List (Update)
7. Verification (Scripts)

### Verification
Run verification after each deployment step:
```bash
./scripts/deployment/verify-deployment.sh
```

### Troubleshooting
See [Troubleshooting Guide](../../guides/TROUBLESHOOTING.md) for common issues and solutions.

## 🎯 Success Criteria

### Deployment Complete
- ✅ RPC endpoints accessible at https://rpc.d-bis.org
- ✅ Blockscout accessible at https://explorer.d-bis.org
- ✅ Contracts deployed and verified
- ✅ Token list updated with deployed addresses
- ✅ DNS configured and propagated
- ✅ SSL certificates valid

### Integration Complete
- ✅ Ethereum-Lists PR submitted and merged
- ✅ Token list submitted to aggregators
- ✅ MetaMask Portfolio compatibility verified
- ✅ Token logos hosted and accessible

### Production Ready
- ✅ All critical tasks completed
- ✅ All high-priority tasks completed
- ✅ Deployment verified
- ✅ Integration tested
- ✅ Documentation updated

## 📞 Support

For issues or questions:
- Open an issue on GitHub
- Contact the project team
- Review documentation
- Check troubleshooting guide
