# Quick Start Guide

**Last Updated**: 2025-01-27  
**Status**: Active

This guide will help you quickly get started with the DeFi Oracle Meta Mainnet deployment.

> **Related Documentation**:
> - [Deployment Quick Start](../DEPLOYMENT_QUICK_START.md) - Fast deployment guide
> - [Architecture Documentation](../architecture/ARCHITECTURE.md) - System architecture
> - [Deployment Guide](../deployment/DEPLOYMENT.md) - Comprehensive deployment guide

## Prerequisites

- Azure CLI installed and configured
- Terraform >= 1.0
- kubectl
- Helm 3.x
- Foundry (forge, cast, anvil)

## Quick Deployment

### 1. Clone Repository

```bash
git clone <repository-url>
cd smom-dbis-138
```

### 2. Generate Keys and Genesis

```bash
# Generate validator keys
./scripts/key-management/generate-validator-keys.sh 4

# Generate oracle keys
./scripts/key-management/generate-oracle-keys.sh

# Generate genesis file
./scripts/generate-genesis-proper.sh 4
./scripts/validation/validate-genesis.sh
```

### 3. Deploy Infrastructure

```bash
# Navigate to Terraform directory
cd terraform

# Initialize Terraform
terraform init

# Create terraform.tfvars
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your values

# Deploy infrastructure
terraform plan
terraform apply
```

### 4. Configure kubectl

```bash
az aks get-credentials --resource-group defi-oracle-mainnet-rg --name defi-oracle-aks
```

### 5. Deploy Kubernetes Resources

```bash
# Create namespace
kubectl apply -f k8s/base/namespace.yaml

# Deploy validators
helm install besu-validators ./helm/besu-network -f helm/besu-network/values-validators.yaml -n besu-network

# Deploy sentries
helm install besu-sentries ./helm/besu-network -f helm/besu-network/values-sentries.yaml -n besu-network

# Deploy RPC nodes
helm install besu-rpc ./helm/besu-network -f helm/besu-network/values-rpc.yaml -n besu-network
```

### 6. Deploy Monitoring

```bash
# Create monitoring namespace
kubectl create namespace monitoring

# Deploy Prometheus
kubectl apply -f monitoring/k8s/prometheus.yaml
```

### 7. Deploy Blockscout

```bash
# Deploy Blockscout
kubectl apply -f k8s/blockscout/deployment.yaml
```

### 8. Deploy Contracts

```bash
# Set environment variables
export RPC_URL="https://rpc.d-bis.org"
export PRIVATE_KEY="your-private-key"

# Deploy WETH
./scripts/deployment/deploy-weth.sh

# Deploy Multicall
./scripts/deployment/deploy-multicall.sh

# Deploy Oracle
forge script script/DeployOracle.s.sol --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY
```

### 9. Deploy Oracle Publisher

```bash
# Update oracle configuration
kubectl create configmap oracle-config \
  --from-literal=aggregator_address=<AGGREGATOR_ADDRESS> \
  -n besu-network

# Deploy oracle publisher
kubectl apply -f services/oracle-publisher/k8s/deployment.yaml
```

### 10. Tatum SDK Integration

```bash
# Navigate to SDK directory
cd sdk

# Install dependencies
npm install

# Configure environment
cp env.example .env
# Edit .env with your RPC endpoint

# Test connection
npm run test

# Run examples
npm run example:basic
npm run example:transaction
```

### 11. Verify Deployment

```bash
# Check node status
kubectl get pods -n besu-network

# Test RPC endpoint
curl -X POST https://rpc.d-bis.org \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

# Run health check
./tests/health-check.sh

# Test Tatum SDK
cd sdk && npm run test
```

## Next Steps

- Review [Deployment Guide](../deployment/DEPLOYMENT.md) for detailed instructions
- Check [Architecture Documentation](../architecture/ARCHITECTURE.md) for system design
- Read [API Documentation](../api/API.md) for RPC API details
- Review [Tatum SDK Integration](../api/TATUM_SDK.md) for SDK usage
- Review [Security Documentation](../security/SECURITY.md) for security best practices

## Troubleshooting

### Nodes Not Starting

1. Check node logs: `kubectl logs -f <pod-name> -n besu-network`
2. Verify configuration: `kubectl describe pod <pod-name> -n besu-network`
3. Check resource limits: `kubectl top pods -n besu-network`

### RPC Not Responding

1. Check RPC node status: `kubectl get pods -l component=rpc -n besu-network`
2. Verify service: `kubectl get svc besu-rpc -n besu-network`
3. Check API gateway: `kubectl get pods -l app=rpc-gateway -n besu-network`

### Oracle Not Updating

1. Check oracle publisher logs: `kubectl logs -f oracle-publisher -n besu-network`
2. Verify aggregator address: `kubectl get configmap oracle-config -n besu-network -o yaml`
3. Check private key: `kubectl get secret oracle-keys -n besu-network`

## Support

For support, please open an issue on the project repository or contact the network operators.
